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

Allow changing the anisotropic filter level at run-time per Viewport #88313

Merged

Conversation

wagnerfs
Copy link
Contributor

Fixes godotengine/godot-proposals#4673

Changes to anisotropic filtering on project settings are real time now and don't need an engine restart, also adds anisotropic_filtering_level property to viewports and can be changed separately.

Added the additional lines do the docs on viewports as well, I'm not sure what to do on the ProjectSettings.xml though besides removing the note about not being able to change at run-time.

A new enum had to be added though similar to MSAA

enum AnisotropicFiltering {
      ANISOTROPY_DISABLED,
      ANISOTROPY_2X,
      ANISOTROPY_4X,
      ANISOTROPY_8X,
      ANISOTROPY_16X,
      ANISOTROPY_MAX
};

@wagnerfs wagnerfs requested review from a team as code owners February 14, 2024 04:01
@Calinou Calinou added this to the 4.x milestone Feb 14, 2024
drivers/gles3/storage/render_scene_buffers_gles3.h Outdated Show resolved Hide resolved
doc/classes/RenderingServer.xml Outdated Show resolved Hide resolved
doc/classes/Viewport.xml Outdated Show resolved Hide resolved
@DarioSamo
Copy link
Contributor

I can't speak for the GLES3 changes but the RD ones look good to me, glad to see the effort of splitting the samplers into being per-viewport was continued like this. The change makes sense to me.

@@ -131,6 +131,7 @@ void RenderSceneBuffersGLES3::configure(const RenderSceneBuffersConfiguration *p
scaling_3d_mode = p_config->get_scaling_3d_mode();
//fsr_sharpness = p_config->get_fsr_sharpness();
//texture_mipmap_bias = p_config->get_texture_mipmap_bias();
//anisotropic_filtering_level = p_config->get_anisotropic_filtering_level();
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a purpose to the commented code being introduced here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems to be that it doesn't fill in any of the fields since all other viewport lines are also commented out, I added that one there just in case the commented lines are there for future change kinda thing

Copy link
Member

Choose a reason for hiding this comment

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

While FSR1 probably won't be implemented in Compatibility, anisotropic filtering level change can be done on all platforms (including OpenGL ES) while mipmap LOD bias is limited to desktop OpenGL (it was never part of OpenGL ES).

servers/rendering/storage/render_scene_buffers.cpp Outdated Show resolved Hide resolved
servers/rendering/storage/render_scene_buffers.cpp Outdated Show resolved Hide resolved
doc/classes/Viewport.xml Outdated Show resolved Hide resolved
Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

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

Tested locally (rebased on top of master 907db8e), it works as expected.

Testing project: test_pr_88313.zip

simplescreenrecorder-2024-02-14_19.29.05.mp4

Copy link
Member

@Calinou Calinou 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. Please squash commits together into a single commit so this can be merged.

@wagnerfs wagnerfs force-pushed the run-time-anisotropic-filtering branch from e652bce to 356e285 Compare February 14, 2024 19:41
@AThousandShips
Copy link
Member

Please clean up your commit message, you don't need all the original messages, just a short message describing what's done

@wagnerfs wagnerfs force-pushed the run-time-anisotropic-filtering branch from 17d88a6 to 7b1a6f5 Compare February 14, 2024 20:25
@wagnerfs
Copy link
Contributor Author

Should be good to go now!

@akien-mga
Copy link
Member

You'll need to run godot --doctool, or apply the diff from https://github.com/godotengine/godot/actions/runs/7906991378/job/21584760683?pr=88313 manually, to have the new properties and methods alphabetically sorted in the docs.

@wagnerfs wagnerfs force-pushed the run-time-anisotropic-filtering branch from 8326c2a to 64a7460 Compare February 15, 2024 13:20
@wagnerfs
Copy link
Contributor Author

@akien-mga never dealt with docs before, thanks for the help

@wagnerfs wagnerfs force-pushed the run-time-anisotropic-filtering branch from 39fe10d to 9c4bc20 Compare February 15, 2024 13:26
Copy link
Contributor

@Mickeon Mickeon left a comment

Choose a reason for hiding this comment

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

Documentation is very nice, but just a few things.

doc/classes/RenderingServer.xml Outdated Show resolved Hide resolved
doc/classes/ProjectSettings.xml Show resolved Hide resolved
doc/classes/ProjectSettings.xml Outdated Show resolved Hide resolved
@wagnerfs wagnerfs force-pushed the run-time-anisotropic-filtering branch from b911fa4 to 2093462 Compare February 15, 2024 14:29
@akien-mga akien-mga modified the milestones: 4.x, 4.3 Feb 16, 2024
@akien-mga akien-mga requested a review from clayjohn February 16, 2024 22:51
@Mickeon Mickeon removed request for a team November 30, 2024 11:03
@akien-mga akien-mga requested a review from clayjohn December 2, 2024 14:42
@TokisanGames
Copy link
Contributor

Fixes #69379

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.

Approving. The code looks great!

I am still skeptical about the need to expose this on a per-viewport basis. I am especially wary that the main reason this PR exposes anisotropy on a per-viewport basis was simply because it was easier than the alternative (because it can piggyback on our mip offset code). However, enough people have commented on the PR with reasons why they might need this exposed on a per viewport basis that I won't fight against it.

Overall, the code additions are small and this won't add much maintenance burden beyond what we have already accepted for the mip level offset

@akien-mga akien-mga merged commit d60c0e2 into godotengine:master Dec 17, 2024
20 checks passed
@akien-mga
Copy link
Member

Thanks! And congrats for your first merged Godot contribution 🎉

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.

Allow changing the anisotropic filter level at run-time
9 participants