Fix effect shaders for backend Y-convention differences
Effect shaders have two UV varyings with different Y-axis conventions:
- INPUT_UV (qt_inputUV): raw framebuffer UV. On OpenGL y=0 is at the
visual bottom; on Vulkan/D3D/Metal y=0 is at the visual top.
- TEXTURE_UV (qt_textureUV): corrected by qt_effectTextureMapUV so that
y=0 is always at the visual bottom on all backends.
FRAMEBUFFER_Y_UP (qt_rhi_properties.x) is +1 on OpenGL and -1 on
Vulkan/D3D/Metal, providing a sign factor for converting between
INPUT_UV space and screen space.
Changes:
PNG texture sampling — use TEXTURE_UV instead of INPUT_UV:
- chromaticaberration.frag: maskTexture is a PNG
- brushstrokes.frag: noiseSample is a PNG
- scatter.frag: noiseSample is a PNG
Screen-space gradient direction:
- additivecolorgradient.frag: use TEXTURE_UV.y as the mix factor so
topColor appears at the visual top (y=1 in TEXTURE_UV space) on all
backends
Distortion center Y-convention:
- distortion.vert, distortionripple.frag, distortionsphere.frag,
distortionspiral.frag: the user-facing center property is in screen
space (y=0 at top). Convert to INPUT_UV space using
center_adj.y = 0.5 + (center.y - 0.5) * (-FRAMEBUFFER_Y_UP)
Emboss light direction:
- emboss.frag: replace INPUT_UV.y - step_h with
INPUT_UV.y + step_h * FRAMEBUFFER_Y_UP so the offset always points
toward the visual top regardless of backend
TiltShift and DepthOfField Poisson/box kernel Y-direction:
- downsample.vert, poissonblurtiltshift.vert, depthoffieldblur.vert:
multiply Y offsets by yFlip = -FRAMEBUFFER_Y_UP so that a positive
kernel Y increment always moves toward the visual bottom
- downsampletiltshift.frag, poissonblurtiltshift.frag: convert
inTexCoord.y to screen space before comparing with focusPosition
(which is in screen space with y=0 at top)
Swirl rotation direction — multiply rotation angle by FRAMEBUFFER_Y_UP
so the effect rotates in the same visual direction on all backends:
- examples/quick3d/customeffect/effect2.frag
- tests/baseline/data/effects/custom_effect_simple_1.frag
Vertex Y-shift direction:
- tests/baseline/data/effects/custom_effect_simple_2.vert: multiply
by FRAMEBUFFER_Y_UP so the quad moves in the same screen direction
on all backends
Documentation code examples:
- src/quick3d/doc/src/qtquick3d-custom.qdoc: fix swirl rotation
angle to multiply by FRAMEBUFFER_Y_UP
- src/quick3d/qquick3deffect.cpp: same fix in the Effect class doc
example
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Pick-to: 6.12 6.11 6.8
Change-Id: I001fd11344afda27e18aea7a897254e7e1d2744b
Reviewed-by: Kristoffer Skau <kristoffer.skau@qt.io>