POV-Ray : Newsgroups : povray.advanced-users : Pattern showing *change* in slope : Re: Pattern showing *change* in slope Server Time
1 Jul 2024 05:49:00 EDT (-0400)
  Re: Pattern showing *change* in slope  
From: SharkD
Date: 28 Aug 2009 09:39:53
Message: <4a97de29$1@news.povray.org>
clipka wrote:
> 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.

I'll give it a shot, thanks.

-Mike


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.