About Backface Culling

Started by
0 comments, last by Muhammad Haggag 17 years ago
I have read the following post and have some problems that I would like to ask. http://www.gamedev.net/reference/articles/article1088.asp int i; Vector normal, // the polygon normal camera(0,0,0), // the camera at 0,0,0 cv; // the camera vector (or view vector) // Loop through all the polygons for(i = 0; i < faces; i++) { // Transform our normal to view space... // This example assumes you've already precalculated the normal and // so all you must do is rotate it into world space by your matrix. // See my vector tutorial on how to calculate a polygon normal. normal = *face.normal; normal = normal * to_world_space; // Now calculate a vector from the camera to any point on the polygon cv.set(camera, world_space[ face.vertex[0] ] ); // Now calculate the dot product of the normal and the camera vector if((cv.dot(&normal) > 0)) { // draw the polygon here, it's visible } } I wonder how can I get the "to_world_space"? and world_space[ face.vertex[0] ] )? ( how to change the face's vertex to world space?) Can you give me some example? And how can I change the points of a Mesh that I read from .obj or .off to World Space? Actually, I am not very familiar with transforming something to World space and then to Camera space. Can you give me some example as well. Thanks.
Advertisement
Your first post was not deleted, but moved here in For Beginners. Please follow up there.

This topic is closed to new replies.

Advertisement