Slightly improved water for deferred shading by enabling depth write

This commit is contained in:
dexy 2021-05-05 19:05:18 +10:00
parent 4e987e523a
commit 458e9d365e

View File

@ -521,21 +521,8 @@ namespace CodeWalker.Rendering
context.OutputMerger.BlendState = bsDefault;
context.Rasterizer.State = wireframe ? rsWireframeDblSided : rsSolidDblSided;
context.OutputMerger.DepthStencilState = dsDisableWrite;
for (int i = 0; i < RenderBuckets.Count; i++) //water pass
{
var bucket = RenderBuckets[i];
if (bucket.WaterBatches.Count > 0)
{
RenderGeometryBatches(context, bucket.WaterBatches, Water);
}
if (bucket.Water2Batches.Count > 0)
{
RenderGeometryBatches(context, bucket.Water2Batches, Water);
}
}
if (RenderWaterQuads.Count > 0) //also render water quads here
context.OutputMerger.DepthStencilState = dsEnabled;
if (RenderWaterQuads.Count > 0) //render water quads
{
Water.SetShader(context);
Water.SetSceneVars(context, Camera, Shadowmap, GlobalLights);
@ -545,6 +532,24 @@ namespace CodeWalker.Rendering
}
Water.UnbindResources(context);
}
for (int i = 0; i < RenderBuckets.Count; i++) //main water geoms pass
{
var bucket = RenderBuckets[i];
if (bucket.WaterBatches.Count > 0)
{
RenderGeometryBatches(context, bucket.WaterBatches, Water);
}
}
context.OutputMerger.DepthStencilState = dsDisableWrite;
for (int i = 0; i < RenderBuckets.Count; i++) //water decals pass
{
var bucket = RenderBuckets[i];
if (bucket.Water2Batches.Count > 0)
{
RenderGeometryBatches(context, bucket.Water2Batches, Water);
}
}