-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor FogVolume, VoxelGI, ReflectionProbe code #54796
Conversation
239390b
to
3eeea74
Compare
I accidentally left an incomplete change in one file that invalidated the tests, could they be restarted please? I'm not familiar with this process. |
Checks run automatically again whenever you (force-)push a commit to your branch.
Yes, as it's the only way to ensure your PR continues to contain a single commit (rather than several) 🙂 |
3eeea74
to
fc81d66
Compare
Thank you, that makes sense (; |
@Calinou Since only one of the tests has failed, and that because of a documentation error, is it possible to accept the suggested changes and/or retry only the failed test? It seems like a waste to restart all of them again when only the failed one is affected by doc changes. |
Why was |
See #54449 (probably there are other related issues as well) - in Godot 3 many of the 3D nodes with a concept of size (as a Vector3) utilised an |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks mostly good! Just a few problems to iron out.
For future reference, it looks like there was agreement to expose size to users instead of extents but to use extents internally where it makes sense (Comment from Akien here)
drivers/gles3/shaders/scene.glsl
Outdated
@@ -263,7 +263,7 @@ void light_compute( | |||
|
|||
uniform highp mat4 refprobe1_local_matrix; | |||
out mediump vec4 refprobe1_reflection_normal_blend; | |||
uniform highp vec3 refprobe1_box_extents; | |||
uniform highp vec3 refprobe1_box_size; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of converting the shader to use use size, you should convert from size to extents before sending to the shader.
That being said, this code is all unused right now and will be rewritten soon. So for now you can just revert all the changes to this file
@@ -5268,7 +5268,7 @@ void RendererSceneRenderRD::init() { | |||
actions.renames["WORLD_POSITION"] = "world.xyz"; | |||
actions.renames["OBJECT_POSITION"] = "params.position"; | |||
actions.renames["UVW"] = "uvw"; | |||
actions.renames["EXTENTS"] = "params.extents"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have changed the name of the parameter, but you didn't change the name in the actual shader (here). So this isn't going to compile. Further, above you are still passing the extents to the shader as you convert size into an extent in the line just above. You will also need to convert the CPU-side uniform to size if you are going to change the shader parameter (here)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, yeah - I had problems with the shader code, partly because I don't fully understand how it's called yet (and I also don't have error detection/squiggles for GLSL currently)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind pointing me towards where the values are passed into the relevant shaders please? I just can't seem to find it, so can't currently fix the input problem (I'm making the shaders use extents
internally again).
By the way, should the visual shader expose extents
(actually in the shader code) or size
to the user?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The visual shader should use the same variable names as the text shader.
The CPU side variable is defined here:
float extents[3]; |
It is set here:
godot/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp
Lines 3964 to 3966 in eb98fd9
volumetric_fog.push_constant.extents[0] = extents.x; | |
volumetric_fog.push_constant.extents[1] = extents.y; | |
volumetric_fog.push_constant.extents[2] = extents.z; |
And in the shader it is defined here:
vec3 extents; |
scene/resources/fog_material.cpp
Outdated
@@ -158,7 +158,7 @@ uniform sampler3D density_texture: hint_white; | |||
void fog() { | |||
DENSITY = density * clamp(exp2(-height_falloff * (WORLD_POSITION.y - OBJECT_POSITION.y)), 0.0, 1.0); | |||
DENSITY *= texture(density_texture, UVW).r; | |||
DENSITY *= pow(clamp(-SDF / min(min(EXTENTS.x, EXTENTS.y), EXTENTS.z), 0.0, 1.0), edge_fade); | |||
DENSITY *= pow(clamp(-SDF / min(min(SIZE.x, SIZE.y), SIZE.z), 0.0, 1.0), edge_fade); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a change in logic as size
is twice as big as extents
.
Thanks, I knew there'd probably be a few issues with my changes - I did my best to understand everything I was dealing with but had trouble with some of it (; |
e8410ad
to
c5e3215
Compare
85f37c9
to
9c1ea56
Compare
I just realised that after using --doctool (thinking it would update the docs and so prevent the unit tests failing due to being outdated by my changes), the quality of the offline documentation has largely been decreased. I'll push a fix for this later; until then, don't worry about the newly missing bits, I wasn't actually intending to remove things like descriptions. |
80c941a
to
097254f
Compare
097254f
to
21db9df
Compare
Refactor FogVolume code Fix FogVolume refactoring Refactor VoxelGI code Refactor ReflectionProbe code
21db9df
to
9b28bce
Compare
@clayjohn Sorry, could you help me with the conflicts please? I don't really understand what's gone wrong, and can't seem to fix it. |
It looks like in rebasing you have picked up changes from unrelated PRs. Can you undo the changes that are not relevant to this PR? |
You're right... I'm just going to delete this branch and copy the relevant changes across. I've tried several times now to fix it and every time it somehow gets more convoluted. |
Superseded by #55178. |
Fix #54449