Fiddling around with lighting and a Rendermanager
This commit is contained in:
parent
8d7625a411
commit
1995d2734e
2 changed files with 11 additions and 2 deletions
|
@ -52,6 +52,8 @@ class LightingManager:
|
|||
def render(self, projMatrix, geometryRotMatrix):
|
||||
self.light.finishDepthMapping()
|
||||
|
||||
|
||||
|
||||
def addRenderStep(self,alternateprogramdict,structure):
|
||||
r = self.__Renderstep(alternateprogramdict,structure)
|
||||
self.renderSteps.append(r)
|
||||
|
|
|
@ -23,6 +23,11 @@ const float screenGamma = 2.2;
|
|||
const float pitl = 2*3.14159265359 / 16.0;
|
||||
const float circlelength = 700.0;
|
||||
|
||||
bool isVisible(int i, vec2 offs)
|
||||
{
|
||||
return !(texture(ShadowMaps[i],lightviewpos[i].xy + offs).x <= (lightviewpos[i].z - 0.0005*tan(acos(dot(normal,-normalize(lightpos[i] - pos.xyz))))));
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 colorLinear = ambientFactor * colorin;
|
||||
|
@ -39,7 +44,7 @@ void main()
|
|||
float visible = 0;
|
||||
for(int j = 0; j < 4; j++){
|
||||
vec2 offs = vec2(cos(j*4*pitl),sin(j*4*pitl)) / circlelength;
|
||||
visible += float(!(texture(ShadowMaps[i],lightviewpos[i].xy + offs).x <= (lightviewpos[i].z - 0.0005*tan(acos(dot(normal,-normalize(lightpos[i] - pos.xyz))))))) * 1.0/16.0;
|
||||
visible += float(isVisible(i, offs)) * 1.0/16.0;
|
||||
}
|
||||
if(visible == 0.25)
|
||||
visible = 1.0;
|
||||
|
@ -47,9 +52,11 @@ void main()
|
|||
visible = 0;
|
||||
for(int j = 0; j < 16; j++){
|
||||
vec2 offs = vec2(cos(j*pitl),sin(j*pitl)) / circlelength;
|
||||
visible += float(!(texture(ShadowMaps[i],lightviewpos[i].xy + offs).x <= (lightviewpos[i].z - 0.0005*tan(acos(dot(normal,-normalize(lightpos[i] - pos.xyz))))))) * 1.0/16.0;
|
||||
visible += float(isVisible(i, offs)) * 1.0/16.0;
|
||||
}
|
||||
colorLinear += (visible * 0.5 + 0.5) *(lambertian * diffuseFactor * colorin * lightColor[i] + specular * specFactor*colorin);
|
||||
|
||||
colorLinear /= dot(lightpos[i] - pos.xyz, lightpos[i] - pos.xyz)/200;
|
||||
//colorLinear = vec3(visible * specular);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue