Sign in to follow this  
supagu

software clipping

Recommended Posts

im trying to implement clipping in my software renderer. I can clip successfully with all clip planes except the front clip plane. I'm clipping in clip space (ie. after the perspective divide). Now I figure I need to do near plane clipping in camera/view space (ie. before the perspective divide) as the perspective divide causes issues when vertices go behind the camera and get mirrored. Now, my problem is, how do i determine the near clip plane? I treat my software renderer pretty much like a video card: i have vertex and pixel shaders and have no idea of any matrices used in the shaders. So im wondering how video cards for example do near plane clipping so i can emulate them in my software renderer. edit: I think i may have found my solution, if i divide by abs(w) this fixes any mirroring from back projections so i can do near plane clipping in regular clip space [Edited by - supagu on February 1, 2008 3:42:52 AM]

Share this post


Link to post
Share on other sites
um, the same way you did the far clip plane, and all the others. you pick a number and go with it. 1 works fine for most people but that depends on how much '1' unit relates to in your renderer. it's probably not the worst idea to do your near plane clip before doing perspective transformations so that you can forget about having to check for zero divides and crap from negative divides etc.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this