The problem with the normal display of Parallax in Opengl, GLSL

I have a terrible problem with normal parallax display and I don't know what the problem is.

(OpenGL 2.0, C ++, WinXP)

My results: alt text

alt text

(green are normals, blue are tangents, and red are binormals (bitants))

Normal mapping works fine, so I think tangent vectors are good. It is strange that on some walls of the cube, parallax mapping is performed correctly, while in others it is not. I am sure my GLSL code is ok, because I copied it from http://www.dhpoware.com/demos/index.html where you can find a working parallax normal map demo that also works on my computer.

I also tried 2 ways to calculate tangential vectors, so this should not be a problem. I tried switching from DisplayList to VBO, and vice versa, it gave the same results, so the tangents were probably correctly transmitted (I even tried to pass it as gl_Color).

The height map loads correctly, I tried to install it as a diffuse map, and it looked fine.

glGetError () gives me No Errors and shader compilation files say so.

Of course, I checked the texture coordinates more than nine thousand times.

mystery ... I don’t even know that from code analysis, do you have any suggestions?

+2
source share
1 answer

Next wild guess

I would put either on the problem of the tangent basis (vectors), or on the representation vector, which is transformed / considered in the wrong coordinate space.

Without additional information, it’s hard for me to say more ...

Some source code or animation problems will be helpful.

+1
source

Source: https://habr.com/ru/post/1336359/


All Articles