Surface Curvature Shader

   5563   1   1
User Avatar
Member
50 posts
Joined: 8月 2009
Offline
I'm trying to use derivatives in SHOPs to make a simple curvature shader, i.e. vary the surface color by the ‘sharpness’ of the surface curvature at that point.

I'd like to do this in world position space, so I figure I need to calculate dN/dP. Using the chain rule I've expanded to dN/dP = dN/ds . ds/dP which implies that I simply take the derivative of the surface normal and divide by dPds (and the same with dPdt.).

However this doesn't seem to create sensible results; dividing by dPds often results in colors way out of gamut (such that MPlay treats it as #.INF).

Does anyone have any suggestions as to how I might calculate surface curvature in world space in SHOPs?

Thanks,

Andrew
User Avatar
Member
339 posts
Joined: 8月 2007
Offline
Have you had a look at the Shading Derivative vop? Not sure if it's what you're after but you can transform N into world space and plug it in to get something like curvature.

Attachments:
curvature_shader01.hip (144.2 KB)

Jesse Erickson
Fx Animator
WDAS
  • Quick Links