POV-Ray : Newsgroups : povray.newusers : isosurface rendering of volume data Server Time
1 Nov 2024 10:17:17 EDT (-0400)
  isosurface rendering of volume data (Message 1 to 8 of 8)  
From: sanjay
Subject: isosurface rendering of volume data
Date: 29 Jun 2009 07:40:01
Message: <web.4a48a7cb766b3115b8711ff20@news.povray.org>
I have a stack of binary images i.e each image is a 2D array and all such images
combined to give a 3D array.
I had previously used MATLAB's isosurface,isocaps and patch functions to
get the visualisation of the volume data, but its too slow.
Is there a way by which I can import such a 3D volume data from matlab to POV
ray and then extract the isosurfaces from that data and render it ?


Post a reply to this message

From: Alain
Subject: Re: isosurface rendering of volume data
Date: 29 Jun 2009 15:22:16
Message: <4a491468$1@news.povray.org>

> I have a stack of binary images i.e each image is a 2D array and all such images
> combined to give a 3D array.
> I had previously used MATLAB's isosurface,isocaps and patch functions to
> get the visualisation of the volume data, but its too slow.
> Is there a way by which I can import such a 3D volume data from matlab to POV
> ray and then extract the isosurfaces from that data and render it ?
> 
> 
Convert those image into the TGA format and use a tga to 3df combiner to 
combine them in a single 3FD file.

That file can then be used to generate an isosurface or as a density 
pattern for a media.

Alain


Post a reply to this message

From: sanjay
Subject: Re: isosurface rendering of volume data
Date: 30 Jun 2009 03:40:01
Message: <web.4a49c075fbeb1364b8711ff20@news.povray.org>
Alain <aze### [at] qwertyorg> wrote:

> > I have a stack of binary images i.e each image is a 2D array and all such images
> > combined to give a 3D array.
> > I had previously used MATLAB's isosurface,isocaps and patch functions to
> > get the visualisation of the volume data, but its too slow.
> > Is there a way by which I can import such a 3D volume data from matlab to POV
> > ray and then extract the isosurfaces from that data and render it ?
> >
> >
> Convert those image into the TGA format and use a tga to 3df combiner to
> combine them in a single 3FD file.
>
> That file can then be used to generate an isosurface or as a density
> pattern for a media.
>
> Alain

Thanks Alain ..

I converted my images into tga format but I'm unable to combine them into a 3fd
file, searched the net a lot on this;

Can you please help


Post a reply to this message

From: Bill Pragnell
Subject: Re: isosurface rendering of volume data
Date: 30 Jun 2009 04:15:01
Message: <web.4a49c88ffbeb13646dd25f0b0@news.povray.org>
"sanjay" <san### [at] gmailcom> wrote:
> Alain <aze### [at] qwertyorg> wrote:
> > Convert those image into the TGA format and use a tga to 3df combiner to
> > combine them in a single 3FD file.
> >
> I converted my images into tga format but I'm unable to combine them into a 3fd
> file, searched the net a lot on this;

It's a bit old, but should work:

http://www.users.on.net/~pod/df3/

Bill


Post a reply to this message

From: sanjay
Subject: Re: isosurface rendering of volume data
Date: 30 Jun 2009 10:20:01
Message: <web.4a4a1eabfbeb1364b8711ff20@news.povray.org>
Alain <aze### [at] qwertyorg> wrote:

> > I have a stack of binary images i.e each image is a 2D array and all such images
> > combined to give a 3D array.
> > I had previously used MATLAB's isosurface,isocaps and patch functions to
> > get the visualisation of the volume data, but its too slow.
> > Is there a way by which I can import such a 3D volume data from matlab to POV
> > ray and then extract the isosurfaces from that data and render it ?
> >
> >
> Convert those image into the TGA format and use a tga to 3df combiner to
> combine them in a single 3FD file.
>
> That file can then be used to generate an isosurface or as a density
> pattern for a media.
>
> Alain

I combined all my tga images into a .df3 file format
then i m doing this

#declare DENSFUNC=function
{
    pattern
    {
        density_file df3 "imoil.df3"
        interpolate 3
    }
}
isosurface {function { .2 - DENSFUNC(x,y,z) } }

but just a blank screen is rendered.
is my coding incorrect or do I need to alter the cam/light/threshold values ?


Post a reply to this message

From: Alain
Subject: Re: isosurface rendering of volume data
Date: 30 Jun 2009 10:58:56
Message: <4a4a2830@news.povray.org>

> Alain <aze### [at] qwertyorg> wrote:

>>> I have a stack of binary images i.e each image is a 2D array and all such images
>>> combined to give a 3D array.
>>> I had previously used MATLAB's isosurface,isocaps and patch functions to
>>> get the visualisation of the volume data, but its too slow.
>>> Is there a way by which I can import such a 3D volume data from matlab to POV
>>> ray and then extract the isosurfaces from that data and render it ?
>>>
>>>
>> Convert those image into the TGA format and use a tga to 3df combiner to
>> combine them in a single 3FD file.
>>
>> That file can then be used to generate an isosurface or as a density
>> pattern for a media.
>>
>> Alain
> 
> I combined all my tga images into a .df3 file format
> then i m doing this
> 
> #declare DENSFUNC=function
> {
>     pattern
>     {
>         density_file df3 "imoil.df3"
>         interpolate 3
>     }
> }
> isosurface {function { .2 - DENSFUNC(x,y,z) } }
> 
> but just a blank screen is rendered.
> is my coding incorrect or do I need to alter the cam/light/threshold values ?
> 
> 
> 

