POV-Ray : Newsgroups : povray.newusers : how to make a 2D image from 3D image : Re: how to make a 2D image from 3D image Server Time
28 Jul 2024 16:25:01 EDT (-0400)
  Re: how to make a 2D image from 3D image  
From: Chris B
Date: 12 Jun 2008 12:21:01
Message: <48514ced$1@news.povray.org>
"vinhphunguyen" <nvi### [at] gmailcom> wrote in message 
news:web.48513efe78241c82b979a58c0@news.povray.org...
> Dear all,
>
> I would like to generate images like the ones in the right column at this 
> link
> http://www.micthemodel.org/pages/examples.html (Sorry but I can not post
> attachment).
>
> These images are in fact 2D slices of a 3D image that is a cube containing 
> a set
> of layered spheres. A layered sphere is a set of concentric spheres of 
> different
> colors. In my program (in fact, this is the visualisation of cement 
> hydration
> simulation), I have the coordinate and radius of the spheres and the color 
> as
> well.
>
> ...
>
> With this one, I did see the spheres but just one color CYAN.
>

I think you need to do a couple of things.

Firstly, when you slice through, use the 'difference' CSG operation with the 
'cutaway_textures' keyword, so that the slices through the objects retain 
their original textures.

Secondly you need to difference the second largest sphere from the largest, 
the 3rd largest from the second largest etc. Otherwise, when you slice 
through the union of concentric spheres the section through the smaller 
spheres produce concurrent surfaces with the larger spheres and most of the 
surfaces won't display the colour you want. In fact you'll only get the 
colour you want displaying properly for the outermost object.

Here's a simplified example:

camera {location <0,0,-1> look_at 0}
light_source {   <0,0 ,-100>, rgb 1}

#declare MySpheres = union{
  difference {
    sphere{<0,0,0>, 0.3 pigment {color rgb <1,0,0>}}
    sphere{<0,0,0>, 0.2 pigment {color rgb <0,1,0>}}
  }
  difference {
    sphere{<0,0,0>, 0.2 pigment {color rgb <0,1,0>}}
    sphere{<0,0,0>, 0.1 pigment {color rgb <0,0,1>}}
  }
  sphere{<0,0,0>, 0.1 pigment {color rgb <0,0,1>}}
}

difference {
  object {MySpheres}
  plane {z,0}
  cutaway_textures
}

Regards,
Chris B.


Post a reply to this message

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