POV-Ray : Newsgroups : povray.newusers : Animating with CSG Server Time
25 Dec 2024 22:52:56 EST (-0500)
  Animating with CSG (Message 1 to 6 of 6)  
From: LikeNoOther
Subject: Animating with CSG
Date: 28 Jun 2007 05:35:02
Message: <web.468380c01d89b845758b6c7b0@news.povray.org>
Hi.

I have to create a program or script to cut a 3D model into layers(slices).
The layers will look similar to CT scans (X-rays).
To do this I can use two planes to cut 3D model.

I just have to do an animation and move the places upward through the model.
I understand what to do, unfortunately I don't know exactly how to do this.

There is another problem with this. I have to be able to use a 3D mesh from
either 3DS or Lightwave format. When I convert it to POV-Ray, the model is
not centered at the origin.

Can a script center the object?

The layers must start from the bottom and run to the top of the model making
vertical layers(slices).

Is there a way to determine where the lowest y value is in the mesh?
(I don't think so..)


Any help will be appreciated.


Post a reply to this message

From: Simon
Subject: Re: Animating with CSG
Date: 28 Jun 2007 10:02:16
Message: <4683bf68$1@news.povray.org>
Hi there. I'm at work so am going to haev to reply quickly for now - a full 
explanation when I got home,

firstly, for centering: have a loko at the manual for min_extent and 
max_extent - they return vectors of the opposing corners of the bounding box 
for an object - you can get a single direction using the dot notation -

#declare MyObj = <whatever>

object {MyObj
    translate (max_extent(MyObj) - min_extent(MyObj))/2
}

which should center in all 3 directions.

as to changing with time, you need to use the variable clock in your script,

This could be slightly tricky if you need to break the object into multiple 
parts - I'm afraid I'm too new to know how to do that, but I'm sure someone 
else here will be abel to help.

"LikeNoOther" <eug### [at] gmailcom> wrote in message 
news:web.468380c01d89b845758b6c7b0@news.povray.org...
>
> Hi.
>
> I have to create a program or script to cut a 3D model into 
> layers(slices).
> The layers will look similar to CT scans (X-rays).
> To do this I can use two planes to cut 3D model.
>
> I just have to do an animation and move the places upward through the 
> model.
> I understand what to do, unfortunately I don't know exactly how to do 
> this.
>
> There is another problem with this. I have to be able to use a 3D mesh 
> from
> either 3DS or Lightwave format. When I convert it to POV-Ray, the model is
> not centered at the origin.
>
> Can a script center the object?
>
> The layers must start from the bottom and run to the top of the model 
> making
> vertical layers(slices).
>
> Is there a way to determine where the lowest y value is in the mesh?
> (I don't think so..)
>
>
> Any help will be appreciated.
>
>


Post a reply to this message

From: Sherry Shaw
Subject: Re: Animating with CSG
Date: 28 Jun 2007 11:21:56
Message: <4683d214@news.povray.org>
LikeNoOther wrote:

>Hi.
>
>I have to create a program or script to cut a 3D model into layers(slices).
>The layers will look similar to CT scans (X-rays).
>To do this I can use two planes to cut 3D model.
>  
>

Or, possibly, intersect it with a box or cylinder.  If you're slicing up 
a mesh, you'll need to give it an inside_vector.

>I just have to do an animation and move the places upward through the model.
>I understand what to do, unfortunately I don't know exactly how to do this.
>  
>

Either the "clock" or "frame_number" variable could be used.  Based on 
your description, I think "frame_number" would be a lot easier to work with.

>There is another problem with this. I have to be able to use a 3D mesh from
>either 3DS or Lightwave format. When I convert it to POV-Ray, the model is
>not centered at the origin.
>
>Can a script center the object?
>
>The layers must start from the bottom and run to the top of the model making
>vertical layers(slices).
>
>Is there a way to determine where the lowest y value is in the mesh?
>(I don't think so..)
>  
>

If you're using PoseRay to convert the model to Pov format, check the 
comments at the top of the include file.  PoseRay (or at least the 
version I have, v3.8.2.327) includes the bounding box coordinates when 
it builds the file.  The direct route, though, would be to use 
min_extent and max_extent, where min_extent(MyObject).y represents the 
lowest y value.

You can center the object as Simon noted, or you can use the 
Center_Trans macro from transforms.inc (which also includes some other 
nifty stuff as well).

(BTW, you might want to have a close look at the scale of the imported 
object.  For example, my Stanford bunny came out of PoseRay with a 
bounding box of  < -0.09469, 0.032987, -0.061874 > to < 0.061009, 
0.187321, 0.0588 >, which is awkwardly tiny.  I generally use "scale 
100" or so to get him into a more practical size range.)

Hope this helps...

--Sherry Shaw

-- 
#macro T(E,N)sphere{x,.4rotate z*E*60translate y*N pigment{wrinkles scale
.3}finish{ambient 1}}#end#local I=0;#while(I<5)T(I,1)T(1-I,-1)#local I=I+
1;#end camera{location-5*z}plane{z,37 pigment{granite color_map{[.7rgb 0]
[1rgb 1]}}finish{ambient 2}}//                                   TenMoons


