POV-Ray : Newsgroups : povray.pov4.discussion.general : superlinear transformations Server Time
20 Apr 2024 03:29:58 EDT (-0400)
  superlinear transformations (Message 1 to 9 of 9)  
From: Dan Connelly
Subject: superlinear transformations
Date: 26 Sep 2008 14:03:57
Message: <48dd240d$1@news.povray.org>
Presently, objects can be transformed according to a displacement vector plus a 3x3
matrix.  This is a linear transformation.  However, it would be useful if one could
also do nonlinear transformations.   For example, x -> x * y, or x -> x * (1 + 0.1 *
sin(y)).  I can easily see how this would become hopelessly complex, but it would be
useful.


Post a reply to this message

From: Warp
Subject: Re: superlinear transformations
Date: 26 Sep 2008 14:58:58
Message: <48dd30f2@news.povray.org>
Dan Connelly <djc### [at] yahoocom> wrote:
> Presently, objects can be transformed according to a displacement
> vector plus a 3x3 matrix.  This is a linear transformation.  However,
> it would be useful if one could also do nonlinear transformations.
> For example, x -> x * y, or x -> x * (1 + 0.1 * sin(y)).  I can easily
> see how this would become hopelessly complex, but it would be useful.

  Actually objects are not transformed at all. That would be impossible
in the generic case.

  What POV-Ray does is a common raytracing trick: Rather than transform
the object with the transformation matrix, it transforms the ray with
the inverse of the transformation matrix. The end result is exactly the
same, but the advantage is that it's much easier (and in many cases,
*possible*) to do it like this.

  This is the reason why transformations must be linear. The straight ray
must be straight also after it's transformed. It cannot become curved.
This is the reason why only rotation, scaling, skewing (which is actually
a combination of rotation and uneven scaling) and translation is possible.

  Raytracing with curved lines cannot be done accurately, and would be
extremely slow.

-- 
                                                          - Warp


Post a reply to this message

From: Dan Connelly
Subject: Re: superlinear transformations
Date: 26 Sep 2008 20:46:33
Message: <48dd8269$1@news.povray.org>
Warp wrote:
> Dan Connelly <djc### [at] yahoocom> wrote:
>> Presently, objects can be transformed according to a displacement
>> vector plus a 3x3 matrix.  This is a linear transformation.  However,
>> it would be useful if one could also do nonlinear transformations.
>> For example, x -> x * y, or x -> x * (1 + 0.1 * sin(y)).  I can easily
>> see how this would become hopelessly complex, but it would be useful.
> 
>   Actually objects are not transformed at all. That would be impossible
> in the generic case.
> 
>   What POV-Ray does is a common raytracing trick: Rather than transform
> the object with the transformation matrix, it transforms the ray with
> the inverse of the transformation matrix. The end result is exactly the
> same, but the advantage is that it's much easier (and in many cases,
> *possible*) to do it like this.
> 
>   This is the reason why transformations must be linear. The straight ray
> must be straight also after it's transformed. It cannot become curved.
> This is the reason why only rotation, scaling, skewing (which is actually
> a combination of rotation and uneven scaling) and translation is possible.
> 
>   Raytracing with curved lines cannot be done accurately, and would be
> extremely slow.
> 


Excellent answer -- thanks.

I'm a bit confused about the skew argument.  There's

matrix:

3 degrees of freedom: transformation
3 degrees of freedom: scaling
3 degrees of freedom: rotation

So this leaves 3 more degrees of freedom..... which are skew.


(right-hand coordinates)

| ax  0  0 |
| 0  ay  0 | : scaling
| 0  0  az |

| cz  sz  0 |

| 0   0   1 |   (permute for x, y)

So between scaling and rotation, I'm constrained to
antisymmetric matrixes.

A typical shear matrix:

| uz  vz  0 |

| 0   0   1 |   (permute for x, y)

So this gives me 9 parameters:
ax, ay, az, sx, sy, sz, vx, vy, vz

the same number of parameters needed to specify the full matrix.


Post a reply to this message

From: Dan Connelly
Subject: Re: superlinear transformations
Date: 27 Sep 2008 00:40:41
Message: <48ddb949$1@news.povray.org>
Dan Connelly wrote:
> Warp wrote:
>> This is the reason why only rotation, scaling, skewing (which is actually
>> a combination of rotation and uneven scaling) and translation is 
>> possible.
>>

> I'm a bit confused about the skew argument.  There's

> matrix:
> 
> 3 degrees of freedom: transformation

That should be translation.

> 3 degrees of freedom: scaling
> 3 degrees of freedom: rotation
> 
> So this leaves 3 more degrees of freedom..... which are skew.
> 

> (right-hand coordinates)
> 
> | ax  0  0 |
> | 0  ay  0 | : scaling
> | 0  0  az |
> 
> | cz  sz  0 |

