Skip to main content
GameDev.net gamedev.net
🔒 Locked 🎮 Unity

Terrain Normal Mapping

Started by James_67 Mar 26, 2010 at 2:22 PM 3 replies 2.2k views
Original Post
James_67
James_67
I am about trying to make normalmapped heightmap terrain.Is it just enough to pass "Terrain's world transform" to the shader for tangent space calculations in it?
solenoidz
solenoidz
If your terrain do not rotate I believe you do not need tangent space, tangents and binormals to normal-map your terrain. Normals would be in object/world space, so keep your light in that space and you are good.
James_67
James_67
you are suggesting a world space normalmap approach.fast but less preferable. so ı already calculated vertex normals successfuly. now which steps should i follow when you said keep your light in this space. the light already in worldspace. ı already have vertex normals and then ?
solenoidz
solenoidz
Calculate the dot between the light direction and the normal in the vertex shader and pass that float to the pixel shader. In pixel shader, sample your bump-map texture sampler extract a normal from it, add it to the "float dot" passed from the vertex shader and use that "float dot" for your final color calculation of the pixel. That works for "detail normal mapping" with conjunction with vertex normals being present and used to calculate the "overall" lighting.
That is simply one of the ways of doing it.
For example for normal maps in object space as those exported from L3DT for example, you don't need vertex normals i think.
James_67
James_67
i will give it a try. thanks for your clear explanation. just rated you!.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.