POV-Ray : Newsgroups : povray.advanced-users : DF3 density file generation for a generic 3D object ? : Re: DF3 density file generation for a generic 3D object ? Server Time
8 Jul 2024 18:57:26 EDT (-0400)
  Re: DF3 density file generation for a generic 3D object ?  
From: Alain
Date: 1 Oct 2007 15:36:59
Message: <47014c5b$1@news.povray.org>
Antonio Ferrari nous apporta ses lumieres en ce 2007/10/01 11:06:

Normaly, you use some external application to generate the DF3 file.

> Prerequisites:
> 
> 1) Having a generic closed object O;
> 2) Being able to apply inside(O,V) operator for a generic vector V
> 3) Being able to write DF3 files using povray language, maybe applying the
> patch "Extended Density File"
You will have problem writing any non-ASCII characters to the file, POV-Ray only 
write text files (ASCII encoded) and image files.
> 
> What I'm looking for:
> 
> I'm looking for a macro for generating a DF3 file in output for the interior
> of the object O passed to the macro. I'd like that the density is a function
> of the minimal distance of V from the external surface of O: for V internal,
> density[V] = density_function(minimal_distance(O,V)). In particular I'd like
> a function the make the density greater when moving toward the interior of
> O, where the increment could be linear, exponential, logarithmic, etc.
> 
> Is there a function for calculating the minimal distance of an internal
> point V from the contour of O?
User deffined function.
> 
> Have you any idea?
> 
> Do you think that only a patch could give me the expected result?
> 
> Some time ago I had the following idea: calculating the dimensions X, Y and
> Z of the box containing O. Subdivide both X, Y and Z into n segments. Use
> of 3 innested loops for x, y and z axis in order to cycle the segments and
> see if the are or are not part of the interior of O. This is a sort of
> sampling method. The greater n is, the more accurate the samples are.
> 
> Then I needed an algorithm for finding interior points at first level,
> second level, third level, etc. The greater the level, the higher the
> density, for example.
> 
> Oh these are just ideas. I don't know if I'm on the right way.
> 
> Bye,
> A.
> 
> 
Aparently, you already have a function to eveluate the density. Taking that in 
acount, it would be easier, and probably faster, to directly use that function 
as density for a media.
interior{media{emission 1 density Your_Function}}
To increase the quality, you increase the samples value (default of 3). Don't 
touch to intervals, inefficient and very slow.

-- 
Alain
-------------------------------------------------
Just remember - if the world didn't suck, we would all fall off.


Post a reply to this message

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