Use correct screen-space to ndc equation in Compatibility refraction#110684
Use correct screen-space to ndc equation in Compatibility refraction#110684Repiteo merged 1 commit intogodotengine:masterfrom
Conversation
There was a problem hiding this comment.
Using RS::get_singleton()->is_low_end() will change the created code depending on the current rendering driver, which means that if you convert a BaseMaterial3D to a ShaderMaterial while using Compatibility, it will break on Forward+/Mobile and vice versa. This is an issue if you switch rendering methods during development, or even if an automatic fallback is applied on the user's device.
We should use the shader preprocessor instead, but it's currently broken when used in BaseMaterial3D (as I mentioned in #87486 (comment)).
|
@Calinou Ah yes forgot about that. Unfortunately I don't think the shader preprocessor is ran for materials as they call The way I am thinking of working around this would be:
Unsure if this is the best solution though. |
5587a89 to
6faade1
Compare
|
EDIT: Went with clayjohn's solution of using |
6faade1 to
96ca7a2
Compare
|
Thanks! |
Converting from screen-space coordinates to ndcs use a different equation in OpenGL as compared to Vulkan. This incorrect equation breaks refraction in Compatibility.
Closes #106213