POV-Ray : Newsgroups : povray.binaries.images : A method creat uniform thick shell : Re: A method creat uniform thick shell Server Time
6 May 2024 04:15:50 EDT (-0400)
  Re: A method creat uniform thick shell  
From: And
Date: 27 Oct 2013 06:25:00
Message: <web.526ce92ddce0719a84f168e50@news.povray.org>
Christian Froeschlin <chr### [at] chrfrde> wrote:
> Very good technique!
>
> The presentation of it was maybe a bit hard to follow.
>
> To summarize:
>
> 1. If you have geometry described by a function (as used by
> an isosurface object), you can can render its boundary using
> a constant thickness (as opposed to the entire solid object).
>
> 2. The technique is to difference two isosurface objects for
> the same function using a slightly different threshold.
>
> 3. In order to achieve constant thickness the function needs to
> be normalized by dividing through the length of its gradient.
>
>
> In your examples, you used simple functions for which the
> derivative could be calculated analytically. Maybe this could
> also be done by a general macro that uses a gradient of
>
> sqrt(((f(x+e,y,z)-f(x,y,z))/e)^2+
>       ((f(x,y+e,z)-f(x,y,z))/e)^2+
>       ((f(x,y,z+e)-f(x,y,z))/e)^2)
>
> for some small value of e?

Thank you.
Your summary is so good!!

And I've tried with an approximate derivative, it works.
#declare f_sin=function(var1,var2,k){
var2-sin(k*var1)
}

#declare f_sin_normalized=function(var1,var2,k,e){
f_sin(var1,var2,k)
/sqrt(
pow((f_sin(var1+e,var2,k)-f_sin(var1,var2,k))/e,2)
+pow((f_sin(var1,var2+e,k)-f_sin(var1,var2,k))/e,2)
)
}


I invoke function in isosurface with e=0.001
it took twice time to render, but it's OK because the image is identical.
I may write it by a macro then try some other function.


Post a reply to this message

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