-
Notifications
You must be signed in to change notification settings - Fork 134
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
Compatibility renderer support #500
Compatibility renderer support #500
Conversation
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.
Very nice. This is a good one. to be our 500th PR! (edit: oh # 500 means our 500th document including issues and discussions. This is our... 144th PR)
I added a note that it will fix a ticket.
Please also try exporting the demo to webgl. I reviewed code but haven't tested it yet. I'll also test the export.
You can also add some notes to platform.md that it is now supported, and what they need to do for 4.2 and 4.3. And any notes for WebGL as well.
I thought you said 4.2 must use '(vram) uncompressed' before. Here you say 'Lossless'. Do both work? Whichever does, make sure to get the exact name for the documentation and our discord guidance.
94ce9c9
to
15b2ed5
Compare
Im unable to get web export working, i suspect due to needing custom export template build for terrain 3D, or something along those lines. As for textures import settings for 4.2, both options work. I'll add some initial things to platform.md in the mean time. |
|
|
489a96e
to
61290f1
Compare
446b80a
to
257adb7
Compare
I think I need to tidy up the regex stuff a bit still. |
It seems that all the samplers need highp. Including those in uniforms.glsl. |
36be33d
to
d3b9747
Compare
This PR godotengine/godot#85430 should make correctly determining when to use compatibility modifications much simpler. |
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.
Great, thanks for all the updates. I've made a few changes and am squashing now.
src/terrain_3d_material.cpp
Outdated
int idx; | ||
// Insert after render_mode ; | ||
insert_names.clear(); | ||
regex->compile("render_mode[^;]*;"); |
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.
Changed to a non-greedy render_mode.*;?
src/terrain_3d.cpp
Outdated
@@ -745,6 +748,10 @@ Terrain3D::Terrain3D() { | |||
} | |||
break; | |||
} | |||
// check if setting overriden by command line | |||
if (arg.begins_with("--rendering-driver opengl3")) { |
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 doesn't work. --rendering-driver is not included in args.
/c/gd/bin/Godot_v4.2.2-stable_win64_console.exe --rendering-driver opengl3 -e project.godot
reports only "--editor" in the args.
I'm adding a new parameter.
--terrain3d-renderer=compatibility
src/terrain_3d_material.cpp
Outdated
regex->compile("render_mode[^;]*;"); | ||
match = regex->search(code); | ||
if (match.is_valid()) { | ||
_shader_override->set_code(code.insert(match->get_end(), "\n\n" + String(_shader_code["EDITOR_COMPATIBILITY_DEFINES"]))); |
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.
Because the INSERT system grabs trailing newlines, I applied .strip_edges() which cleaned up the extra spaces this was inserting and not removing when switching renderers.
a4a1174
to
5f2f931
Compare
Ok, down to 4 clean, topical commits. Thanks for all the work on this. It will help a lot of people. |
Admin edit:
Fixes #217
Detects whether Godot is using the compatibility renderer.
If so,
The generated shader will have a set of #defines added that allow full support for the standard shader.
The shader override will have the #defines visible at the begining on the shader, before shader_type.
The editor will inject code at the begining, and the end either the standard shader, or any provided override shader
in order to draw a "decal" on the terrain.
in the interest of simplicity, the gdscript changes are as small as possible, tho some things are a bit inneficient,
performace is fine and its only during editing anyways.
The slope tool doesnt have propper decal support.adding terrain3d.get_compatibility() seems a bit dubious to me, but saved repeating a ton of code in gdscript, and ensures that the editor is always on the same page.
Finally, there are no warnings at the moment when the albedo and normal arrays are in compressed mode. for 4.3 this is fixed anyways, but for 4.2 all textures will be black. The workaround is to re-import all textures as "Lossless". Resizing to half resolution results in the same VRAM use for Lossless vs Compressed at the original size.
EDIT: recently updated test version is available: https://github.com/Xtarsia/Terrain3D/actions/runs/11079134556