Im currently working on rendering OpenGL. I am using the Tessellation pipeline. So far, everything is going well, one problem. This is on the stage where I knocked my head for many years, feeling that progress was not happening.
First of all, here is the gif about what I mean. In fact, my problem is that whenever the mouse moves, the planet rotates as if it was βlookingβ at where the camera is pointing.
There are some graphical problems, but because of me they simply repeat the same height map throughout the cuquet. Since it does not match, there are clear seams.
Below is my evaluation shader:
void main(void) { vec4 p0 = gl_in[0].gl_Position; vec4 p1 = gl_in[1].gl_Position; vec4 p2 = gl_in[2].gl_Position; vec3 p = gl_TessCoord.xyz; Normal_FS_in = mat3(transpose(inverse((MV)))) * (p0*px + (p1*py) + p2*pz).xyz; float displacment = texture(tex1, Normal_FS_in).r * 800; gl_Position = MVP*(p0*px + (p1*py) + p2*pz) + (vec4(vec3(displacment,displacment,0) * normalize(Normal_FS_in),1)); }
It is pretty simple. The shader calculates the normal for the output vertex. It is then used to capture the offset value from the height map, which is a cube map. Then computes GL_Position. What I was trying to solve is that my problem is with the shaders or the rest of the package.
My attempts were mostly messing around. I moved all the normal related things to the evaluation shader, and then calculated it in the vertex shader and passed them to the control and evaluation shaders.
The problem only occurs when moving the mouse.
Any suggestions would be fantastic - I hope all I need is pointed in the right direction.
Change Performing the inverse transposition of the matrix of the viewing matrix or viewing matrix gives the result in gif. Using the matrix model leads to distortion of the normals when moving the camera, so that the relief bends around the place.