Normals and back face culling with field of view angle

Started by
14 comments, last by crowley9 15 years, 10 months ago
Not if you are transforming the camera into object space (and the object is static within object space).
Advertisement
Aha, now I see what you're on about. Very cool, now I can do the backface culling without touching the verts.

Thanks.
Thank you for clearing things up. I managed to use your discussion to figure out what I was and wasn't doing right. I've got it to do the back face culling perfectly, even fixed some other normal issues I was having as well.

Just to explain where I am now after fixing said problems:

Now I am storing a rotation only matrix without any translations with the object in camera space.
I am also storing the rotated and translated in camera space matrix.
Take the originally calculated normal of a poly and multiplying it with that rotation only matrix to get the updated normal.
Translate the first point of the poly with the rotated and translated matrix to get the updated vert location.
Get the dot product of the updated normal with the updated vert for the "d" value.
To determine if the poly is on the front side of camera, I finally dot the camera out vector with the updated normal minus the distance.

And that is what I am doing for back face culling.
That will work, but it is very inefficient:

>Take the originally calculated normal of a poly and multiplying it with that
>rotation only matrix to get the updated normal.
>Translate the first point of the poly with the rotated and translated matrix to
>get the updated vert location.
> Get the dot product of the updated normal with the updated vert for the "d" value.

Rather, take the inverse transformation matrix and apply it to the camera. Once the camera is in object space you can use pre-generated plane equations. This way you only have to do one matrix multiplication (and 1 inverse computation).
Thanks Crowley, you've been super helpful.
About this:

"Once the camera is in object space you can use pre-generated plane equations."

Not sure what you mean from here. I can get the camera in object space. But not sure what you mean from there....
Once the camera is in object space, you can use the plane equation stored with each triangle. This way you don't have to transform any normals or recompute any plane constants.

This topic is closed to new replies.

Advertisement