> | 0   0   1 |   (permute for x, y)
> 
> So between scaling and rotation, I'm constrained to
> antisymmetric matrixes.
> 
> A typical shear matrix:
> 
> | uz  vz  0 |

> | 0   0   1 |   (permute for x, y)
> 
> So this gives me 9 parameters:
> ax, ay, az, sx, sy, sz, vx, vy, vz
> 
> the same number of parameters needed to specify the full matrix.
> 

After thinking more about this, I realized my mistake.
Matrix multiplication fails to preserve symmetry, only addition.
So given that, it's possible to generate a symmetric component (the
offdiagonal terms generating shear) in addition to a antisymmetric
component (the off-diagonal terms generating rotation) from rotation
and scaling together, as long as the scaling is non-uniform, as Warp
said.  My linear algebra is too rusty....



| 0 1 | |-1 0 |       | 0 1 |
|-1 0 | | 0 1 |   =   | 1 0 |

And my degrees of freedom argument follows only if one is allowed a single
rotation and a single scaling.  But generating pure shear requires two rotations.

Sorry....

Dan


Post a reply to this message

From: Le Forgeron
Subject: Re: superlinear transformations
Date: 27 Sep 2008 04:02:44
Message: <48dde8a4$1@news.povray.org>
Le Fri, 26 Sep 2008 21:40:57 -0700, Dan Connelly a modifié des petits
morceaux de l'univers pour nous faire lire :

> And my degrees of freedom argument follows only if one is allowed a
> single rotation and a single scaling.  But generating pure shear
> requires two rotations.
> 
> Sorry....
> 
> Dan

Might I remind people that the internal transformation matrix is a 4x4, 
using weighted coordinates system (x,y,z,w).
Successive transformations are stacked together by matrix-multiplication 
at parse time.

Now, I would be interested in seeing a screwing transformation-matrix...
Please enlight-me


Post a reply to this message

From: Warp
Subject: Re: superlinear transformations
Date: 27 Sep 2008 05:13:19
Message: <48ddf92f@news.povray.org>
Le Forgeron <jgr### [at] freefr> wrote:
> Now, I would be interested in seeing a screwing transformation-matrix...
> Please enlight-me

http://www.geocities.com/evilsnack/matrix.htm

-- 
                                                          - Warp


Post a reply to this message

From: Nicolas Alvarez
Subject: Re: superlinear transformations
Date: 23 Nov 2008 18:10:40
Message: <4929e2f0@news.povray.org>
Warp wrote:
>   This is the reason why transformations must be linear. The straight ray
> must be straight also after it's transformed. It cannot become curved.
> This is the reason why only rotation, scaling, skewing (which is actually
> a combination of rotation and uneven scaling) and translation is possible.

Hmm I don't think nonlinear transformations would cause the ray to be a
curve. Non-linear transf. are already possible in isosurfaces.

All you need is a different matrix for each pixel. Or rather, instead of
using a matrix you multiply with, use a generic function.


Post a reply to this message

From: scott
Subject: Re: superlinear transformations
Date: 24 Nov 2008 04:42:58
Message: <492a7722$1@news.povray.org>
> Hmm I don't think nonlinear transformations would cause the ray to be a
> curve.

Of course they would, if I apply the following transformation to a sphere:

x -> x
y -> y^3
z -> z

Then it's impossible to convert this to a "straight ray intersecting with a 
unit sphere at the origin" problem, which is what POV does for all linear 
transformations.

> Non-linear transf. are already possible in isosurfaces.

Yes, and they are much slower than rendering primitives like a sphere and 
take setting up to get correct results.  Primitives just work, fast.


Post a reply to this message

From: Warp
Subject: Re: superlinear transformations
Date: 24 Nov 2008 12:06:01
Message: <492adef9@news.povray.org>
Nicolas Alvarez <nic### [at] gmailcom> wrote:
> Hmm I don't think nonlinear transformations would cause the ray to be a
> curve.

  Well, the very definition of "non-linear transformation" *is* that
straight lines don't necessarily remain straight after the transformation.

  Conversely the very definition of "linear transformation" is that any
straight line remains straight after the transformation.

> Non-linear transf. are already possible in isosurfaces.

  In the same sense as non-linear transformations are "possible" for
triangle meshes (although not really, but almost).

  You are not really transforming the isosurface object. You are modifying
its function, which is a different thing (from the point of view of
raytracing). You can't do that for other primitives.

> All you need is a different matrix for each pixel. Or rather, instead of
> using a matrix you multiply with, use a generic function.

  Simply changing the direction of the ray according to a function, while
keeping the ray straight, is *not* enough to achieve non-linear
transformations of objects.

-- 
                                                          - Warp


Post a reply to this message

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