Jump to content
  • Advertisement
Sign in to follow this  
reaper93

Calculating normals....

This topic is 3438 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I currently have a set of 4 height maps (I can generate the normal maps for these heightmaps if need be). I am scrolling these height maps by a function of time and space. The result of each sample is added together and then the final value is used as an offset for the Y coord's of a radial plane. (I am doing this in the VS using Vertex Texturing and passing in offset values for sampling each channel of a texture) What I need is to come up with a reasonable way to get the normals into the pixel shader, I can get the 4 normal maps for each individual height map, however as I am adding all 4 offsets together I imagine the new normal will have to be calculated based on the surronding geometry(which is not realistic to do every frame on the GPU)? Is there anything I can do with the normal maps to get the normal of my offset value? I suppose if I just use one heightmap I wont have this problem, but the random/natural motion that these multiple heightmaps provide is something I would like to keep. Any suggestions appreciated.

Share this post


Link to post
Share on other sites
Advertisement

I'm not sure what you mean by "Y coord's of a radial plane", but it may be an option for you to calculate the normals in a pixel shader, which should typically be a lot faster than on the CPU. I did something similar with 4 'height maps' when rendering clouds over in this old topic.

The last reply contains the HLSL shader I used on the combined heightmap to generate the normal map. This combined height map is also generated each frame in a pixel shader by rendering my 4 height maps to a surface with some appropriate offsets, with quite good performance results.

Hope this helps :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!