Performance Optimization

Improved volumetric flow performance by orders of magnitude
Cleaned up old raymarching support code
Moved asteroid height calculation to vertex shader
Manual culling for asteroid field render update
This commit is contained in:
Reinier Vens 2022-07-19 18:55:17 +01:00
commit be5e7618d6
52 changed files with 1150 additions and 967 deletions

View file

@ -142,14 +142,9 @@ void Adjust(uint2 tid : SV_DispatchThreadID)
W_out.GetDimensions(dim.x, dim.y);
float2 uv = (tid + float2(.5,.5)) / dim;
float2 globalPosXZ = (uv - .5) * _FluidTransform.z + _FluidTransform.xy;
float2 gravUV = getUV(globalPosXZ);
float3 globalPos = float3(globalPosXZ.x, -tex2Dlod(_NebulaSurfaceHeight, float4(gravUV, 0, 0)).x, globalPosXZ.y);
float2 f = flow(globalPos).xz * (_FluidTransform.z / dim.x);
float2 prevUV = uv - Delta;
//if(any(prevUV<0)||any(prevUV>1))
W_out[tid] = f;
//else W_out[tid] = lerp(U_in.SampleLevel(samplerU_in, prevUV, 0), f, Damping);
if(any(prevUV<0)||any(prevUV>1))
W_out[tid] = 0;
else W_out[tid] = U_in.SampleLevel(samplerU_in, prevUV, 0);
}