Skip to main content
gamedev.net
🔒 Locked

software clipping

Started by supagu Feb 1, 2008 at 3:24 AM 0 replies 1k views
Original Post
supagu
supagu
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]
nb
nb
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.