Your isosurface need some pigment otherwise, it use the default one that 
is black.
Sample texture for the isosurface (add between the "} }":

texture{pigment{rgb<1,1,1>}finish{specular 0.5 roughness 0.001}}
//A simple shiny white texture.

You also need a light_source.
Sample light_source:

light_source{<0.9,0.7,-10> rgb<1,1,1>}

If you don't define a camera, the default one is at the origin and look 
toward +z. You can create a camera or translate the isosurface in front 
of the camera.
Sample camera looking at the center of the untransformed isosurface:

camera{location<0,0,-2> look_at<0.5,0.5,0.5>}

You may need to translate and scale the isosurface as the function is 
deffined in a cube going from <0,0,0> to <1,1,1>. Deffining the 
container as:
box{0,1}
can improve the rendering speed as you don't sample undeffined regions.
Add after the function and before the texture:

contained_by{box{0,1}}

interpolate 3 is NOT valid. The only valid values are 0, 2 and 4.
interpolate 0 is no interpolation. It gives a blocky aspect and causes 
the max_gradient to be extremely large.
interpolate 2 is bi-linear interpolation. Nice smooth shape. 
max_gradient down to a reasonable range. You should use that value most 
of the time.
interpolate 4 is bicubic interpolation and is buggy. Used properly, it 
gives the best results. Will gives horible result if there are abrupt 
changes to zero or the maximum value.
A value other than 2 or 4 is interpreted as 0.

If you want to use interpolate 4, you need to make sure that the values 
of the DF3 never reatch the extreeme values. Low values should be 1s or 
2s. High values should be 253s or 254s (if using 1 byte per voxel).

Do a test render and look at the report for a mention about the 
max_gradient. Add: max_gradient [a little less than the value reported] 
after the function. (if the value found is 1250, a value of 1200 should 
be acceptable)
Do another render.


Alain


Post a reply to this message

From: Mike Williams
Subject: Re: isosurface rendering of volume data
Date: 30 Jun 2009 19:13:01
Message: <MQw1CADMvpSKFwzV@econym.demon.co.uk>
Wasn't it sanjay who wrote:
>Alain <aze### [at] qwertyorg> wrote:

>> > I have a stack of binary images i.e each image is a 2D array and
>> >all such images
>> > combined to give a 3D array.
>> > I had previously used MATLAB's isosurface,isocaps and patch functions to
>> > get the visualisation of the volume data, but its too slow.
>> > Is there a way by which I can import such a 3D volume data from
>> >matlab to POV
>> > ray and then extract the isosurfaces from that data and render it ?
>> >
>> >
>> Convert those image into the TGA format and use a tga to 3df combiner to
>> combine them in a single 3FD file.
>>
>> That file can then be used to generate an isosurface or as a density
>> pattern for a media.
>>
>> Alain
>
>I combined all my tga images into a .df3 file format
>then i m doing this
>
>#declare DENSFUNC=function
>{
>    pattern
>    {
>        density_file df3 "imoil.df3"
>        interpolate 3
>    }
>}
>isosurface {function { .2 - DENSFUNC(x,y,z) } }
>
>but just a blank screen is rendered.
>is my coding incorrect or do I need to alter the cam/light/threshold values ?

You may well need a higher max_gradient than the default value. Check
your messages pane to see if there's a warning to that effect.

Applying a pigment to your isosurface would help. By default it's black
on a black background.

Adding a light source to your scene would help. By default anything with
zero ambient looks black if it's unlit.

Adding a camera to your scene would help. By default the camera is
placed at <0,0,0> (which might possibly be just inside your object)
looking in the z direction.

Adding a contained_by won't improve the view, but might improve the
speed. The df3 exists in the positive octant of the unit sphere

Try this (adjusting max_gradient if you still get warnings):


camera { location  <1, 0.5, -5> look_at <0.5, 0.5, 0.5> angle 14}

light_source {<-100,200,-100> colour rgb 1}

#declare DENSFUNC=function
{
    pattern
    {
        density_file df3 "imoil.df3"
        interpolate 3
    }

isosurface {
  function { .2 - DENSFUNC(x,y,z) }
  max_gradient 50
  contained_by{box{-0.01,1.01}}
  pigment {rgb 1}
}


-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: sanjay
Subject: Re: isosurface rendering of volume data
Date: 2 Jul 2009 02:35:00
Message: <web.4a4c54eafbeb1364b8711ff20@news.povray.org>
hey thanks a lot. it works now.
am trying to extract the necessary information from my volume data now.
i really appreciate the help.


Post a reply to this message

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