Skip to content

Visual Effects Vol. 2#15417

Open
GefullteTaubenbrust2 wants to merge 65 commits into
luanti-org:masterfrom
GefullteTaubenbrust2:Visuals-Vol-2
Open

Visual Effects Vol. 2#15417
GefullteTaubenbrust2 wants to merge 65 commits into
luanti-org:masterfrom
GefullteTaubenbrust2:Visuals-Vol-2

Conversation

@GefullteTaubenbrust2

@GefullteTaubenbrust2 GefullteTaubenbrust2 commented Nov 10, 2024

Copy link
Copy Markdown
Contributor

This PR seeks to improve the visuals of Luanti through improvements to existing effects and addition of new ones (pertains to point 2.1 of the roadmap). To this end, shader code, and to a lesser extent engine code is modified.

List of changes

Adjustments to effects from #14610 and others:

  • Translucent foliage sees some improvements to consistency and reduced artifacts
  • Water reflections now work without waving water enabled
  • Water reflections see some changes to correct for low alpha
  • The (still placeholder) specular maps are improved
  • The minimap shader is pixelated
  • Made depth attenuation in volumetric lighting optional
  • Made tinted fog optional

New effects:

  • Added gamma setting
  • Vignette as part of the second stage shaders
  • ASL CDL color grading
  • Tinted sunlight
  • Adjustable artificial light color (global, not per node :( )

Lua API additions

  • lighting.vignette controls the second stage vignette.
    • dark how bright the darkest part of the vignette is, default: 0.3.
    • bright how bright the brightest part of the vignette is, default: 1.1.
    • power controls the blending between dark and bright, default: 1.1.
  • lighting.cdl controls the color grading decision list.
    • The output color follows the formula out = pow(in * slope + offset, power).
    • Default: { slope = { x = 1.2, y = 1.0, z = 0.8}, offset = { x = 0.0, y = 0.0, z = 0.0 }, power = { x = 1.25, y = 1.0, z = 0.9 } }.
  • lighting.volumetric_light.beta_r0 controls the absorbance of the atmosphere for volumetric light and tinted sunlight effects.
    • Default: { x = 3.336e-01, y = 8.754e-01, z = 1.953 }.
    • The default is reasonable for most purposes, but this can be used to create sunrises/sunsets of arbitrary color.
    • An absorbance of zero { x = 0, y = 0, z = 0 } is equivalent to disabling tinted sunlight, except it also applies to volumetrics.
  • lighting.artificial_light Controls the color of artificial light, default: { r = 133, g = 133, b = 133 }.
  • lighting.foliage_translucency controls the strength of the translucent foliage effect, default: 1.5.
  • lighting.specular_intensity controls the strength of the specular reflection effect, default: 1.5.

Settings

Name Technical Name Location Type Default
Tinted sunlight enable_sun_tint Effects>Dynamic Shadows bool false
Gamma secondstage_gamma Effects>Post Processing float 1.6
Color grading enable_color_grading Effects>Post Processing bool false
Volumetric Depth Attenuation enable_volumetric_depth_attenuation Effects>Post Processing bool false
Tinted fog enable_tinted_fog Effects>Other Effects bool false
Bump maps enable_bumpmaps Effects>Other Effects bool false
Screenshots

screenshot_20241027_211038
screenshot_20241027_214630
screenshot_20241110_181206
screenshot_20241110_181749
screenshot_20241110_191126

To do

This PR is ready for review.

How to test

For most features, simply change the game settings. Of course, the game you use should support dynamic shadows and volumetrics. An example for the Lua controls is shown below:

player:set_lighting({
    artificial_light = { r = 140, g = 120, b = 100 },
    cdl = { offset = { x = 1, y = 1, z = 1 }, slope = { x = -1, y = -1, z = -1 }, power = { x = 2, y = 2, z = 2 } },
    vignette = { dark = 0, bright = 2, power = 0.5 },
    volumetric_light = { beta_r0 = { x = 2, y = 1, z = 0.5 } },
    foliage_translucency = 4.0, 
    specular_intensity = 4.0
})

This should produce inverted colors with color grading enabled, an exaggerated vignette, very bright reflections and foliage, blue sunsets and yellow artificial light.

@Zughy Zughy added @ Script API @ Client / Audiovisuals Roadmap The change matches an item on the current roadmap Feature ✨ PRs that add or enhance a feature Shaders labels Nov 10, 2024
@MisterE123

MisterE123 commented Nov 11, 2024

Copy link
Copy Markdown
Contributor

Would it be a good idea to add server/mod control for the noise parameters of waving water in this PR?

Currently it's all client-side but the wave parameters, especially with reflections, are definitely part of the look-and-feel of a game and also relate to current weather conditions.

@GefullteTaubenbrust2

Copy link
Copy Markdown
Contributor Author

Would it be a good idea to add server/mod control for the noise parameters of waving water in this PR?

Currently it's all client-side but the wave parameters, especially with reflections, are definitely part of the look-and-feel of a game and also relate to current weather conditions.

Hmm, good point. I mean this is something that was client controlled before, but it could make sense to have it be controlled from the server side instead. I'd like to know what others think about this as well.

fix failed checks (hopefully for crying out loud)
Let's try this again...
@lhofhansl

Copy link
Copy Markdown
Contributor

Would it be a good idea to add server/mod control for the noise parameters of waving water in this PR?

Yes, but I'd prefer a separate PR. The smaller a PR is, the easier it is to review and faster it will get merged.

@lhofhansl

Copy link
Copy Markdown
Contributor

I think I asked that before (somewhere?)... What is the advantage of a shader based vignette effect over using a HUD image? (https://github.com/bas080/minetest_vignette)

@lhofhansl

Copy link
Copy Markdown
Contributor

Looks like I cannot apply this as a patch (to master).

@GefullteTaubenbrust2

Copy link
Copy Markdown
Contributor Author

I think I asked that before (somewhere?)... What is the advantage of a shader based vignette effect over using a HUD image? (https://github.com/bas080/minetest_vignette)

Yeah this conversation is buried somewhere on the Vol. 1... The HUD image has the disadvantage that it is rendered over the second stage, so there are quite visible banding artifacts and effects like color grading are not applied to the vignette, which is not as nice.

@grorp grorp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

just two more "surface level" comments (unfortunately not a proper review of the actual shader stuff)

Comment thread builtin/settingtypes.txt Outdated
Comment thread builtin/settingtypes.txt Outdated
@farooqkz

Copy link
Copy Markdown
Contributor

I guess now the rebase is done and only merge is left?

@sfan5 sfan5 removed the Rebase needed The PR needs to be rebased by its author label Nov 14, 2025
Comment thread client/shaders/object_shader/opengl_vertex.glsl Outdated
Comment thread client/shaders/second_stage/opengl_fragment.glsl Outdated
Comment thread doc/lua_api.md Outdated
Comment thread src/client/game.cpp Outdated
Comment thread src/client/game.cpp Outdated
Comment thread src/defaultsettings.cpp Outdated
Comment thread src/log.h Outdated
Comment thread src/network/networkprotocol.cpp Outdated
Comment thread src/script/lua_api/l_object.cpp Outdated
Comment thread src/script/lua_api/l_object.cpp Outdated
@sfan5 sfan5 added the Rebase needed The PR needs to be rebased by its author label Nov 14, 2025
@farooqkz

farooqkz commented Nov 15, 2025

Copy link
Copy Markdown
Contributor

@GefullteTaubenbrust2 Hey. After #16670 got merged, now you need to rebase again and fix conflicts.

Edit: Not a dev or regular contributor here. Just some Luanti fan happy to see these new features in game :)

@sfan5

sfan5 commented Nov 15, 2025

Copy link
Copy Markdown
Member

Note that a revert for 3020c19 also needs to be included in this PR.

@GefullteTaubenbrust2

Copy link
Copy Markdown
Contributor Author

Sorry, I haven't checked on this in a while. I'll get right to it.

GefullteTaubenbrust2 and others added 5 commits December 7, 2025 11:52
Co-authored-by: sfan5 <sfan5@live.de>
Co-authored-by: sfan5 <sfan5@live.de>
I hope this fixes failed checks?
@sfan5 sfan5 removed the Rebase needed The PR needs to be rebased by its author label Dec 7, 2025
@sfan5

sfan5 commented Jan 21, 2026

Copy link
Copy Markdown
Member

I guess this needs another round of reviews? Or is there something left to be fixed?

@GefullteTaubenbrust2

Copy link
Copy Markdown
Contributor Author

I guess this needs another round of reviews? Or is there something left to be fixed?

Everything should be addressed unless I missed something.

@sfan5 sfan5 self-requested a review January 27, 2026 20:08
@farooqkz

Copy link
Copy Markdown
Contributor

I do wish we could have this for 5.16 :)

@sfan5 sfan5 added this to the 5.17.0 milestone May 10, 2026
@sfan5

sfan5 commented May 10, 2026

Copy link
Copy Markdown
Member

@GefullteTaubenbrust2 could you rebase this again?

@GefullteTaubenbrust2

GefullteTaubenbrust2 commented May 24, 2026

Copy link
Copy Markdown
Contributor Author

Sorry, I've been procrastinating a rebase for weeks now.

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

Labels

@ Client / Audiovisuals Feature ✨ PRs that add or enhance a feature Roadmap The change matches an item on the current roadmap @ Script API Shaders

Projects

None yet

Development

Successfully merging this pull request may close these issues.