POV-Ray : Newsgroups : povray.general : centered and resized model question put differently Server Time
26 Nov 2024 16:31:01 EST (-0500)
  centered and resized model question put differently (Message 1 to 5 of 5)  
From: optima
Subject: centered and resized model question put differently
Date: 1 Jun 2010 03:40:02
Message: <web.4c04b8469ed47b0df816feb0@news.povray.org>
Hi,

I position models in povray through a program written in C#, in povray I can
manually position them any way I want thru trial and error.

thru C# though, I cannot position models in povray as I want them to. I divide a
models xyz dimensions by 2 in final translation to get the center of models. But
even though I use same code in povray and export models with same settings from
3ds max and then poseray, models show up in slightly different positions when
rendered. (actually they almost always show up by half the distance of x or y or
z axis/size of model)

Is it right that I divide models xyz dimensions by 2 for positioning purposes?

I suspect this happens because models are downloaded from the net and no matter
what setting I apply in 3ds max they will have different internal settings
because they are built by different artists at different times using different
versions of max, different etc. Do you think this is correct?

Thank you very much for any help

PS: I create a box in 100 cm xyz in max then I fit the model into this box  in
xyz. I do this so that I can resize the models to a specific dimension
programatically. Could this be the culprit?


Post a reply to this message

From: clipka
Subject: Re: centered and resized model question put differently
Date: 1 Jun 2010 10:19:43
Message: <4c0516ff$1@news.povray.org>
Am 01.06.2010 09:39, schrieb optima:

> thru C# though, I cannot position models in povray as I want them to. I divide a
> models xyz dimensions by 2 in final translation to get the center of models. But
> even though I use same code in povray and export models with same settings from
> 3ds max and then poseray, models show up in slightly different positions when
> rendered. (actually they almost always show up by half the distance of x or y or
> z axis/size of model)

I think I still haven't understood your workflow yet.

In case you're using min_extent and max_extent in POV-Ray, be aware that 
these functions do /not/ give you the dimensions of the /object/, but 
rather its /bounding box/, which - for simplicity of the math and 
algorithms - may be larger than the object, and the center of the 
bounding box may be different from the center of the object.

> Is it right that I divide models xyz dimensions by 2 for positioning purposes?

I'd suggest to not do that, unless the models are positioned way off the 
center. Any additional step in your workflow /might/ contribute to the 
issue, so to narrow it down, you should skip any step that is not 
/really/ necessary.

I'd also recommend checking the placement of objects in Poseray already, 
as the placement will remain unchanged by the process of exporting to 
POV-Ray and rendering.

A 3rd-party 3D viewer (e.g. Deep View) or modeller (e.g. Wings 3D) might 
help you find out whether the exported files are still ok (indicating a 
problem in the Poseray import) or not (indicating bogosities in the 3DS 
max export).

> PS: I create a box in 100 cm xyz in max then I fit the model into this box  in
> xyz. I do this so that I can resize the models to a specific dimension
> programatically. Could this be the culprit?

I think this really is a question for the 3DS max community. 
Theoretically, /anything/ related to metric vs. imperial dimensions, and 
anything involving transformations, has /some/ potential of messing up 
things; to narrow down the issue any further than this, you'll need to 
ask people who are very familiar with 3DS max.

I guess the whole issue will boil down to either a Poseray import 
problem or a 3ds max export problem. I honestly suspect the latter, and 
in that case we most likely can't help you with that here in any way.


Post a reply to this message

From: optima
Subject: Re: centered and resized model question put differently
Date: 11 Jun 2010 10:10:01
Message: <web.4c1242f93c9540bcdf816feb0@news.povray.org>
clipka , Thank you very much for the reply and sorry for not answering sooner.

How do I know if the model's origin is where?

I center the model's origin in max from Affect Pivot Only / Center To Object
then move it to 0.0.0 in xyz world position then export it as 3ds file for
import into PoseRay.

