|
|
On 09/11/2017 09:13 PM, Alain wrote:
> Le 17-09-10 à 14:50, Stephen a écrit :
>>
>> I'm not convinced. I distinctly remember Oosawa telling me that the
>> opened df3 was not monochromatic and asking me which colour channel to
>> use. I say remember because I had an unfortunate accident with my PC
>> and lost all the data on it and my backups did not work. <insert
>> obscenity here> And when I downloaded the current version. That did
>> not happen. When I looked at a newly created df3 by tga2df3 in a hex
>> editor it was 95% nulls.
>> So I will just grumble to myself. :-(
>>
>
> Maybe it assumed that any gray level DF3 would use only a single byte
> per voxel, and wrongly concluded that more byte per voxel meant that it
> was to be interpreted as some kind of RGB DF3.
> If that's the case, in a 3 byte per voxel format, the first byte would
> be assumed to represent red, then the next green and finally blue.
> A 2 bytes (16 bits) per voxel would be encoded as 5,5,5 or 5,6,5 bit per
> channel, and a 4 bytes (32 bits) as 10,10,10 ; 10,11,10 ; 11,11,10 or
> 10,12,10 bit per channel.
>
> The DF3 is intended to be gray scale, but misinterpreted as been colour.
>
>
> Alain
As Christoph and Alain indicate/hint, you can create/encode a df3 file
with color information provided you decode it appropriately in the SDL.
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.
Post a reply to this message
|
|