|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hi there,
I would like to render an object using POV-Ray and it works nicely for
the most part. The issue is that I have varying objects that I'm
rendering (the POV-Ray source is generated) and they are varying in
their position and size. I always view them in orthographic projection
from a 45° angle (i.e., object at 0,0,0 camera at 10,10,10 look_at 0,0,0).
This works fairly well but I would like the rendering output to be so
that the object is not clipped but also takes up most of the screen real
estate. I do this currently by manually varying the "angle" operator
(i.e., for small objects, small angle and for large objects a large angle).
I want this do be done automatically but I don't know where to start.
Any hints on how to achieve this?
Thanks,
Herbert
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Herbert Pflaum <nospam@invalid> wrote:
> Hi there,
>
> I would like to render an object using POV-Ray and it works nicely for
> the most part. The issue is that I have varying objects that I'm
> rendering (the POV-Ray source is generated) and they are varying in
> their position and size. I always view them in orthographic projection
Well, the orthographic projection makes it easy.
http://news.povray.org/58475e0a%241%40news.povray.org
So what I would do is define your object at the origin, and put your camera at
z=10, then rotate your object -y*45 and -x*45 to simulate the way it will look
with the camera in the proper location. That will give you an axis-aligned
bounding box which will tell you how many pov-units wide and high it is in that
orientation.
Then you can either use the scene as it is and calculate an appropriate "zoom"
value, or undo the rotations and then move your camera to xyz*10
make sense?
You may have to perform additional adjustments using a translation if your
objects are not symmetrical and centered on the origin.
> This works fairly well but I would like the rendering output to be so
> that the object is not clipped but also takes up most of the screen real
> estate. I do this currently by manually varying the "angle" operator
> (i.e., for small objects, small angle and for large objects a large angle).
>
> I want this do be done automatically but I don't know where to start.
> Any hints on how to achieve this?
Just in case you're interested, there was a thread on doing this with the
perspective camera as well:
http://news.povray.org/povray.binaries.images/thread/%3C5d95e6c3%241%40news.povray.org%3E/
-Bill
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Le 2021-06-15 à 13:14, Herbert Pflaum a écrit :
> Hi there,
>
> I would like to render an object using POV-Ray and it works nicely for
> the most part. The issue is that I have varying objects that I'm
> rendering (the POV-Ray source is generated) and they are varying in
> their position and size. I always view them in orthographic projection
> from a 45° angle (i.e., object at 0,0,0 camera at 10,10,10 look_at 0,0,0).
>
> This works fairly well but I would like the rendering output to be so
> that the object is not clipped but also takes up most of the screen real
> estate. I do this currently by manually varying the "angle" operator
> (i.e., for small objects, small angle and for large objects a large angle).
>
> I want this do be done automatically but I don't know where to start.
> Any hints on how to achieve this?
>
> Thanks,
> Herbert
>
You can use max_extent(Object) and min_extent(Object) to relocate and
scale your objects correctly.
Those return the far, top right and close bottom left of the bounding
box of Object.
The way to use that is as follow (steps as comment so that you can
copy/paste in your scene :
// 1) #declare your object.
#declare Object = { your object's definition/construction }
// 2) Find it's bounds :
#declare TopRight = max_extent(Object);
#declare BottomLeft = min_extent(Object);
// 3) Find the centre of the object :
#declare ObjCentre = (TopRight + BottomLeft ) /2;
// 4) Place your object at the origin :
#declare Object = object{Object translate -ObjCentre }
// 5) Optionally, you can scale it to fit and prevent clipping :
#declare Extent = max(TopRight.x, TopRight.y, TopRight.z);
// Find the largest dimension
#declare DimFactor = 9.9;
// Standardize the dimention :
#declare Object = object{Object scale 9.9/Extent}
// This effectively scale your object down to a size of 1 unit, then
// up by a factor of 9.9, keeping it's proportions intact
// and providing a small margin
// 6) Finally, place it in your scene :
Object
The value of «DimFactor» may need to be adjusted to have your best fit.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Am 15.06.2021 um 22:27 schrieb Alain Martel:
> You can use max_extent(Object) and min_extent(Object) to relocate and
> scale your objects correctly.
> Those return the far, top right and close bottom left of the bounding
> box of Object.
Just for the records: It is worthy to note that the bounding box of an
object is not necessarily a perfect fit; depending on the type of object
and how it has been rotated, it might be noticeably larger.
The reason is that the bounding boxes' primary purpose is to be used
internally during render to speed up calculations, but for that purpose
they don't need to be perfect, as long as they contian the entire object.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
clipka <ano### [at] anonymousorg> wrote:
> Just for the records: It is worthy to note that the bounding box of an
> object is not necessarily a perfect fit; depending on the type of object
> and how it has been rotated, it might be noticeably larger.
Right-o. Always good to have that datum repeated as a refresher lest it bite
the unsuspecting.
That actually gave rise to a fair bit of exploration and learning:
http://news.povray.org/povray.general/thread/%3C5ef59918%241%40news.povray.org%3E/
http://news.povray.org/povray.text.scene-files/thread/%3Cweb.5db5b0ff51c96acafeeb22ff0%40news.povray.org%3E/
http://news.povray.org/povray.binaries.images/thread/%3Cweb.5dc8a318adf09f614eec112d0%40news.povray.org%3E/?ttop=432391
&toff=100
http://news.povray.org/povray.text.scene-files/thread/%3Cweb.5dc33544f7b9a3affeeb22ff0%40news.povray.org%3E/
and finally:
http://news.povray.org/povray.binaries.images/thread/%3Cweb.6067c66d2a07e751f9dae3025979125%40news.povray.org%3E/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Le 2021-06-16 à 05:16, clipka a écrit :
> Am 15.06.2021 um 22:27 schrieb Alain Martel:
>
>> You can use max_extent(Object) and min_extent(Object) to relocate and
>> scale your objects correctly.
>> Those return the far, top right and close bottom left of the bounding
>> box of Object.
>
> Just for the records: It is worthy to note that the bounding box of an
> object is not necessarily a perfect fit; depending on the type of object
> and how it has been rotated, it might be noticeably larger.
>
> The reason is that the bounding boxes' primary purpose is to be used
> internally during render to speed up calculations, but for that purpose
> they don't need to be perfect, as long as they contian the entire object.
I know that, but, in many cases, it's good enough.
In the present case, it may be just what is needed. It will always
ensure that the whole object is visible, even if the use of the image's
real estate may not be optimal.
Also, the solution proposed ensure that the object do not extend beyond
the camera.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Op 16-6-2021 om 15:51 schreef Alain Martel:
> I know that, but, in many cases, it's good enough.
> In the present case, it may be just what is needed. It will always
> ensure that the whole object is visible, even if the use of the image's
> real estate may not be optimal.
>
> Also, the solution proposed ensure that the object do not extend beyond
> the camera.
Absolutely.
Thanks Alain! I was just in need of something like this for the
granite_21 macro, and you took away the need to write my own macro. ;-)
I changed your code into a macro which I include here. Herbert might
want to use it.
--
Thomas
Post a reply to this message
Attachments:
Download 'am_resize.inc.txt' (2 KB)
|
|
| |
| |
|
|
|
|
| |
|
|