Skip to content
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

Implement render mode fog_disabled and BaseMaterial3D setting Disable Fog #81286

Merged

Conversation

lemilonkh
Copy link
Contributor

@lemilonkh lemilonkh commented Sep 3, 2023

This fixes #56374 (and its duplicates like #69268).
A new render mode called fog_disabled is added. It can be used in spatial shaders (using render_mode fog_disabled) and from StandardMaterial3D using the new toggle Disable Fog found in the Shading section.

This works for the Forward+, Mobile and Compatibility rendering backends.

Documentation for the new render mode and material setting has been added in this PR: godotengine/godot-docs#7875

Screenshots

Disable Fog setting enabled Disable Fog setting disabled
image image
image image

Minimal reproduction project

The minimal reproduction project from #56374 has been modified to include a DirectionalLight3D (without which the volumetric fog wouldn't render anymore), and the new disable_fog property has been enabled on the unshaded additively blended mesh. I've also enabled the depth-based fog to test the effect on the Mobile and Compatibility render backends as they don't support volumetric fog, and added a cube with a shader material using render_mode unshaded; to demonstrate this working as well.

It can be downloaded here:
Fog_Volume_Additive.zip

@AThousandShips
Copy link
Member

The flag needs to be documented, see the CI errors

@lemilonkh
Copy link
Contributor Author

I'm not quite sure what causes the failure in this pipeline: https://github.com/godotengine/godot/actions/runs/6067098408/job/16458879823?pr=81286
It seems to be related to freeing an invalid key in the the ClassDB?

@AThousandShips
Copy link
Member

Unrelated to this PR, sporadic error

@lemilonkh lemilonkh changed the title Implement render mode fog_disabled for all rendering backends Implement render mode fog_disabled and StandardMaterial3D setting Disable Fog Sep 4, 2023
@lemilonkh lemilonkh changed the title Implement render mode fog_disabled and StandardMaterial3D setting Disable Fog Implement render mode fog_disabled and BaseMaterial3D setting Disable Fog Sep 4, 2023
Copy link
Member

@clayjohn clayjohn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good to me and I have tested locally and everything seems to be working fine!

Great work!

For maintainers, this should be merged in 4.2, but not cherrypicked to 4.1

@clayjohn clayjohn modified the milestones: 4.x, 4.2 Sep 5, 2023
@akien-mga akien-mga changed the title Implement render mode fog_disabled and BaseMaterial3D setting Disable Fog Implement render mode fog_disabled and BaseMaterial3D setting Disable Fog Sep 5, 2023
@YuriSizov
Copy link
Contributor

Could you please squash your commits into one? Make sure that the final commit has a short but descriptive message (the title of this PR is a good option). See this documentation, if you need help with squashing.

@lemilonkh
Copy link
Contributor Author

Done ✨

@YuriSizov YuriSizov merged commit 16957fd into godotengine:master Sep 6, 2023
15 checks passed
@YuriSizov
Copy link
Contributor

Thanks, and congrats on your first merged Godot PR!

@EzraT
Copy link

EzraT commented Oct 22, 2023

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fog volume breaks additive unshaded materials
6 participants