PDA

View Full Version : GLSL back face culling



fred_em
07-04-2011, 02:18 AM
Hi,

In my GLSL tessellation control shader, I have a plane definition in my hands (origin and normal vector), and I want to accept or reject this plane altogether.

I'm trying to apply the idea exposed in the following document:

http://myweb.lmu.edu/dondi/share/cg/hsr.pdf

but I can't

- understand why the origin of the plane isn't used in the algorithm. It seems important to me ;)
- translate it into code. I need to multiply my normal by an homogeneous matrix (mat4) first. Which one?

Any help appreciated.

Cheers,
Fred

carsten neumann
07-05-2011, 09:43 AM
understand why the origin of the plane isn't used in the algorithm. It seems important to me


The assumption is that the object already passed frustum culling and therefore is "in front of the eye". If you make that assumption, the plane's origin doesn't tell you whether it is facing the eye or not, only the normal is necessary to decide this.



I need to multiply my normal by an homogeneous matrix (mat4) first. Which one?


If you want to have normalized device coordinates (NDC) you need to multiply with the product of modelview and projection matrix and then perform depth division.