POV-Ray : Newsgroups : povray.general : Slide projection image map mode Server Time
26 Nov 2024 05:35:00 EST (-0500)
  Slide projection image map mode (Message 1 to 4 of 4)  
From: Martin von Gagern
Subject: Slide projection image map mode
Date: 18 Jul 2011 09:25:18
Message: <4e24343e@news.povray.org>
Hi!

I was surprised to find that povray doesn't support an image map type
that does a projection from a single point through a planar (possibly
tiled) image. The effect would be very much like a slide projector where
a point light source sends rays of light through a slide some distance
away from it. I would like to see this added in a future version. Is
this group the correct place to make such a suggestion?

To be more precise: I'd embed the user's image at z=0 in a square with
edges of 2 unit lengths and centered on the z-axis. In other words, the
lower left corner of the input image would be at <-1, -1, 0> and the
upper right corner at <1, 1, 0>. This planar image would be turned into
a 3D "block of clay" by adding lines through the point z = <0, 0, 1>.

In other words, for every pixel of the object to be textured, compute
the distance to <0, 0, 1> and scale it so that the z coordinate of the
distance becomes 1. Then the x and y coordinates will give the
corresponding image position. Depending on the use of the "once"
keyword, coordinates would be mapped to or cut at the [-1, 1] range.
If the positoon to be mapped already has z = 1, then the image map
cannot provide any data, and default texturing should be used instead,
i.e. transparent pigment, no normale modification, or whatever.

The choice of coordinates is such that a matrix transformation can be
easily used to adjust the position and direction of the slide as well as
distance of the projection point. Two columns of the transformation
matrix would describe the orientation and size of the slide in space,
the third would give the distance vector between its center and the
projection point. The translation column would translate this whole
setup, thereby determining the location of the center of the slide. It
might make sense to provide a macro which computes this matrix from four
suitable vectors, e.g. three slide corners and the projection point.
Having the image start at <0, 0, 0> instead of <-1, -1, 0> would make
the transformation even easier, but would require a shear transformation
in the case of a centered image, which I would expect to be the most
common use case.

Possible applications include conformal (i.e. angle-preserving) textures
on parts of a sphere; textures on infinite parametric objects with
limited angle between the asymptotes (e.g. hyperboloid); projection of a
previously ray-traced scene (with a perspective camera) onto a (probably
simpler) object; and probably many more.

I've had a look at the code in imageutil.h. Adjusting map_pos to provide
one more map type should be simple enough. Writing the code for the
mapping described above is easy as well. The undefined case z==1 can be
easily handled by returning 0 from the new slide_image_map function,
causing map_pos to return 1 as it does for the other map types. I'm not
sure about the role of the image->Gradient vector. It seems that this
vector is initialized to  <1, -1, 0> but never modified afterwards.
Could this simply be removed from the code, or should new map types
honour its value in any way?

Similar questions arise in imageutil.h, where other map types are
listed, like PARABOLIC_MAP and so on. Are they listed for historic
reasons? Should new mapping types follow those already listed? Or should
OLD_MAP always be last? Having a gap between the existing
implementations for type 0 through 2 and a new implementation for type 8
or so might confuse readers of the documentation.

If developers are interested in having this feature, I'd be willing to
write a patch. Answers to the above questions would increase its quality.

If I fail to reply to postings in this group, please send me a personal
email instead.

Greetings,
 Martin von Gagern


Post a reply to this message

From: Nekar Xenos
Subject: Re: Slide projection image map mode
Date: 18 Jul 2011 14:38:55
Message: <op.vytve2i3ufxv4h@xena>
Isn't this the cubic pattern in 3.7?

-Nekar Xenos-


Post a reply to this message

