Jump to content

  • Log In with Google      Sign In   
  • Create Account

Cascaded Shadow Map Geometry Shader Frustum Culling


Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
3 replies to this topic

#1 Alundra   Members   -  Reputation: 1990

Like
0Likes
Like

Posted 03 July 2014 - 06:46 AM

Hi all,

Using a geometry shader you can render using one draw call all partitions but you send triangle 4 times if you have 4 partitions.

Is it ok to stay with that or a frustum culling is needed to set the good index ?

What is the more efficient way ?

Thanks for the help



#2 Hodgman   Moderators   -  Reputation: 48398

Like
0Likes
Like

Posted 03 July 2014 - 08:38 AM

Using the geometry shader is more efficient for the CPU-side, because you only submit the commands once.

Not using the geometry shader is more efficient for the GPU-side, because you can do per-object culling via the CPU (and because GS's are often slow tongue.png).



#3 kauna   Crossbones+   -  Reputation: 2918

Like
1Likes
Like

Posted 03 July 2014 - 09:11 AM

One way is to draw multiple instances of each mesh depending in which frustums they are visible. The geometry shader can be used to define the output slice of a shadow texture array. This way the draw commands are submitted only once and the geometry shader is almost a simple pass through shader and no extra geometry is generated.

 

Cheers!



#4 Alundra   Members   -  Reputation: 1990

Like
0Likes
Like

Posted 04 July 2014 - 09:33 AM

Here the geometry shader :

struct GS_OUTPUT
{
  float4 Position : SV_POSITION;
  uint RT_Index   : SV_RenderTargetArrayIndex;
};

cbuffer CASCADED_SHADOW_CBUFFER : register( b0 )
{
  float4x4 ViewProjection[4];
};

[maxvertexcount(12)]
void main(triangle float4 InPos[3] : SV_Position, inout TriangleStream<GS_OUTPUT> OutStream)
{
  for(uint i = 0; i < 4; ++i )
  {
    GS_OUTPUT Output;
    Output.RT_Index = i;
    for(int v = 0; v < 3; v++ )
    {
      Output.Position = mul(InPos[v], ViewProjection[i]);
      OutStream.Append(Output);
    }
    OutStream.RestartStrip();
  }
}

The culling has to be done here, since it's cascaded shadow, maybe the same code used to have the good cascade index can be used.






Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.




PARTNERS