3D frustum clipping

Started by Krion, January 10, 2017, 05:30:45 AM

Previous topic - Next topic

Krion

Do the 3D sprites handle full 3D frustum clipping? Or will I need to manually clip against the near and far planes?

I'm expecting my Vectrex32 to arrive tomorrow and am really keen to use that 200MHz processor + floating point for some 3D graphics. I'm hoping to have lighting and hidden surface removal going at a decent frame rate.

A couple of years ago I coded this demo in 6809 assembly.

https://www.youtube.com/watch?v=awMUFCYnQ4U

Vectrex32

Vectrex32 has a clipping feature for 2D sprites. The way to do 3D fustrum clipping is to apply the 2D clipping feature to the view, after the perspective transform has been done (since, after the perspective transform, 3D sprites have been flattened to 2D). In the Vectrex32 manual, see sections 7.9.5 and 7.6.2.4.

- Bob

Krion

Thanks Bob.

I actually want to have large 3D models (like terrain) so I'll have line segments that will intersect the front clipping plane and go behind the camera, causing divisions by negative numbers in the perspective transform.

I'll code my own full 3D frustum clip instead and share the code on here when I'm done.

Vectrex32

I was thinking of writing a Tail Gunner game which would have enemy spaceships flying towards and then behind the camera. So I wrote the Vectrex32 code to do the necessary clipping of a line that goes behind the camera. Don't write your own frustum clipping until you test the built-in capabilities.

- Bob

Krion

Oh cool, but if it can go behind the camera and look right surely there must be more to it than just doing the perspective and then clipping in 2D? Plus there's the risk of division by zero if a point has the exact same z coordinate as the camera?

Anyway unfortunately my Vectrex32 didn't arrive today, according to the tracking code it's in Australia and up to our local postal service to get it to me. But when it arrives I'll certainly spend a lot of time tinkering before writing any of my own code.

Since the Vectrex can only render a limited number of lines per frame, that 200MHz processor can do an awful lot of processing for each one. Even algorithms that run in O(n^2) (as many do) should be possible. So I'm really hoping to get some low-res but ultra fancy 3D working on Vectrex32, especially some sort of geometric depth buffer to produce proper clipped occlusion.

Really excited about the possibilities, can't wait till it arrives! :)

Vectrex32

Quote from: Krion on January 11, 2017, 04:16:29 AM
Oh cool, but if it can go behind the camera and look right surely there must be more to it than just doing the perspective and then clipping in 2D? Plus there's the risk of division by zero if a point has the exact same z coordinate as the camera?

Right. It's a different chunk of code doing the behind-the-camera clipping.

Please keep us up to date on your Vectrex32 work. It sounds interesting.

- Bob