mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 11:07:07 +02:00
Adjustments to half texel fix
This commit is contained in:
parent
b43514fb8b
commit
2003495166
1 changed files with 8 additions and 6 deletions
|
@ -32,14 +32,19 @@ const float OPACITY_EPSILON = 5e-3;
|
||||||
<@func main(IS_FILLED)@>
|
<@func main(IS_FILLED)@>
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
float outlinedDepth = texture(outlinedDepthMap, varTexCoord0).x;
|
// 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
|
||||||
|
// sides of the silhouette
|
||||||
|
vec2 halfTexel = getInvWidthHeight() / 2;
|
||||||
|
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, varTexCoord0).x;
|
float sceneDepth = texture(sceneDepthMap, texCoord0).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);
|
||||||
|
@ -56,10 +61,7 @@ void main(void) {
|
||||||
} else {
|
} else {
|
||||||
float weight = 0.0;
|
float weight = 0.0;
|
||||||
vec2 deltaUv = params._size / params._blurKernelSize;
|
vec2 deltaUv = params._size / params._blurKernelSize;
|
||||||
// We offset by half a texel to be centered on the depth sample. If we don't do this
|
vec2 lineStartUv = texCoord0 - params._size / 2.0;
|
||||||
// the blur will have a different width between the left / right sides and top / bottom
|
|
||||||
// sides of the silhouette
|
|
||||||
vec2 lineStartUv = varTexCoord0 + (getInvWidthHeight() - params._size) / 2.0;
|
|
||||||
vec2 uv;
|
vec2 uv;
|
||||||
int x;
|
int x;
|
||||||
int y;
|
int y;
|
||||||
|
|
Loading…
Reference in a new issue