|
![](/i/fill.gif) |
SharkD schrieb:
> How can I create a pattern that shows the *change* in slope of a
> heightfield. I.e., brighter where the "curvature" is greater.
You can create this from the image you use for the height field
To begin with, make a pigment from the image; make from that a function F.
Now, create a function G computing the curvature from five function
values from F, spaced apart by (at least) 1/BITMAP_SIZE, to compute the
"difference in difference" both vertically and horizontally:
#declare D = 1/BITMAP_SIZE; // insert actual size of your bitmap here
#declare Sqr = function(x) { x*x }
#declare G = function(x,y,z) {
sqrt(
Sqr( F(x-D,y,z) + F(x+D,y,z) - 2*F(x,y,z) ) // squared curvature X
Sqr( F(x,y-D,z) + F(x,y-D,z) - 2*F(x,y,z) ) // squared curvature Y
)
}
finally, apply this function as a pattern to your height field.
Post a reply to this message
|
![](/i/fill.gif) |