[Terrain] Shared normals and shadows

Started by
11 comments, last by kauna 12 years, 8 months ago

1) In this case the tangent space and the world space are the same for your triangles, so you don't need to worry about the tangent space or calculating tangents etc. Just read the normals from the texture and use them for lighting as if they were normals in world space.

2) having the TBN matrix for a vertex and using tangent space normal map won't produce the lighting anomaly you described in the first post.

Cheers!


I've deleted the post before you replied, weird stuff going on, anyway thanks for reply. Deleted it because I've found few more pages about tangent space, decided to read them on before asking again for help.

Back on the topic: If I use them just as a normals, I need to swap y and z coordinates of the normal vectors sampled from the map, (and negate the z coordinate) to have it work properly. Is it the issue with handiness of the system the program uses, or me?

EDIT: Current result (I don't really mind the transition areas, that's probably the normal map itself)
Advertisement

Back on the topic: If I use them just as a normals, I need to swap y and z coordinates of the normal vectors sampled from the map, (and negate the z coordinate) to have it work properly. Is it the issue with handiness of the system the program uses, or me?



Yes, it seems that the normal map created by the software use a different kind of handiness. Do you have any options when saving about the handiness?

Eventually, if you want to make your height map editable, you'll need to calculate the normal map by yourself, but maybe that's not something to worry about at this moment.

Cheers!


I've got the code for the height map, but without all the tangent stuff - I thought of just saving the shared normals I had in the start to a bmp file and put it as normal texture to the pixel shader, I was quite close to finish it, simply found the soft before finishing the export code.

Thanks for your help.

I've got the code for the height map, but without all the tangent stuff - I thought of just saving the shared normals I had in the start to a bmp file and put it as normal texture to the pixel shader, I was quite close to finish it, simply found the soft before finishing the export code.

Thanks for your help.


As long as you just use the normal map for the world space terrain normals, you don't need to worry about tangents or bitangents.

As a matter of fact, if you are able to calculate the terrain normals in your code, you may as well store the same data in a texture. You'll just need a code to fit the normal in the texture format and a shader code to unpack it (something that you probably do already with the normal map you got).

Good luck!

This topic is closed to new replies.

Advertisement