Where in Poseray can I see model's origins in xyz?

for example in this inc file exported from poseray we see

//Bounding Box....... from x,y,z=(-40.49511,-19.33101,-27.46092)
//                      to x,y,z=(-2.163608,19.76925,11.64881)
//                 size dx,dy,dz=(38.3315,39.10027,39.10973)
//                  center x,y,z=(-21.32936,0.219121,-7.906058)
//                       diagonal 67.28823

how come it says center x,y,z=(-21.32936 ....

I made it 100 units (cm) long in max but it says -21.32936 for x axis
Why is that?

any help would be appreciated, thanks again.


Post a reply to this message

From: Alain
Subject: Re: centered and resized model question put differently
Date: 11 Jun 2010 13:42:55
Message: <4c12759f$1@news.povray.org>

>   clipka , Thank you very much for the reply and sorry for not answering sooner.
>
> How do I know if the model's origin is where?
>
> I center the model's origin in max from Affect Pivot Only / Center To Object
> then move it to 0.0.0 in xyz world position then export it as 3ds file for
> import into PoseRay.
>
> Where in Poseray can I see model's origins in xyz?
>
> for example in this inc file exported from poseray we see
>
> //Bounding Box....... from x,y,z=(-40.49511,-19.33101,-27.46092)
> //                      to x,y,z=(-2.163608,19.76925,11.64881)
> //                 size dx,dy,dz=(38.3315,39.10027,39.10973)
> //                  center x,y,z=(-21.32936,0.219121,-7.906058)
> //                       diagonal 67.28823
>
> how come it says center x,y,z=(-21.32936 ....
>
> I made it 100 units (cm) long in max but it says -21.32936 for x axis
> Why is that?
>
> any help would be appreciated, thanks again.
>
>
The bounding box goes from x=-40.49511 to x=-2.163608
-40.49511 + -2.163608 = -42.658718
-42.658718 / 2 = -21.329359 -> -21.32936 after rounding.
So, the value reported is correct.

40*2.5 = 100
It looks like, even if you say you are working in cm, the object 
measurements are converted to inches.
Make sure that poseray is set to work, and export, in cm.


Alain


Post a reply to this message

From: clipka
Subject: Re: centered and resized model question put differently
Date: 11 Jun 2010 13:57:28
Message: <4c127908$1@news.povray.org>
Am 11.06.2010 16:06, schrieb optima:
>   clipka , Thank you very much for the reply and sorry for not answering sooner.
>
> How do I know if the model's origin is where?
>
> I center the model's origin in max from Affect Pivot Only / Center To Object
> then move it to 0.0.0 in xyz world position then export it as 3ds file for
> import into PoseRay.
>
> Where in Poseray can I see model's origins in xyz?
>
> for example in this inc file exported from poseray we see
>
> //Bounding Box....... from x,y,z=(-40.49511,-19.33101,-27.46092)
> //                      to x,y,z=(-2.163608,19.76925,11.64881)
> //                 size dx,dy,dz=(38.3315,39.10027,39.10973)
> //                  center x,y,z=(-21.32936,0.219121,-7.906058)
> //                       diagonal 67.28823
>
> how come it says center x,y,z=(-21.32936 ....

Because that's ((-40.49511,-19.33101,-27.46092) + 
(-2.163608,19.76925,11.64881)) / 2.

I.e. what Poseray calls the object's center is actually the center of 
the smallest axis-aligned box that fits the object. 3DS max may have 
different ideas what the center actually is, e.g. the average of all 
vertices, or center of gravity, or whatever. You should consult your 3DS 
max documentation about this.

> I made it 100 units (cm) long in max but it says -21.32936 for x axis
> Why is that?

Looks like 3DS max exports dimensions in inches - at least in this case. 
(100 cm are about 39.37 inch, which is pretty close to what Poseray 
reports for size.)


Post a reply to this message

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