From: Alain
Subject: Re: Slide projection image map mode
Date: 18 Jul 2011 15:47:47
Message: <4e248de3$1@news.povray.org>
Le 2011/07/18 09:25, Martin von Gagern a écrit :
> Hi!
>
> I was surprised to find that povray doesn't support an image map type
> that does a projection from a single point through a planar (possibly
> tiled) image. The effect would be very much like a slide projector where
> a point light source sends rays of light through a slide some distance
> away from it. I would like to see this added in a future version. Is
> this group the correct place to make such a suggestion?
>
> To be more precise: I'd embed the user's image at z=0 in a square with
> edges of 2 unit lengths and centered on the z-axis. In other words, the
> lower left corner of the input image would be at<-1, -1, 0>  and the
> upper right corner at<1, 1, 0>. This planar image would be turned into
> a 3D "block of clay" by adding lines through the point z =<0, 0, 1>.
>
> In other words, for every pixel of the object to be textured, compute
> the distance to<0, 0, 1>  and scale it so that the z coordinate of the
> distance becomes 1. Then the x and y coordinates will give the
> corresponding image position. Depending on the use of the "once"
> keyword, coordinates would be mapped to or cut at the [-1, 1] range.
> If the positoon to be mapped already has z = 1, then the image map
> cannot provide any data, and default texturing should be used instead,
> i.e. transparent pigment, no normale modification, or whatever.
>
> The choice of coordinates is such that a matrix transformation can be
> easily used to adjust the position and direction of the slide as well as
> distance of the projection point. Two columns of the transformation
> matrix would describe the orientation and size of the slide in space,
> the third would give the distance vector between its center and the
> projection point. The translation column would translate this whole
> setup, thereby determining the location of the center of the slide. It
> might make sense to provide a macro which computes this matrix from four
> suitable vectors, e.g. three slide corners and the projection point.
> Having the image start at<0, 0, 0>  instead of<-1, -1, 0>  would make
> the transformation even easier, but would require a shear transformation
> in the case of a centered image, which I would expect to be the most
> common use case.
>
> Possible applications include conformal (i.e. angle-preserving) textures
> on parts of a sphere; textures on infinite parametric objects with
> limited angle between the asymptotes (e.g. hyperboloid); projection of a
> previously ray-traced scene (with a perspective camera) onto a (probably
> simpler) object; and probably many more.
>
> I've had a look at the code in imageutil.h. Adjusting map_pos to provide
> one more map type should be simple enough. Writing the code for the
> mapping described above is easy as well. The undefined case z==1 can be
> easily handled by returning 0 from the new slide_image_map function,
> causing map_pos to return 1 as it does for the other map types. I'm not
> sure about the role of the image->Gradient vector. It seems that this
> vector is initialized to<1, -1, 0>  but never modified afterwards.
> Could this simply be removed from the code, or should new map types
> honour its value in any way?
>
> Similar questions arise in imageutil.h, where other map types are
> listed, like PARABOLIC_MAP and so on. Are they listed for historic
> reasons? Should new mapping types follow those already listed? Or should
> OLD_MAP always be last? Having a gap between the existing
> implementations for type 0 through 2 and a new implementation for type 8
> or so might confuse readers of the documentation.
>
> If developers are interested in having this feature, I'd be willing to
> write a patch. Answers to the above questions would increase its quality.
>
> If I fail to reply to postings in this group, please send me a personal
> email instead.
>
> Greetings,
>   Martin von Gagern

I think that it can easily be acheived using a spherical warp, and apply 
that to a plane or any other object whatsoever. A spherical warp NEVER 
need to be applyed to a sphere, it can be applyed to any primitive or 
CSG construct.

The same apply for the cylindrical and toroidal warps.

A spherical warp maps from a single point situated at <0,0,0>
The rest is just a question of applying that to a plane or box situated 
at the desired distance.

Once it's done, you can rotate, scale and translate your object as needed.

As for the gaps in the various mapings, those values where set 
aside/reserved for future devlopments.


Alain


Post a reply to this message

From: Warp
Subject: Re: Slide projection image map mode
Date: 18 Jul 2011 16:48:08
Message: <4e249c08@news.povray.org>
Nekar Xenos <nek### [at] gmailcom> wrote:
> Isn't this the cubic pattern in 3.7?

  If I understood correctly what he described, the cubic pattern can indeed
be used for that, if you limit the image contents to one of the six squares
from which the data is taken from.

-- 
                                                          - Warp


Post a reply to this message

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