mirror of
https://github.com/overte-org/overte.git
synced 2025-07-23 21:43:58 +02:00
Fixed small bug due to half texel offset in outline shader
This commit is contained in:
parent
0f120a1a2a
commit
43f9db5b70
3 changed files with 7 additions and 7 deletions
|
@ -35,16 +35,14 @@ void main(void) {
|
||||||
// We offset by half a texel to be centered on the depth sample. If we don't do this
|
// We offset by half a texel to be centered on the depth sample. If we don't do this
|
||||||
// the blur will have a different width between the left / right sides and top / bottom
|
// the blur will have a different width between the left / right sides and top / bottom
|
||||||
// sides of the silhouette
|
// sides of the silhouette
|
||||||
vec2 halfTexel = getInvWidthHeight() / 2;
|
float outlinedDepth = texture(outlinedDepthMap, varTexCoord0).x;
|
||||||
vec2 texCoord0 = varTexCoord0+halfTexel;
|
|
||||||
float outlinedDepth = texture(outlinedDepthMap, texCoord0).x;
|
|
||||||
float intensity = 0.0;
|
float intensity = 0.0;
|
||||||
|
|
||||||
if (outlinedDepth < FAR_Z) {
|
if (outlinedDepth < FAR_Z) {
|
||||||
// We're not on the far plane so we are on the outlined object, thus no outline to do!
|
// We're not on the far plane so we are on the outlined object, thus no outline to do!
|
||||||
<@if IS_FILLED@>
|
<@if IS_FILLED@>
|
||||||
// But we need to fill the interior
|
// But we need to fill the interior
|
||||||
float sceneDepth = texture(sceneDepthMap, texCoord0).x;
|
float sceneDepth = texture(sceneDepthMap, varTexCoord0).x;
|
||||||
// Transform to linear depth for better precision
|
// Transform to linear depth for better precision
|
||||||
outlinedDepth = -evalZeyeFromZdb(outlinedDepth);
|
outlinedDepth = -evalZeyeFromZdb(outlinedDepth);
|
||||||
sceneDepth = -evalZeyeFromZdb(sceneDepth);
|
sceneDepth = -evalZeyeFromZdb(sceneDepth);
|
||||||
|
@ -55,6 +53,8 @@ void main(void) {
|
||||||
discard;
|
discard;
|
||||||
<@endif@>
|
<@endif@>
|
||||||
} else {
|
} else {
|
||||||
|
vec2 halfTexel = getInvWidthHeight() / 2;
|
||||||
|
vec2 texCoord0 = varTexCoord0+halfTexel;
|
||||||
float weight = 0.0;
|
float weight = 0.0;
|
||||||
vec2 deltaUv = params._size / params._blurKernelSize;
|
vec2 deltaUv = params._size / params._blurKernelSize;
|
||||||
vec2 lineStartUv = texCoord0 - params._size / 2.0;
|
vec2 lineStartUv = texCoord0 - params._size / 2.0;
|
||||||
|
@ -72,7 +72,7 @@ void main(void) {
|
||||||
{
|
{
|
||||||
outlinedDepth = texture(outlinedDepthMap, uv).x;
|
outlinedDepth = texture(outlinedDepthMap, uv).x;
|
||||||
intensity += (outlinedDepth < FAR_Z) ? 1.0 : 0.0;
|
intensity += (outlinedDepth < FAR_Z) ? 1.0 : 0.0;
|
||||||
weight += 1.f;
|
weight += 1.0;
|
||||||
}
|
}
|
||||||
uv.x += deltaUv.x;
|
uv.x += deltaUv.x;
|
||||||
}
|
}
|
||||||
|
|
|
@ -446,7 +446,7 @@ void DrawOutlineTask::build(JobModel& task, const render::Varying& inputs, rende
|
||||||
auto shapePlumber = std::make_shared<ShapePlumber>();
|
auto shapePlumber = std::make_shared<ShapePlumber>();
|
||||||
{
|
{
|
||||||
auto state = std::make_shared<gpu::State>();
|
auto state = std::make_shared<gpu::State>();
|
||||||
state->setDepthTest(true, true, gpu::LESS);
|
state->setDepthTest(true, true, gpu::LESS_EQUAL);
|
||||||
state->setColorWriteMask(false, false, false, false);
|
state->setColorWriteMask(false, false, false, false);
|
||||||
state->setScissorEnable(true);
|
state->setScissorEnable(true);
|
||||||
initMaskPipelines(*shapePlumber, state);
|
initMaskPipelines(*shapePlumber, state);
|
||||||
|
|
|
@ -33,7 +33,7 @@ Item {
|
||||||
integral: false
|
integral: false
|
||||||
config: root.drawConfig
|
config: root.drawConfig
|
||||||
property: "width"
|
property: "width"
|
||||||
max: 15.0
|
max: 5.0
|
||||||
min: 0.0
|
min: 0.0
|
||||||
width: 280
|
width: 280
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue