Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

MButchers

Backface Culling

This topic is 6087 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hello there, im using Mark Morleys code for bounding sphere occlusion and it works great however i am now implimenting backface removal and for some reason its not working. Im doing the following Get the clip planes for the frustum ( these all face inwards ). ViewNormal = 1st 3 elements of near clip plane (x,y,z). Multiply the quads normal by the objects current transformation matrix. If DotProduct(ViewNormal,QuadNormal) > 0 then RenderQuad. Can anyone see anything obviously wrong, Thanks Mark.

Share this post


Link to post
Share on other sites
Advertisement
Let me try to draw some art:
^
| /
| |
| /
|
*
Well... * is the eye position, the arrow your ViewNormal and the other thing a quad.
Clearly, the quad´s normal is facing in the direction of the ViewNormal, even though the quad is possibly visible (Draw this clearly on a piece of paper, and you will see what I mean).
But you can adjust this simply. Just take any point on your quad. Let´s call it a. Then calculate
ViewNormal = a - eyePosition
and then your test on DotProduct(ViewNormal, Quadnormal) > 0 will work.

I now see something else that could be wrong. You must take care that you multiply the quad´s normal with the linear part of your transformation matrix (no translation). As you only want to rotate the normal, not translate it. So make the fourth row (or column, depends on your math) 0.

Share this post


Link to post
Share on other sites
Cheers,

shall give that a go,
I had already noticed the bug with translating the
normal ( specular highlights wizzing around with
object as it rotates ) All fixed now

Many thanks

Mark.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!