Identifying a depth mesh on mesh jaggy

Started by
5 comments, last by InvalidPointer 13 years, 2 months ago
Hi there,

I initially thought this was an artifact of my projected textures but between 1024-8192 there is no difference in jaggy quality so I ruled that out. The distance between the two static meshes being drawn and the eye has a direct correlation with the extent to which the two meshes have a sawtooth at their joining point which is much more pronounced than the edges on meshes that are not touching. It is almost like a depth issue but all other When you get closer its nice and smooth and the further away the more pronounced the jag. I cannot figure out why the depth between the eye and these two meshes join causes a staircase effect that varies in detail. If it was to do with the screen space blur or the light shadow map detail it would not change size based on eye position and if it was to do with the screen sized calculations it would in some way be blurred.

[attachment=1486:identify.jpg]

I would post shader code but its very long, I figure a picture and description would be easier as a means of identifying the issue.

I am aware that any sane person would use a shadow cage to do lossless depth shading for something acting like the sun but I do not have time to implement that and get my physics engine and car online.

Any suggestions to a cause?

Enlightened One
Advertisement
Sounds/looks like Z precision? What's your scene depth range?
clb: At the end of 2012, the positions of jupiter, saturn, mercury, and deimos are aligned so as to cause a denormalized flush-to-zero bug when computing earth's gravitational force, slinging it to the sun.
These are the D3DDevice creation parameters:

[font="Consolas"][font="Consolas"]d3dpp.BackBufferFormat = d3ddm.Format; (XRGB)
[/font][/font][font="Consolas"][font="Consolas"]d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.BackBufferCount = 1;
d3dpp.Windowed = boolWindowed;
d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
d3dpp.EnableAutoDepthStencil = TRUE;
d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
d3dpp.Flags = D3DPRESENTFLAG_DISCARD_DEPTHSTENCIL;

All depth of precision uses [font="Consolas"][font="Consolas"]D3DFMT_D16.
[/font][/font]
[font="Consolas"][font="Consolas"][font="Consolas"][font="Consolas"]Light z textures get this creation setup
[font="Consolas"][font="Consolas"][font="Consolas"][font="Consolas"][/font][/font][/font][/font]hr = pd3dDevice->CreateTexture(SHADOWQUALITYRESOLUTION, SHADOWQUALITYRESOLUTION, 1, D3DUSAGE_RENDERTARGET,
D3DFMT_R32F, D3DPOOL_DEFAULT, &pd3dTexShadowMapRT, NULL);
[/font][/font]
All ping pong surfaces get this

//So this is where the ping point lights accumulate
[font="Consolas"][font="Consolas"]hr = pd3dDevice->CreateTexture(intScreenWidth, intScreenHeight, 1, D3DUSAGE_RENDERTARGET,
D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &pd3dTexPingPong1MapRT, 0);[/font][/font]

//This is the same for all depth surfaces
hr = pd3dDevice->CreateDepthStencilSurface(SHADOWQUALITYRESOLUTION, SHADOWQUALITYRESOLUTION,
D3DFMT_D16, D3DMULTISAMPLE_NONE, 0, TRUE, &pd3dSurfShadowDepthRT, 0);

I tried raising this value to D3DFMT_32 but a call failed so I am guessing its too deep. I know the artifact is there when the three lights are combined in their batch together as I can draw that out easily.

[attachment=1492:jaggies.jpg]

Oh yes and the maximum view distance the far plane is

[font="Consolas"][color="#0000ff"][font="Consolas"][color="#0000ff"][font="Consolas"][color="#0000ff"]const[/font][/font][/font][font="Consolas"][font="Consolas"] [/font][/font][font="Consolas"][color="#0000ff"][font="Consolas"][color="#0000ff"][font="Consolas"][color="#0000ff"]float[/font][/font][/font][font="Consolas"][font="Consolas"] MAXVIEWDISTANCE = 5000.0f;

the near plane is 1.0

[/font][/font][/font][/font][/font][/font]
I read what you said and my mind switched from fault in rendering textures to idiotic rendering strategy. After googling scene depth range I wound up here http://msdn.microsoft.com/en-us/library/aa915211.aspx and after making the near plane 10.0 the issue was resolved completely!

Thank you I would never have turned around and reviewed my camera class without that cue :)

EnlightenedOne

Don't use 16-bit depth, either, it has terrible precision and additionally can have iffy early-Z support. Try using D24S8 instead.
clb: At the end of 2012, the positions of jupiter, saturn, mercury, and deimos are aligned so as to cause a denormalized flush-to-zero bug when computing earth's gravitational force, slinging it to the sun.
What does the S stand for? Is D24_S a common depth format which moderate to good hardware will all support GPU wise?

I am switching to it now thanks for the help.
Stencil buffer, and yes. In fact, I believe it actually has better support than D16 does (but don't quote me on that :)) due to the nice 32bpp size.
clb: At the end of 2012, the positions of jupiter, saturn, mercury, and deimos are aligned so as to cause a denormalized flush-to-zero bug when computing earth's gravitational force, slinging it to the sun.

This topic is closed to new replies.

Advertisement