• Advertisement
Sign in to follow this  

Artefacts using big model

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

Hello,

 

I am using DX 11 for rendering. With snall objects everything is OK, but with big objects appears some strange behavior. Some triangles began to disappear and appear chaotically during camera movement. More detail you can see on the attached screenshots.

Length of the ship is 3km, but it has only 15000 triangles.

 

Does someone know what is the problem here? Maybe someone already faced with something similar?

Share this post


Link to post
Share on other sites
Advertisement

Hm, looks like this was the reason. I set 

screenDepth = 60000.0f;
screenNear = 1.0f;

and everything seems OK, but I cannot understand how in that case render a big/huge maps, for example, for a hundred of thousands km of space? Because of screen depth it cannot be rendered. What I must do in that case?

Edited by BlackJoker

Share this post


Link to post
Share on other sites

TiagoCosto's article is the best you get with direct hardware support. For bigger scenes (above the effective accuracy of a logarithmic/floating-point depth buffer, you need to partition the objects in your scene into depth ranges, and render each range with it's own projection matrix with the near/far planes adjusted.

Share this post


Link to post
Share on other sites

Hm, looks like this was the reason. I set 

screenDepth = 60000.0f;
screenNear = 1.0f;

and everything seems OK, but I cannot understand how in that case render a big/huge maps, for example, for a hundred of thousands km of space? Because of screen depth it cannot be rendered. What I must do in that case?

Short story, we cheat.

 

Long story: Oh no, I won't go into detail. But we use advanced rendering techniques to maximize precision (such as the ones in Outterra blog). Here's another (advanced, not sure if good for a newbie) slide: Rendering vast worlds.

We also render what's far away using 2D billboards instead of actual 3D geometry (the billboard is called impostor because we render the 3D to a texture and then display that texture as a billboard) and stuff like that, or just use fog, etc to hide artifacts.

Very people prefer to render the scene in two passes (2 depth buffers, what's close in one pass, what's far in the other one) and then composite both. It's troublesome but does the job.

Share this post


Link to post
Share on other sites

Thanks to all for help. It is very interesting. I didn`t now about such techniques. Please, say, if I want to render a huge map, I also could you 3 and more projection matrices for that? But I don`t know how it would display on screen in such case. Will I see all the objects I render in this case on all distances or some of them I would not see?

Share this post


Link to post
Share on other sites

Thanks to all for help. It is very interesting. I didn`t now about such techniques. Please, say, if I want to render a huge map, I also could you 3 and more projection matrices for that? But I don`t know how it would display on screen in such case. Will I see all the objects I render in this case on all distances or some of them I would not see?

You can render a terrain in multiple regions, sorted by their distance to the viewer. I've done this for a quick clipmap terrain prototype, but while it can be made to work, the depth interactions at region edges can get a little sticky...

Space scenes (which came up earlier in the thread?) are generally much simpler, because they are fairly sparsely populated. You can reasonably sort the entire list of objects from back-to-front, customise the near/far planes for each one, and then just draw them out in order.

Share this post


Link to post
Share on other sites

Could please someone give a simple example with logarithmic depth buffer for DirectX 11, because from the article hard to understand how to implement it?

Edited by BlackJoker

Share this post


Link to post
Share on other sites

Hm, looks like this was the reason. I set 

screenDepth = 60000.0f;
screenNear = 1.0f;

and everything seems OK, but I cannot understand how in that case render a big/huge maps, for example, for a hundred of thousands km of space? Because of screen depth it cannot be rendered. What I must do in that case?

 

It's worth pointing out the depth buffer being normally non-linear,  changing the near clip makes a huge difference compared to moving the far.

So you want to push the near as far forward as possible, but this depends on how close you camera will be to objects in the scene. The far does matter, but getting the near correct is most important. Also remeber you say 3km, but you mean 3k of unitys as scale is arbitrary.

Share this post


Link to post
Share on other sites

mikiex,

 

Thaks for clarification, but I want that camera will be as close to object as possible. Do you know something about logarithmic depth buffers. I tried to find an example for DX 11, but I din`t find any code example for it. 

Share this post


Link to post
Share on other sites

mikiex,

 

Thaks for clarification, but I want that camera will be as close to object as possible. Do you know something about logarithmic depth buffers. I tried to find an example for DX 11, but I din`t find any code example for it. 

 

Close as possible is your eyeball touching the surface a near clip of 0 :) I don't know anything about log depth buffers other than the concept exists, certainly DX11 would make things like this possible I am sure. Consider though not many games in the past have bothered to come up with a physically correct solution, yes its been a matter of contention but every project I've worked on we have managed to work around this issue by faking it.

Share this post


Link to post
Share on other sites

Could please someone give a simple example with logarithmic depth buffer for DirectX 11, because from the article hard to understand how to implement it?

 

 

Add this line to the end of the vertex shader after the projection multiply.

 

out.Position.z = log(C*out.Position.z + 1) / log(C*Far + 1) * out.Position.w;

 

where C is a constant used to choose the resolution near the camera: try it with C = 1.0f.

and Far is the far plane distance used to create the projection matrix.

Share this post


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

  • Advertisement