Game programming

Moderators: None (Apply to moderate this forum)
Number of threads: 2047
Number of posts: 5331

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
3D rendering of only visible faces Posted by zeeshanzia84 on 23 Feb 2009 at 6:08 AM
Hi,

I am actually doing Computer Vision research and have no experience in 3D rendering.

I have a 3D model and I know that the camera is looking at the model from a particular direction, now I want to render only those faces that will be visible from that camera. Can someone please point me to some algorithms for calculating which faces would be visible and which won't be visible.

Thanks a lot in advance.
Report
Re: 3D rendering of only visible faces Posted by codyBane on 10 Mar 2009 at 3:15 PM
It's hard to say whether it's easier to integrate those algorithms into your own application or integrate a game engine's api in your application. Either way if you're still looking for the answer I'd have over to the forums at open source game and rendering engine websites. The real source of info might be opengl.org - otherwise the forums at the Crystalspace 3D Game engine home page or the Ogre3D rendering engine home page. Those should at least give you some ideas if not a good start.


CodyBane++,
web application development
Report
Re: 3D rendering of only visible faces Posted by mmakrzem on 22 Apr 2009 at 11:42 AM
The general approach is this:

Get the vector of the camera's pointing direction.
For each face get its normal. Note there are two normals for each face, the front and the back.

Using the dot product between the normal and the pointing direction you can figure out if the face is point towards or away from the camera. You typically want to cull faces pointed away from the camera if you are rendering a solid volume. If you are using OpenGL or DirectX, this culling is controlled internally but you can enable/disable it manually.

You'll also want to do some frustum culling http://www.flipcode.com/archives/Frustum_Culling.shtml

This will decide which items are in view and which are out of your viewing area.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.