Update the projective texture shader to solve the texture interpolation artifact.
This commit is contained in:
@@ -6,12 +6,9 @@ static const char* projectiveTextureInstancingFragmentShader= \
|
||||
"{\n"
|
||||
" vec4 color;\n"
|
||||
"} fragment;\n"
|
||||
"in Vert\n"
|
||||
"{\n"
|
||||
" vec2 texcoord;\n"
|
||||
"} vert;\n"
|
||||
"uniform sampler2D Diffuse;\n"
|
||||
"uniform mat4 ViewMatrixInverse;\n"
|
||||
"uniform mat4 TextureMVP;\n"
|
||||
"in vec3 lightPos,cameraPosition, normal,ambient;\n"
|
||||
"in vec4 vertexPos;\n"
|
||||
"in float materialShininess;\n"
|
||||
@@ -20,7 +17,9 @@ static const char* projectiveTextureInstancingFragmentShader= \
|
||||
"out vec4 color;\n"
|
||||
"void main(void)\n"
|
||||
"{\n"
|
||||
" vec4 texel = fragment.color*texture(Diffuse,vert.texcoord.xy);\n"
|
||||
" vec4 projcoords = TextureMVP * vertexPos;\n"
|
||||
" vec2 texturecoords = projcoords.xy/max(projcoords.z,0.1);\n"
|
||||
" vec4 texel = fragment.color*texture(Diffuse,texturecoords);\n"
|
||||
" vec3 ct,cf;\n"
|
||||
" float intensity,at,af;\n"
|
||||
" if (fragment.color.w==0)\n"
|
||||
|
||||
Reference in New Issue
Block a user