POV-Ray : Newsgroups : povray.binaries.images : Experimenting with 3.7 cubic warp and df3 based isosurfaces. : Re: Experimenting with 3.7 cubic warp and df3 based isosurfaces. Server Time
6 Nov 2024 22:13:14 EST (-0500)
  Re: Experimenting with 3.7 cubic warp and df3 based isosurfaces.  
From: William F Pokorny
Date: 21 Dec 2017 11:01:15
Message: <5a3bdacb$1@news.povray.org>
On 12/20/2017 12:37 PM, Bald Eagle wrote:
> William F Pokorny <ano### [at] anonymousorg> wrote:
>> Back in 3.7 Warp added warp{cubic} for patterns. Helpful in that df3
>> density_file patterns so warped can be much flatter (smaller in size)
>> and still result in deeper shapes/medias. Similar to other built in
>> warps, one needs to offset in +z - after x, y and z normalization(1) -
>> by the half width you want for the box centered on the origin.
>>
>> Yep, the isosurface max_gradient for the attached image should have been
>> set higher.
>>
>> Bill P.
>>
>> (1) - As with 2d images and image maps, 3d df3s - no matter their input
>> dimensions - always fill the unit cube. Before warping one must do a
>> normalization scale to get the thinner, as intended, 'shape' which is
>> then offset in +z for size ahead of the warp{cubic}.
> 
> I guess that your description and the posted result are a bit too brief for me
> to fill in the blanks.
> The docs suggest that the pattern ought to be in the cruciform shape as depicted
> here:
> http://wiki.povray.org/content/File:RefImgBoxmap.gif
> 
> Is that closely related to what you're doing?
> 

You've got it. That is exactly what I'm doing, but where that sort of 
image has been translated into a plane of a df3 density file.

Everything I'm currently doing requires a recent 3.8 pre-release. Plus 
I'm using my density file interpolation patch & padding null values 
about the ones I want too to avoid other nitpick issues documented at:

      http://wiki.povray.org/content/User:Wfpokorny/DensityFile

That said, though a little more difficult, you can do what I've done in 
3.7 too limited to interpolations 1 (tri-linear) & 2 (tri-cuic). I'd 
personally favor 1 due the ringing that is alway present with tri-cubic. 
Interpolations 1 & 2 also work better with density_file values around 
0.5 for isosurfaces over the 1.0 I used with my interpolations.

The essential bit of code for the df3, warp{cubic} and the isosurface is:

#declare DF3The = density { density_file df3 "the.df3" interpolate 0 }
#declare Df3Range = max_extent(DF3The);
#declare NrmScale =
    <min(1,Df3Range.x/max(Df3Range.y,Df3Range.z)),
     min(1,Df3Range.y/max(Df3Range.x,Df3Range.z)),
     min(1,Df3Range.z/max(Df3Range.x,Df3Range.y))>;
#declare FnctTheDF3 = function {
     pattern{density_file df3 "the.df3" interpolate 3 // 1 if no patch
     translate -0.5
     scale 1+(10/800)               // lose df3 side buffer padding.
     translate 0.5
     scale NrmScale*<0,0,3>+<1,1,0> // to thin plane, z 3x thicken
     translate <0,0,0.5>            // Set box width to 1.0.
     warp{cubic}                    // Wrap pattern around origin.
     warp{turbulence 0.04 octaves 5 omega 0.4 lambda 5} }
}
#declare Fn00 = function (x,y,z) { 0.025-(FnctTheDF3(x,y,z)) }
#declare CrabApple = srgb <0.61569,0.14118,0.05882>;
#declare Iso99 = isosurface {
     function { Fn00(x,y,z) }
     contained_by { box { <-0.6,-0.6,-0.6>,<0.6,0.6,0.6> } }
     threshold 0
     accuracy 0.0005
     max_gradient 333.3
     pigment { color CrabApple }
}

A while ago I created a couple user_defined cubic map cameras which look 
orthographically inward at a unit box centered on the origin. I'll 
attach the version I used to create an alpha channel template. It's 
likely of general use and fairly small. The final composite image for 
the df3 was, in this case, created in gimp.

Bill P.


Post a reply to this message


Attachments:
Download 'utf-8' (11 KB)

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