POV-Ray : Newsgroups : povray.general : df3 question : Re: df3 question Server Time
29 Apr 2024 02:16:01 EDT (-0400)
  Re: df3 question  
From: Stephen
Date: 12 Sep 2017 13:33:03
Message: <59b81a4f@news.povray.org>
On 12/09/2017 16:51, William F Pokorny wrote:

> 
> As Christoph and Alain indicate/hint, you can create/encode a df3 file 
> with color information provided you decode it appropriately in the SDL.
> 

I am always impressed and humbled when I see code like you posted below.

I fear that I have muddied the waters in this thread. There are actually 
two topics involved. I have gone seamlessly from one to the other.

I am satisfied that my presumption that df3's could hold colour 
information is wrong. This was what the original post was about. I was 
trying to help someone who is writing a utility for df3s.
We both want to extract the information from complex objects without 
knowing what the pigment is. In my case it was from meshes generally 
created in Poser. So at this point I digressed to how I create them. 
Which is taking small slices of cross sections and letting PovRay doing 
the work of working out the colour. Then using a camera with a filter to 
separate the colour channels into Red, Green and Blue images. Which 
tga2df3 created three df3s. This is quite laborious and time consuming.

I wholly agree with you that density and colour should be kept separate.
Coincidently I read the link you posted below. It is well done and very 
informative btw. :)

This thread has certainly cleared up a few things about df3s for me and 
opened up a new direction for me to explore. :-)

Thanks to all.


> With the warning I ran only a quick sanity test or two, the following is 
> an example using a df3 for an object's pigment - applied in the usual 
> density_file unit cube - and requiring the new 3.8 (formally 3.7.1) 
> pigment {user_defined {}} capability:
> 
> //---
> #declare FnDF3val = function {
>      pattern { density_file df3 "spiral.df3" interpolate 0 }
> }
> 
> #declare DF3BitDepth = 8;
> #declare DF3Depth    = pow(2,DF3BitDepth);
> #declare BaseModVal  = int(DF3Depth/4)-1;
> 
> #declare PigByDF3 = pigment {
>    user_defined {
>      function { mod(FnDF3val(x,y,z)*DF3Depth/(BaseModVal*3),BaseModVal) }
>      function { mod(FnDF3val(x,y,z)*DF3Depth/(BaseModVal*2),BaseModVal) }
>      function { mod(FnDF3val(x,y,z)*DF3Depth/(BaseModVal*1),BaseModVal) }
>      function { 0 },
>      function { 0 }
>    //function { mod(FnDF3val(x,y,z)*DF3Depth              
,BaseModVal) }
>    }
> }
> //---
> 
> While we can create colors from grayscale/value encoded df3s as done 
> with the shipped spiral.df3 above, what I've found in practice is the 
> 'density' and color is often best handled separately or as distinct 
> color-density channels - if you really want control. Similary true with 
> isosurface base shape functions being generated apart from the, related, 
> pattern-functions controlling the pigments/textures applied to the 
> isosurface.
> 
> Note the interpolate 0 on the density_file for no interpolation. 
> Interpolations 1 or 2 would distort(1) any encoded color information as 
> the interpolation happens internally in grayscale/single-value space.
> 
> Additional caveats with respect to df3 interpolation vs not and 
> density_file interpolation noise in general can be found as part of 
> documentation at:
> 
> http://wiki.povray.org/content/User:Wfpokorny/DensityFile
> 
> Bill P.


-- 

Regards
     Stephen


Post a reply to this message

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