Post a reply to this message

From: Alain
Subject: Re: Animating with CSG
Date: 28 Jun 2007 17:47:42
Message: <46842c7e$1@news.povray.org>
LikeNoOther nous apporta ses lumieres en ce 2007/06/28 05:34:
> Hi.
> 
> I have to create a program or script to cut a 3D model into layers(slices).
> The layers will look similar to CT scans (X-rays).
> To do this I can use two planes to cut 3D model.
> 
> I just have to do an animation and move the places upward through the model.
> I understand what to do, unfortunately I don't know exactly how to do this.
> 
> There is another problem with this. I have to be able to use a 3D mesh from
> either 3DS or Lightwave format. When I convert it to POV-Ray, the model is
> not centered at the origin.
> 
> Can a script center the object?
> 
> The layers must start from the bottom and run to the top of the model making
> vertical layers(slices).
> 
> Is there a way to determine where the lowest y value is in the mesh?
> (I don't think so..)
> 
> 
> Any help will be appreciated.
> 
> 
As Simon told, using min_extent/max_extent will give you where the object is 
locates and it's bounding box dimentions. The actual placement is not realy 
importent, as long as the camera is correctly placed.
Now, using that information and the built-in variable "clock" you can intersect 
a box from your mesh and move that box up according to the value of clock.
clock returns a value that range from 0 (start of the animation) to 1 (at the 
end). Divide the height of your object by that value, translate the box to the 
bottom of the mesh and add (height/clock). It will automaticaly move from the 
bottom to the top independently of how many frame you use.

You can intersect FROM a mesh, but you normaly can't intersect a mesh from 
another object. Also, note that this intersection will only show the surfaces of 
the mesh as a thin shell. This may make the object almost disapear if viewed 
from the top.

-- 
Alain
-------------------------------------------------
Gone crazy, be back later, leave message.


Post a reply to this message

From: LikeNoOther
Subject: Re: Animating with CSG
Date: 27 Jul 2007 05:55:01
Message: <web.46a9bfd4faf3a4e6758b6c7b0@news.povray.org>
Hi . Sorry I took so long to come back to you guys.
I just want to say thank you for all your help.
I found it very useful.

My program is now working, cutting models into slices.
The only problem I have now is that the images seem to have this
haze around the sliced object. I need to only see the exact slice in white
on a black background.

I use poseray as mentioned in above post to convert the model to POV-Ray
format.
I then just add the needed code to cut the model into layers.
I therefore don't make any changes to poseray's default settings.
I would like the model to look exactly like that in the preview window in
poseray when lighting is turned off. The whole object white.

Any help would be appreciated.

If you want to see what I do with the model slices check out my
website. www.cs.sun.ac.za/~esmal/


Post a reply to this message

From: Sherry Shaw
Subject: Re: Animating with CSG
Date: 27 Jul 2007 09:08:37
Message: <46a9ee55@news.povray.org>
LikeNoOther wrote:

>My program is now working, cutting models into slices.
>The only problem I have now is that the images seem to have this
>haze around the sliced object. I need to only see the exact slice in white
>on a black background.
>
>  
>
Could you post a bit of sample code?  And perhaps an image in povray.binaries.images
to demonstrate the problem?

--Sherry Shaw

-- 
#macro T(E,N)sphere{x,.4rotate z*E*60translate y*N pigment{wrinkles scale
.3}finish{ambient 1}}#end#local I=0;#while(I<5)T(I,1)T(1-I,-1)#local I=I+
1;#end camera{location-5*z}plane{z,37 pigment{granite color_map{[.7rgb 0]
[1rgb 1]}}finish{ambient 2}}//                                   TenMoons


Post a reply to this message

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