Jump to content
  • Advertisement
Sign in to follow this  
CRACK123

Rendering issues

This topic is 4930 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, I am trying to render a 3ds model - I am batching it per material basis. However it seems to have artifacts on rendering:- This is my Init code
	glClearColor(0, 0, 0, 0);
	glEnable(GL_COLOR_MATERIAL);
	glEnable(GL_LIGHTING);
	glEnable(GL_LIGHT0);
	glEnable(GL_DEPTH_TEST);
	glEnable(GL_TEXTURE_2D);
	glCullFace(GL_BACK);
	glEnable(GL_CULL_FACE);
	glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);

Any idea on how I can fix this ? I am not doing any kind of culling. Thanks

Share this post


Link to post
Share on other sites
Advertisement
Z fighting ( difference in depth buffer for two points are smaller than resolution of depth buffer... ) You can see this problem in some commercial games like Medal Of Honor (Q3 engine) if you turn 16-bit rendering instead of 32b ( switches z-buffer from 24b-16b ). Try changing depth buffer to 24b, or scale down youre models.... hope i helped, bye.

Share this post


Link to post
Share on other sites
Near and far are 0.1f - 1000.0f. I changed to 24 and 32 bit. Its a lot better in that mode but artifacts still exists.

Thanks

Share this post


Link to post
Share on other sites
Quote:
Original post by CRACK123
Near and far are 0.1f - 1000.0f. I changed to 24 and 32 bit. Its a lot better in that mode but artifacts still exists.

Thanks


Change near to 1.0 and keep far at 1000.0 or change far to 100 and keep the near. The ratio between the two shouldn't exceed 1:1000.

HTH

Share this post


Link to post
Share on other sites
Whats the reason that it should be only 1000 ? Also in many cases I have seen people using 1.0, 4000.0f etc -> this means ratio is 1:4000 ?

Share this post


Link to post
Share on other sites
I use 1 to 1000, I haven't seen any Z-fighting in my stuff yet. You could get away with 1 to 4000, but if you have verts that are really close, they'll fight it out.

Share this post


Link to post
Share on other sites
you can change the near and far dynamically to help your rendering. There really is no reason to waste empty space. Just set the near to a bit smaller than the nearest vertex in the fov and set the far to a bit higher than the object with the greatest distance in the fov.

You don't need to change this every frame but often enough to help solve your problem. Obviously you will have to make sure to keep track of objects and how to set the near and far during motion too.

Share this post


Link to post
Share on other sites
One issue to be aware of with the Z buffer is that it is not a linear scale. This means closer to the near plane, it has a greater precision than close to the far plane.

Also, pushing the near plane further out has a much more dramatic effect than bringing the far plane closer to you.

Read this page. It is very very useful, and has a nice applet thing to show you the results of different parameters: Learning to Love your Z-Buffer..

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!