Jump to content
  • Advertisement
Sign in to follow this  
cedricmobile

About Backface Culling

This topic is 4273 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

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.

Share this post


Link to post
Share on other sites
Advertisement

This topic is 4273 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.

Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!