Fixed MIP depth write.
This commit is contained in:
Родитель
1fecae6908
Коммит
6ef93e1a49
|
@ -261,6 +261,7 @@
|
||||||
float stepSize = 1.0 / NUM_STEPS;
|
float stepSize = 1.0 / NUM_STEPS;
|
||||||
|
|
||||||
float maxDensity = 0.0f;
|
float maxDensity = 0.0f;
|
||||||
|
float3 maxDensityPos = rayStartPos;
|
||||||
for (uint iStep = 0; iStep < NUM_STEPS; iStep++)
|
for (uint iStep = 0; iStep < NUM_STEPS; iStep++)
|
||||||
{
|
{
|
||||||
const float t = iStep * stepSize;
|
const float t = iStep * stepSize;
|
||||||
|
@ -272,15 +273,18 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const float density = getDensity(currPos);
|
const float density = getDensity(currPos);
|
||||||
if (density > _MinVal && density < _MaxVal)
|
if (density > maxDensity && density > _MinVal && density < _MaxVal)
|
||||||
maxDensity = max(density, maxDensity);
|
{
|
||||||
|
maxDensity = density;
|
||||||
|
maxDensityPos = currPos;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write fragment output
|
// Write fragment output
|
||||||
frag_out output;
|
frag_out output;
|
||||||
output.colour = float4(1.0f, 1.0f, 1.0f, maxDensity); // maximum intensity
|
output.colour = float4(1.0f, 1.0f, 1.0f, maxDensity); // maximum intensity
|
||||||
#if DEPTHWRITE_ON
|
#if DEPTHWRITE_ON
|
||||||
output.depth = localToDepth(i.vertexLocal);
|
output.depth = localToDepth(maxDensityPos - float3(0.5f, 0.5f, 0.5f));
|
||||||
#endif
|
#endif
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче