POV-Ray : Newsgroups : povray.unofficial.patches : Non-Linear transformations : Re: Non-Linear transformations Server Time
3 Sep 2024 00:16:29 EDT (-0400)
  Re: Non-Linear transformations  
From: Nathan Kopp
Date: 16 Aug 1999 21:59:45
Message: <37B8C2BE.96132025@Kopp.com>
Chris Huff wrote:
> 
> Yes, that was the point I was trying(and failing miserably) to make. Oh,
> well, I guess I just have to learn to explain things more in my
> messages. :-)

To clarify the problem with non-linear transforms for everyone:

To transform an object, you can do one of the following:
  1) transform the object itself (move a sphere's center, change
     a sphere's radius, move the vertices of a mesh, etc.)
  2) do an INVERSE-transform on the ray that is supposed to hit
     the object

Ray-tracer's generally use (2) for to allow intersection with a wide
variety of objects.  Using option (1) usually only works well with
certain objects.  For example, while scale, rotate, and translate are all
easy with a sphere, it's difficult to apply a rotation directly to a
cube.  This proble can be overcome by converting the object to a mesh
format (or using some kind of patch with control points, like a bezier),
but this is generally not desired by the POV-Ray community.

So the problem with non-linear transforms is that you need to (1) be able
to easily get the inverse transformation, and (2) be able to intersect
this result with the object.  Let's say you have a ray (a line) and you
transform it with a linear transform (an inverse linear transform is
still linear).  After the transformation, the ray will still be
straight (that's what "linear transformation" means: lines stay lines).

But what happens if you transform that ray with a non-linear transform?
It's not straight anymore!  Now how do you intersect this new curvy ray
with the object?  Ray-marching (as Nieminen pointed out) is basically
the only solution.  Other solutions (directly solving the ray-intersection
equation) are limited in the objects that they work with and require lots
of very complicated math.

So, then, why do non-linear transformations work with textures?  Well,
with textures, you're just transforming points.... not lines.  Points
stay points whether the transformation is linear or not.  It doesn't
matter.  So you take a point, run it through the inverse transform,
and use the resulting point to determine the texture.  Easy for points
(textures), difficult for rays (object intersection).

I hope this clarifies things.

As mentioned before, non-linear transforms could be added, but they
would have to apply the transforms in the forward direction directly
to the objects, which would probably require the objects to be
converted to some sort of mesh first.

-Nathan


Post a reply to this message

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