Implement screen-space framebuffer copy for refraction and other effects #48
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Refract materials and other Source shaders sample a
_rt_PowerOfTwoFBrender target — a copy of the current framebuffer used for screen-space effects like refraction, distortion, and glass. We currently have no framebuffer copy mechanism, so refract materials fall back to a semi-transparent tinted overlay with no actual distortion.Visible in
shader_test_01— refract cubes should distort the caution tape and scene behind them, but instead appear as flat colored blocks.What's needed
$refractamount).Source engine approach
Source copies the framebuffer to
_rt_PowerOfTwoFBonce per frame, then refract/distortion shaders sample it with UV offsets derived from the normal map. The copy happens after opaque rendering but before translucent rendering.Other shaders that use this
Refract/PortalRefract— primary consumers$BASETEXTUREset to_rt_PowerOfTwoFBRelated