Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Austrian Coder

Clipping an mesh against an other one

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

Hi! As far as i know there are 2 ways to render a scene. 1. Order meshes and other stuff back to front and render it in this order. 2. Order mesehes and other stuff front to back and clip each mesh, which will be renderd, against the others and render it. In both methodes culling techniques are done before sorting. The advantage of 2 is that the overdraw is less then in 1. Now i have 2 little questions: 1. What kind of methode are using the professionals? Especially in first person games? 2. Who could i clip a mesh against an other? Thanks, Christian

Share this post


Link to post
Share on other sites
Advertisement
Method 1 is also sometimes called the painters algorithm. It''s more popular for pure-software rendering (eg, the original Quake).

2 is the most common today, when using DX or GL to get a hardware z buffer to do the hard bit for you. Google for z-buffer for starters.

Share this post


Link to post
Share on other sites
You should not worry about the depth clipping, the hardware will do that for you. It uses a zbuffer for that. Have a look at resources for the API you''re using. Z-buffering is typically explained very early in books and SDKs, as it is a fundamental concept of modern 3D graphics.

Although not needed for the visual result, you should still do a rough front to back sort of your objects. Not on face level, an approximate sort on object level is enough. It will allow newer hardware to cull invisible objects faster (early z-rejection).

Share this post


Link to post
Share on other sites
Thanks for that inforamtions. It seems to be quite easy:
1. Enable depth testing
[ in the render loop]
2. Clear Depthbuffer
3. Set depthfunction to less
4. Render scene
5. Swap Buffers
[ End of the render loop]

Share this post


Link to post
Share on other sites
You can (should) move the "3. Set depthfunction to less" step out of the render loop, into the initialization.

[Edit] At least on OpenGL, not sure about D3D.

[edited by - Yann L on January 23, 2003 10:48:20 AM]

Share this post


Link to post
Share on other sites
Gruesse!

Another possible solution would be to write your very own sorting function! Compare the surfaces in the frustum by sorting surface-flags, z-order, ... and give it to qsort(...) as the ''comparison function''. have a look into MSDN!

good luck!

friendly regards from Graz!
- Christoph -


Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!