Debugged the area sampling of the fragmentshader.
This commit is contained in:
parent
fa19643fa0
commit
8dcc04b7b2
3 changed files with 15 additions and 11 deletions
|
@ -124,7 +124,7 @@ class Structure:
|
|||
if alternateprograms == None:
|
||||
program_id = key
|
||||
else:
|
||||
assert key in alternateprograms.keys
|
||||
assert key in alternateprograms
|
||||
program_id = alternateprograms[key]
|
||||
glUseProgram(program_id)
|
||||
check_error("Renderingprogram is not initialized!")
|
||||
|
|
|
@ -20,7 +20,7 @@ const float diffuseFactor = 0.5;
|
|||
const float specFactor = 1.0;
|
||||
const float shininess = 16.0;
|
||||
const float screenGamma = 2.2;
|
||||
const float pitl = 3.14159265359 / 16.0;
|
||||
const float pitl = 2*3.14159265359 / 16.0;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
@ -37,14 +37,15 @@ void main()
|
|||
//int visible = int(!(texture(ShadowMaps,lightpos[i].xy/2 + vec2(0.5,0.5)).z < (lightpos[i].z)));
|
||||
float visible = 0;
|
||||
for(int j = 0; j < 4; j++){
|
||||
vec2 offs = vec2(sin(j*pitl),cos(j*pitl)) / 700;
|
||||
vec2 offs = vec2(cos(j*4*pitl),sin(j*4*pitl)) / 700;
|
||||
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;
|
||||
}
|
||||
if(visible == 0.25)
|
||||
visible = 1.0;
|
||||
else
|
||||
for(int j = 4; j < 16; j++){
|
||||
vec2 offs = vec2(sin(j*pitl),cos(j*pitl)) / 700;
|
||||
visible = 0;
|
||||
for(int j = 0; j < 16; j++){
|
||||
vec2 offs = vec2(cos(j*pitl),sin(j*pitl)) / 700;
|
||||
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;
|
||||
}
|
||||
colorLinear += (visible * 0.5 + 0.5) *(lambertian * diffuseFactor * colorin * lightColor[i] + specular * specFactor*colorin);
|
||||
|
|
15
main.py
15
main.py
|
@ -285,13 +285,13 @@ vai3,pbi3,cbi3 = 0,0,0
|
|||
rx = 0
|
||||
ry = 0
|
||||
|
||||
def render(program_id,projMatrix,vai,x,y,z):
|
||||
def render(program_id,projMatrix,vai,x,y,z,alternateprograms = None):
|
||||
|
||||
#global struct
|
||||
#struct.render(translate(x, y, z) * rotate(0,ry,0,True) * projMatrix,rotate(rx, 0, 0))
|
||||
global struct
|
||||
struct.render(translate(x, y, z) * rotate(0,ry,0,True) * projMatrix,rotate(rx, 0, 0),alternateprograms)
|
||||
|
||||
|
||||
glUseProgram(program_id)
|
||||
'''glUseProgram(program_id)
|
||||
check_error("Renderingprogram is not initialized!")
|
||||
|
||||
projection = glGetUniformLocation(program_id, 'projModelViewMatrix')
|
||||
|
@ -306,7 +306,7 @@ def render(program_id,projMatrix,vai,x,y,z):
|
|||
check_error("Rendering problem")
|
||||
|
||||
glBindVertexArray(0)
|
||||
glUseProgram(0)
|
||||
glUseProgram(0)'''
|
||||
|
||||
def display():
|
||||
'''if time.time() - start >= 1:
|
||||
|
@ -338,7 +338,10 @@ def display():
|
|||
glUniform1f(farid, 100)
|
||||
glUniform1f(widthid, width)
|
||||
glUniform1f(heightid, height)
|
||||
render(program3_id, newMat, vai, 0, 0, 0)
|
||||
|
||||
altPrId = {}
|
||||
altPrId[program_id] = program3_id
|
||||
render(program3_id, newMat, vai, 0, 0, 0,altPrId)
|
||||
glFlush()
|
||||
l.finishDepthMapping()
|
||||
resize(width, height)
|
||||
|
|
Loading…
Reference in a new issue