Sign in to follow this  
reaper93

Calculating normals....

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this