Tessellated ocean with no culling artifacts.

Started by
6 comments, last by ErnieDingo 7 years, 6 months ago

I'm trying to determine which parts of my ocean surface are are under or above water from the camera view. My geometry is created from tessellated quads and SV_IsFrontFace is used in the pixel shader to see if I should use underwater fogging and other effects. The problem is that even well above the ocean surface some pixels are being flagged as back faces when they should not be visible. Does anyone know what might be causing this?

The back faces are rendering in red in the images.

[attachment=33692:ocean2.png]

[attachment=33693:ocean1.png]



float4 OceanMaskPS(bool front : SV_IsFrontFace) : SV_Target
{
if (front)
return float4(1.0 ,0.0, 0.0, 1);
else
return float4(1.0 1.0, 1.0, 1);
}

Advertisement

Why wouldn't backfaces appear in wireframe. Do you mean you are using culling CW or CCW in the shader or that even in solid they show? What do you mean 'even well above ocean surface'?

The wireframe view is just to demonstrate that the image is of a ocean surface. The second image is were I'm having the issue. I'm not culling either side of the ocean triangles but from above I shouldn't be able to see any backface pixels (red) which should only be visible under the ocean.

Nope. Unless you have a perfectly flat ocean there will always be some back-facing triangles.

What depth buffer format are you using? I'd try again with higher precision.

There's only one problem I can think of right now. The normals for some tessellated triangles aren't being computed correctly, which means that they are being computed out of order for the mesh. Check your tessellation code for any errors.

I'm not culling either side of the ocean triangles but from above I shouldn't be able to see any backface pixels (red) which should only be visible under the ocean.

[attachment=33705:ocean.png]

As per what has been highlighted. The diagram drawn shows that yes, you will get backface triangles. But, your zbuffer should be hiding these. As it was asked, what accuracy do you have on your zBuffer? 16 bit, 24 bit?

Just confusing that you would still be seeing these backface triangles. Unless, you are writing to your zbuffer incorrectly. What have you set your backface/frontface culling to? That is, your depth buffer settings.

Indie game developer - Game WIP

Strafe (Working Title) - Currently in need of another developer and modeler/graphic artist (professional & amateur's artists welcome)

Insane Software Facebook

This topic is closed to new replies.

Advertisement