instanced g buffer draws work now

instancing
cosmonaut 2020-12-07 14:42:02 -08:00
parent b784f9df4b
commit 283b078641
4 changed files with 9 additions and 9 deletions

BIN
Effects/FXB/DeferredPBR_GBufferEffect.fxb (Stored with Git LFS)

Binary file not shown.

View File

@ -26,7 +26,7 @@ struct VertexInput
struct InstanceInput
{
float4x4 World : COLOR0;
float4x4 World : TEXCOORD2;
};
struct PixelInput
@ -69,7 +69,7 @@ PixelInput instanced_vs(VertexInput input, InstanceInput instanceInput)
output.NormalWorld = normalize(mul(input.Normal, instanceInput.World));
output.TexCoord = input.TexCoord;
float4x4 worldViewProjection = mul(World, ViewProjection);
float4x4 worldViewProjection = mul(instanceInput.World, ViewProjection);
output.Position = mul(input.Position, worldViewProjection);
return output;

View File

@ -8,7 +8,7 @@ namespace Kav
{
public class Renderer
{
private const int MAX_INSTANCE_VERTEX_COUNT = 1000000;
private const int MAX_INSTANCE_VERTEX_COUNT = 1000;
private const int MAX_SHADOW_CASCADES = 4;
private int ShadowMapSize { get; }

View File

@ -6,10 +6,10 @@ namespace Kav
{
public static VertexDeclaration GBufferInstanceDeclaration = new VertexDeclaration
(
new VertexElement(0, VertexElementFormat.HalfVector4, VertexElementUsage.Color, 0),
new VertexElement(16, VertexElementFormat.HalfVector4, VertexElementUsage.Color, 1),
new VertexElement(32, VertexElementFormat.HalfVector4, VertexElementUsage.Color, 2),
new VertexElement(48, VertexElementFormat.HalfVector4, VertexElementUsage.Color, 3)
new VertexElement(0, VertexElementFormat.Vector4, VertexElementUsage.TextureCoordinate, 2),
new VertexElement(16, VertexElementFormat.Vector4, VertexElementUsage.TextureCoordinate, 3),
new VertexElement(32, VertexElementFormat.Vector4, VertexElementUsage.TextureCoordinate, 4),
new VertexElement(48, VertexElementFormat.Vector4, VertexElementUsage.TextureCoordinate, 5)
);
}
}