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
Surface Curvature Shader
5563 1 1- AndrewJBeard
- Member
- 50 posts
- Joined: 8月 2009
- Offline
- tjeeds
- Member
- 339 posts
- Joined: 8月 2007
- Offline
-
- Quick Links