POV-Ray : Newsgroups : povray.binaries.scene-files : How to render 3d smoke using exisiting particle data Server Time
19 Apr 2024 15:44:50 EDT (-0400)
   How to render 3d smoke using exisiting particle data (Message 1 to 8 of 8)  
From: Ray
Subject: How to render 3d smoke using exisiting particle data
Date: 16 Apr 2013 04:50:01
Message: <web.516d1029e6ae6c84c2a18ad0@news.povray.org>
Dear all,

I want to render a nice 3d smoke figure on to my screen using the measured
experimental data (which is a 3d array of smoke density values in different
position and different time). I have checked Rune's particle system and learned
the particle system of pov-ray might be the way to obtain my goal.

It may be an easier job compared to Rune's work, because there is no need to
calculate new positions and velocities of particles. In Rune's work, when the
rendering completed, there was a particle data file generated. And my question
is how to render a 3d picture using the existing particle data?


simple example or give me a direction in this.

Best regards,

Ray


Post a reply to this message

From: Alain
Subject: Re: How to render 3d smoke using exisiting particle data
Date: 16 Apr 2013 16:52:30
Message: <516dba0e$1@news.povray.org>

> Dear all,
>
> I want to render a nice 3d smoke figure on to my screen using the measured
> experimental data (which is a 3d array of smoke density values in different
> position and different time). I have checked Rune's particle system and learned
> the particle system of pov-ray might be the way to obtain my goal.
>
> It may be an easier job compared to Rune's work, because there is no need to
> calculate new positions and velocities of particles. In Rune's work, when the
> rendering completed, there was a particle data file generated. And my question
> is how to render a 3d picture using the existing particle data?
>

> simple example or give me a direction in this.
>
> Best regards,
>
> Ray
>
>

You may not need to use particles. Have you tried using media?
If your smoke density data is composed of integers encoded as 1, 2 or 3 
bytes integers, it could be trivial to convert it into a .DF3 file and 
use it directly to controll the media density. Just remove the header 
and replace it by the X, Y and Z dimentions. It's also possible to read 
the data and output the DF3 file from POV-Ray.

Next, make a relatively tight container, a box, sphere or cylinder as 
appropriate, add hollow and a media block.


Post a reply to this message

From: Ray
Subject: Re: How to render 3d smoke using exisiting particle data
Date: 19 Apr 2013 05:45:01
Message: <web.5171108b98296338379ee910@news.povray.org>
Alain <kua### [at] videotronca> wrote:

> You may not need to use particles. Have you tried using media?
> If your smoke density data is composed of integers encoded as 1, 2 or 3
> bytes integers, it could be trivial to convert it into a .DF3 file and
> use it directly to controll the media density. Just remove the header
> and replace it by the X, Y and Z dimentions. It's also possible to read
> the data and output the DF3 file from POV-Ray.
>
> Next, make a relatively tight container, a box, sphere or cylinder as
> appropriate, add hollow and a media block.

Dear Alain,

Thanks a lot! Your suggestion gave me the direction to obtain my 3D image.

But, after googled around, I still have no idea how to convert my 3D matrices
data into a .DF3 file. Could you please give me some more details or examples
for that?

My data are organized as a three-dimension matrix in MatLab, with the first
dimension being x, second dimension y, and third dimension z. The grid size on
all three dimensions is the same. A non-zero value means the existence of smoke
at the corresponding spatial location and a larger value means more intense
smoke.

A data format example: a(:,:,1)=[0.11 0.21 0; 0.22 0.31 0; 0.61 0
0];a(:,:,2)=[0.27 0 0; 0.31 0.42 0; 0.55 0 0];a(:,:,3)=[0.18 0 0.19; 0 0.72 0;
0.21 0.38 0]

I'd really appreciate your kind help.

Ray


Post a reply to this message

From: Stephen
Subject: Re: How to render 3d smoke using exisiting particle data
Date: 19 Apr 2013 06:26:05
Message: <51711bbd$1@news.povray.org>
On 19/04/2013 10:41 AM, Ray wrote:
> But, after googled around, I still have no idea how to convert my 3D matrices
> data into a .DF3 file. Could you please give me some more details or examples
> for that?

Does this help? (From the 3.7 Help File)

3.4.7.1.8.1 df3 file format

Header:
The df3 format consists of a 6 byte header of three 16-bit integers with 
high order byte first. These three values give the x,y,z size of the 
data in pixels (or more appropriately called voxels ).

Data:
The header is followed by x*y*z unsigned integer bytes of data with a 
resolution of 8, 16 or 32 bit. The data are written with high order byte 
first (big-endian). The resolution of the data is determined by the size 
of the df3-file. That is, if the file is twice (minus header, of course) 
as long as an 8 bit file then it is assumed to contain 16 bit ints and 
if it is four times as long 32 bit ints.

Again from the help files

3.3.2.3.4 The write Directive

Note: See the sample macro ARRAYS_WriteDF3 in arrays.inc to see how this 
feature may be used.


Also somewhere on the net there is a utility called tga2df3.exe will 
convert a tga file to df3.


-- 
Regards
     Stephen


Post a reply to this message

From: Ray
Subject: Re: How to render 3d smoke using exisiting particle data
Date: 25 Apr 2013 23:55:01
Message: <web.5179fa33982963345d4cf1e0@news.povray.org>
Stephen <mca### [at] aolcom> wrote:
> On 19/04/2013 10:41 AM, Ray wrote:
>
> Also somewhere on the net there is a utility called tga2df3.exe will
> convert a tga file to df3.
>
I have done this: I extracted each slice of data from the 3D matrix (that is
each slice is a 2D array and all such slices combined to give a 3D matrix). Then
I output each slice of data as a gray level picture and converted all of those
images into TGA format. Next, I combined all my tga images into a .df3 file
format and rendered it with following code:

