Jump to content
  • Advertisement
Sign in to follow this  
Keith P Parsons

Tessellated ocean with no culling artifacts.

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

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);
}

Edited by Keith P Parsons

Share this post


Link to post
Share on other sites
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'?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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]

Share this post


Link to post
Share on other sites

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.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!