[ad_1]
I’ve multirendertarget in my deferred pipeline. Curently I’m utilizing independnt RTV mixing to selectively output or not an object to those RTV utilizing the alpha channel. Works superb. But I want to use the alpha channel bits for one thing else.
I’ve begin to consider geometry shader to do the identical. Starting from what we did for rendering cubemap shadow I’ve added a take a look at primarily based on a Flag worth set within the shader contantbuffer related to the thing being rendered. Depending on that Flag I would really like the thing to be drawn in goal 0 and a couple of however not goal 1 for exemple.
But the take a look at is all the time damaging (nothing drawn). The similar buffer fixed is utilized in one other shader so I’m positive it’s appropriately crammed.
Did somebody is aware of what to do?
right here what I’m doing (different structs and inputs not proven however apparent):
cbuffer cbMesh : register(b1)
{
matrix World;
float4 FactorColor;
dword Flag;
float3 pad;
}
struct GS_INPUT
{
float4 Pos : SV_POSITION;
};
struct PS_CUBEMAP_IN
{
float4 Pos : SV_POSITION;
uint RTIndex : SV_RenderTargetArrayIndex;
};
GS_INPUT VS_CubeMap( VS_INPUT enter )
{
GS_INPUT output = (GS_INPUT)0.0f;
output.Pos = mul( float4(enter.Pos,1), World );
return output;
}
#outline SomeValue = 1
[maxvertexcount(18)]
void GS_CubeMap( triangle GS_INPUT enter[3], inout TriangleStream<PS_CUBEMAP_IN> CubeMapStream )
{
for( int f = 0; f < 6; ++f )
{
if ((f<3)&&(Flag&SomeValue)) //works if Flag&SomeValue eliminated
{
matrix M = LightViewProjCube[LightIndex][f];
PS_CUBEMAP_IN output;
output.RTIndex = f;
for( int v = 0; v < 3; v++ )
{
output.Pos = mul( enter[v].Pos, M );
CubeMapStream.Append( output );
}
CubeMapStream.RestartStrip();
}
}
}
[ad_2]