global_settings { assumed_gamma 1 }
background { rgb 1 }
camera {direction z*8 location <0,0,-10>}
light_source { <20,40,10>, 1 }

sphere // transparent sphere containing media
{ 0,1 pigment { rgbt 1 } hollow
interior
{ media
{ absorption 5
density
{ density_file df3 "a1.df3" interpolate 1
   color_map{ [0 rgb 0]
     [0.4 rgb <1,0,0>]
     [0.8 rgb <1,1,0>]
     [1 rgb 1]
   } }}}}

But the result showed a very strange shape. I changed the camera location, still
no smoke shape displayed. I really have no idea what's wrong with that. The TGA
image seems correct. I attached one of the TGA images and two images of result
with different camera location. Any ideas what my problem might be?
Thank you,
Ray


Post a reply to this message


Attachments:
Download 'attachment.rar.dat' (8 KB)

From: James Holsenback
Subject: Re: How to render 3d smoke using exisiting particle data
Date: 26 Apr 2013 07:32:27
Message: <517a65cb@news.povray.org>
On 04/25/2013 11:53 PM, Ray wrote:
> Stephen <mca### [at] aolcom> wrote:
>> On 19/04/2013 10:41 AM, Ray wrote:
>>
>> Also somewhere on the net there is a utility called tga2df3.exe will
>> convert a tga file to df3.
>>
> I have done this: I extracted each slice of data from the 3D matrix (that is
> each slice is a 2D array and all such slices combined to give a 3D matrix). Then
> I output each slice of data as a gray level picture and converted all of those
> images into TGA format. Next, I combined all my tga images into a .df3 file
> format and rendered it with following code:
>
> global_settings { assumed_gamma 1 }
> background { rgb 1 }
> camera {direction z*8 location <0,0,-10>}
> light_source { <20,40,10>, 1 }
>
> sphere // transparent sphere containing media
> { 0,1 pigment { rgbt 1 } hollow
> interior
> { media
> { absorption 5
> density
> { density_file df3 "a1.df3" interpolate 1
>     color_map{ [0 rgb 0]
>       [0.4 rgb <1,0,0>]
>       [0.8 rgb <1,1,0>]
>       [1 rgb 1]
>     } }}}}
>
> But the result showed a very strange shape. I changed the camera location, still
> no smoke shape displayed. I really have no idea what's wrong with that. The TGA
> image seems correct. I attached one of the TGA images and two images of result
> with different camera location. Any ideas what my problem might be?
> Thank you,
> Ray
>

I don't see light_source enabled to support media_interaction ... also 
wondering why you used absorption media. Try scattering instead. Perhaps 
background should be something other than pure white ... for a little 
contrast (make the smoke easier to see)


Post a reply to this message

From: James Holsenback
Subject: Re: How to render 3d smoke using exisiting particle data
Date: 26 Apr 2013 07:37:27
Message: <517a66f7$1@news.povray.org>
On 04/26/2013 07:32 AM, James Holsenback wrote:
> On 04/25/2013 11:53 PM, Ray wrote:
>> Stephen <mca### [at] aolcom> wrote:
>>> On 19/04/2013 10:41 AM, Ray wrote:
>>>
>>> Also somewhere on the net there is a utility called tga2df3.exe will
>>> convert a tga file to df3.
>>>
>> I have done this: I extracted each slice of data from the 3D matrix
>> (that is
>> each slice is a 2D array and all such slices combined to give a 3D
>> matrix). Then
>> I output each slice of data as a gray level picture and converted all
>> of those
>> images into TGA format. Next, I combined all my tga images into a .df3
>> file
>> format and rendered it with following code:
>>
>> global_settings { assumed_gamma 1 }
>> background { rgb 1 }
>> camera {direction z*8 location <0,0,-10>}
>> light_source { <20,40,10>, 1 }
>>
>> sphere // transparent sphere containing media
>> { 0,1 pigment { rgbt 1 } hollow
>> interior
>> { media
>> { absorption 5
>> density
>> { density_file df3 "a1.df3" interpolate 1
>>     color_map{ [0 rgb 0]
>>       [0.4 rgb <1,0,0>]
>>       [0.8 rgb <1,1,0>]
>>       [1 rgb 1]
>>     } }}}}
>>
>> But the result showed a very strange shape. I changed the camera
>> location, still
>> no smoke shape displayed. I really have no idea what's wrong with
>> that. The TGA
>> image seems correct. I attached one of the TGA images and two images
>> of result
>> with different camera location. Any ideas what my problem might be?
>> Thank you,
>> Ray
>>
>
> I don't see light_source enabled to support media_interaction ... also
> wondering why you used absorption media. Try scattering instead. Perhaps
> background should be something other than pure white ... for a little
> contrast (make the smoke easier to see)

oops ... should have checked before posting media_interaction is on by 
default


Post a reply to this message

From: Ray
Subject: Re: How to render 3d smoke using exisiting particle data
Date: 26 Apr 2013 22:10:01
Message: <web.517b32659829633d20616960@news.povray.org>
I guess there is something wrong with .df3 file. The shape in it seems not
correct. Is the process of making .df3 file incorrect? Any other ideas what my
problem might be?


Post a reply to this message

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