Public Group

# How to tansform normal and vertices to World Space?

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

## Recommended Posts

Here are the variables we will need to backface cull in Object Space. Code: //the Camera Position World Space. cam_z cam_y cam_z //the Objects Orientation matrix. (ie final rotational state) objM //the position of the object in World Space. obj_x obj_y obj_z //a point on the plane/face that is being culled. (Object Space)face_x face_y face_z //the plane/face normal (calculated in Object Space once at start-up) face_norm_x face_norm_y face_norm_z Now for doing the calcs. Code: //first the Camera Object displacement (vector from camera to object) var Dx = obj_x - cam_x; var Dy = obj_y - cam_y; var Dz = obj_z - cam_z; // rotate the camera into Object Space (use the inverse of the displacement and the object Matrix) var newCamx = -Dx * objM.xx + -Dy * objM.xy + -Dz * objM.xz; var newCamy = -Dx * objM.yx + -Dy * objM.yy + -Dz * objM.yz; var newCamz = -Dx * objM.zx + -Dy * objM.zy + -Dz * objM.zz; //now get a vector from the plane/face to the camera var fx=newCamx - face_x; var fy=newCamy - face_y; var fz=newCamz - face_z; //and finally do the backface culling (take the dot product) if((fx*face_norm_x + fy*face_norm_y + fz*face_norm_z) >0) { //face is visible and NOT backface culled} I want to know how can I get the followings: cam_z cam_y cam_z objM obj_x obj_y obj_z is cam_z cam_y cam_z = Camera direction in camera space can be transformed to world coordinate space by multiplying transpose of model view matrix ? How to get objM then? abd how about obj_x obj_y obj_z ? Please help, thanks.

1. 1
Rutin
30
2. 2
3. 3
4. 4
5. 5

• 13
• 13
• 11
• 10
• 14
• ### Forum Statistics

• Total Topics
632961
• Total Posts
3009494
• ### Who's Online (See full list)

There are no registered users currently online

×