[comp.graphics] Wanted: Fast Transformations of 3D Clipping Planes

rivera@stdc01.UUCP (Greg Rivera) (06/29/90)

Wanted:
	a) Fast ways to transform plane equations through arbitrary
	matrices, OR
	b) Fast ways to transform eye-clipping planes so I can do
	clipping in some other coordinate space (still in 3D)

Problem:
	My view clipping planes (top, bottom, left, right, near, far)
	are defined in eye space.  But my models (oodles, and moving
	all the time) are defined relative to their own coordinate system.
	Therefore, to do culling/clipping, I either:
	A) Transform every model into eye space, then cull/clip, or
	B) transform the clipping planes into the model's space, so I can
	cull/clip there.
	
	I would like to have suggestions for how to do (B) quickly.

For thought:
	Are there any advantages due to the clipping planes inter-relationships?
	For example, near and far planes are usually parallel.
	Also, for perspective, all four side planes meet at a common point.
	Or are there speedups if the model transformation is of a special
	form, like rotates only (orthonormal)?

	Currently, I'm stuck with sampling 3 points per plane (some are shared)
	and transforming them into model space.  After a cross product and
	normalization to get the normal to the plane, one extra dot gets
	the distance to finish off the plane equation to get Ax+By+Cz+D=0.
	Total is 5 transforms, 5 cross products with normalizations, and
	6 dots (assumes parallel near/far).

Please email suggestions.  Thanks.
-- 
-- Gregory Rivera            Email:       ...{!sun}!rti.rti.org!stdc01!rivera --
-- "... and the wisdom to    Paper: Graphicon, P.O. Box 13951, RTP, NC  27709 --
--  know the difference."    Voice: (919)361-3848           Fax:(919)361-3888 --

xanthian@zorch.SF-Bay.ORG (Kent Paul Dolan) (06/30/90)

uucp!rti.rti.org!stdc01!rivera  (Greg Rivera) writes:
>Wanted:
>	a) Fast ways to transform plane equations through arbitrary
>	matrices, OR
>	b) Fast ways to transform eye-clipping planes so I can do
>	clipping in some other coordinate space (still in 3D)
>
>Problem:
>	My view clipping planes (top, bottom, left, right, near, far)
>	are defined in eye space.  But my models (oodles, and moving
>	all the time) are defined relative to their own coordinate system.
>	Therefore, to do culling/clipping, I either:
>	A) Transform every model into eye space, then cull/clip, or
>	B) transform the clipping planes into the model's space, so I can
>	cull/clip there.
>	
>	I would like to have suggestions for how to do (B) quickly.
>
>For thought:
>	Are there any advantages due to the clipping planes inter-relationships?
>	For example, near and far planes are usually parallel.
>	Also, for perspective, all four side planes meet at a common point.
>	Or are there speedups if the model transformation is of a special
>	form, like rotates only (orthonormal)?
>
>	Currently, I'm stuck with sampling 3 points per plane (some are shared)
>	and transforming them into model space.  After a cross product and
>	normalization to get the normal to the plane, one extra dot gets
>	the distance to finish off the plane equation to get Ax+By+Cz+D=0.
>	Total is 5 transforms, 5 cross products with normalizations, and
>	6 dots (assumes parallel near/far).
>
>Please email suggestions.  Thanks.
>-- 
>-- Gregory Rivera          Email:       ...{!sun}!rti.rti.org!stdc01!rivera --
>-- "... and the wisdom to  Paper: Graphicon, P.O. Box 13951, RTP, NC  27709 --
>--  know the difference."  Voice: (919)361-3848           Fax:(919)361-3888 --

I'm a little confused by your description.  If you are already doing the
transformations to move your models, and to put them together in the same
scene, then composing those transformations with the one to get all the data
into the viewing frustrum, before you apply the transformations to the
models should be fairly cheap.  Quite possibly I'm missing the point.

Anyway, I implemented dynamic motion with six plane clipping in an oblique
perspective view (in assembly language!) from the nice math in:

	Richard. F. Puk, General Clipping on An Oblique Viewing Frustrum,
	Pages 229 to 235 in Computer Graphics, A Quarterly Report of
	SIGGRAPH-ACM, Volume 11, Number 2, Summer 1977, SIGGRAPH '77
	Proceedings.

Be warned that the math assumes exact arithmetic; in a real computer
things are a bit more complex than Dr. Puk portrays them; I ended up
with a few flags to assure that I didn't reuse the same clipping plane
where his comparisions for equality of quantities computed in floating
point two different ways failed from roundoff errors.

Still, on the clunky hardware I had in 1981, it worked OK.

Kent, the (unemployable) man from xanth.
<xanthian@Zorch.SF-Bay.ORG> <xanthian@well.sf.ca.us>

turk@Apple.COM (Ken "Turk" Turkowski) (08/13/90)

In article <628@stdc01.UUCP> uucp!rti.rti.org!stdc01!rivera  (Greg Rivera) writes:
>Wanted:
>	a) Fast ways to transform plane equations through arbitrary
>	matrices, OR
>	b) Fast ways to transform eye-clipping planes so I can do
>	clipping in some other coordinate space (still in 3D)
>
>...

See my paper on "Properties of Surface Normal Transformations"
in Academic Press's new Graphics Gems book.
A plane is very similar to a normal.
-- 
Ken Turkowski @ Apple Computer, Inc., Cupertino, CA
Internet: turk@apple.com
Applelink: TURK
UUCP: sun!apple!turk