Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Terrain normals from simplex noise derivatives


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Varrak   Members   -  Reputation: 100

Like
0Likes
Like

Posted 16 January 2012 - 01:57 PM

I have a procedural planetary renderer up and running, using GPU Simplex Noise (Hybrid Multi-fractal and fBm terrain). I recently implemented derivatives in my code, which seem to work on simple textured noise, but not so well on terrain - the normals are skewed significantly. I'm just wondering if anyone else out there has used derivatives to generate normals, and how they did it? I was just using the heightmap to calculate normals using finite differencing, but this gave ugly seams at terrain patch boundaries which were difficult to fix.

Here's the code I have right now to calculate the normals:

float3 realNormal = normalize( normal - tangent * dot( tangent, noise.xyz ) - binormal * dot( binormal, noise.xyz ) );

Where normal, tangent and binormal are the interpolated per-vertex values, and noise.xyz is the noise derivatives in x, y and z. I'm guessing the errors I'm seeing are related to the scale of the noise and the scale applied to noise values in elevating the terrain, but for the life of me I can't figure out how to get it right. Any help would be much appreciated Posted Image

Sponsor:

#2 Varrak   Members   -  Reputation: 100

Like
0Likes
Like

Posted 16 January 2012 - 03:55 PM

*sigh*. Turns out, the above code is right... but only if you normalize the derivative first. After hours of going around in circles, it of course turns out to be something trivial... Posted Image




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS