Skip to content

Conversation

@GefullteTaubenbrust2
Copy link
Contributor

@GefullteTaubenbrust2 GefullteTaubenbrust2 commented May 4, 2024

This PR is based on #14508 and adds a variety of effects to enhance the visual experience. To this end, it makes changes to shader code, as well as the engine source code, the Lua API and settings.

List of Features and Changes
  • "soft" clouds look
  • Tinted shadows
  • Crude water reflections (sky and sun) and waves
  • Translucent foliage
  • Node specular highlights
  • Adjusted fog color (more saturated where the fog is lighter)
  • Minor changes to volumetric lighting (crudely simulates the effect of depth)

Lua API additions

  • Cloud parameters: shadow field controls the color of the cloud's base
  • Lighting: tint controls shadow color
    • default would be black { r = 0, g = 0, b = 0}
    • ambient light from the sky could be emulated by a blue color like { r = 0, g = 50, b = 180 }

Settings

Name Technical Name Location Type Default
Soft clouds soft_clouds Graphics>Clouds bool false
Liquid reflections enable_water_reflections Shaders>Waving Nodes bool false
Translucent Foliage enable_translucent_foliage Shaders>Other Effects bool false
Node specular enable_node_specular Shaders>Other Effects bool false
Screenshots

screenshot_20240504_201730
screenshot_20240504_201612
screenshot_20240504_201455
screenshot_20240504_202011

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.
The added Lua properties can be used like so:

player:set_clouds({shadow = { r = 120, g = 160, b = 240 }})
player:set_lighting(shadows = { intensity = 0.5, tint = { r = 0, g = 50, b = 180 }})

Revert changes to shadow strength, this probably warrants discussion later. Also, the objects shader was missing this anyway.
Fix bad whitespaces
- "Node reflections" renamed to "node specular"
- Fixed goofy artefacts for the foliage effects
@lhofhansl
Copy link
Contributor

Tried it, works well. I'll try to find some time in today or tomorrow evening to do a proper review.

@lhofhansl
Copy link
Contributor

Sorry. Very busy work week. Haven't gotten to it, yet.

@lhofhansl
Copy link
Contributor

Left two nits... Looks pretty good otherwise.
I'll look at it again in more detail next week, but if folks want to merge this, that'd be OK with me.

@lhofhansl
Copy link
Contributor

screenshot_20240510_171750

Flowing water looks a bit weird perhaps, maybe don't do the reflection for flowing water?

@tigercoding56
Copy link

tigercoding56 commented May 11, 2024

Flowing water looks a bit weird perhaps, maybe don't do the reflection for flowing water?

idk i like how it looks, kinda like jello . however maybe some rounding of the corners would be nice (like by interpolating between normals idk i can't glsl)
image

@Wbjitscool
Copy link

Wbjitscool commented May 11, 2024

yeah I like the reflective water too I think it looks good although you can always change it to look a bit different if you don't like it tho

@GefullteTaubenbrust2
Copy link
Contributor Author

Yeah the water is a bit goofy with slopes… It looks awkward without the reflections, and smoothing the normals isn’t exactly trivial, but I‘ll look into it.

@Wbjitscool
Copy link

Wbjitscool commented May 11, 2024

yeah thanks also any ideas for the god rays to have a setting to control the strength of it too

@ryvnf
Copy link
Contributor

ryvnf commented May 11, 2024

Can the water reflections be generalized to other nodes? Like having nodes specify (possibly animated) normal maps together with an option to enable it?

@tigercoding56
Copy link

tigercoding56 commented May 12, 2024

Can the water reflections be generalized to other nodes? Like having nodes specify (possibly animated) normal maps together with an option to enable it?

probably out of scope but i like the idea. maybe also a option to specify a cube map (to reflect from) , oh and maybe costum node shaders in lua ? , yeah definitely out of scope.

@Wbjitscool
Copy link

yeah thanks also any ideas for the god rays to have a setting to control the strength of it too
Yeah tested and works for Mineclonia but VoxeLibre isn't updated to support the sunrays yet anyway

@Wbjitscool
Copy link

Wbjitscool commented May 12, 2024

is there a way to fix this problem you place a full block over the water and the water glitches out with shaders on the screenshot doesn't work

@tigercoding56
Copy link

is there a way to fix this problem you place a full block over the water and the water glitches out with shaders on the screenshot doesn't work

did you enable waving water by any chance , if so try disabling it (it sometimes does not render water under block correctly)

@Wbjitscool
Copy link

Wbjitscool commented May 13, 2024

yep I have waving shaders enabled just disabled it now it renders the water properly but I want the shaders to be on as the liquid shows as a full block and I don't like that I prefer the water to be at least a node below the full block

@tigercoding56
Copy link

tigercoding56 commented May 13, 2024

yep I have waving shaders enabled just disabled it now it renders the water properly but I want the shaders to be on as the liquid shows as a full block and I don't like that I prefer the water to be at least a node below the full block

make a github issue, i think the bug is in water shader as it is a bug even without using GefTau's shader (just with stock minetest)

@Wbjitscool
Copy link

yeah okay

@sfan5
Copy link
Collaborator

sfan5 commented Sep 23, 2024

Is it intended that it changes the fog color by default?
screenshot_20240923_201704
screenshot_20240923_201855

@lhofhansl
Copy link
Contributor

lhofhansl commented Sep 23, 2024

Is it intended that it changes the fog color by default?

I do not see any change in the images. What features of this did you have enabled? Nothing?

@sfan5
Copy link
Collaborator

sfan5 commented Sep 23, 2024

If you look at the distant terrain it has basically turned blue.

What features of this did you have enabled? Noting?

Of this PR: nothing at all.
In general I have mipmapping, fsaa at 4x, fancy leaves and I use the ogles2 driver.

@lhofhansl
Copy link
Contributor

@sfan5
Copy link
Collaborator

sfan5 commented Sep 23, 2024

To be clear I don't think it's a problem. Just wanted to make sure it's intentional and we don't get anyone complaining about a compatibility break later.

@lhofhansl
Copy link
Contributor

I'm also happy to remove that part of the code, as it does not seem to be required by any of the other features. Let's wait for @GefullteTaubenbrust2 to chime in. We're on the end-stretch here :)

@GefullteTaubenbrust2
Copy link
Contributor Author

GefullteTaubenbrust2 commented Sep 24, 2024

Is it intended that it changes the fog color by default?

It is, so shouldn't cause technical issues, but it probably should be a setting actually... But if you think it's not a problem maybe that could be a separate PR so we get this merged first?

@Wbjitscool
Copy link

Wbjitscool commented Sep 24, 2024

yeah I see no problem either a new pr to make it a setting sounds great

@lhofhansl
Copy link
Contributor

OK... I'll propose to get this merged, and then we file minor PRs to address things like this - if even needed.

I am also interested into the tinted sunlight that the original PR had - and probably some more features. :)

@MirceaKitsune
Copy link
Contributor

MirceaKitsune commented Sep 24, 2024

This has to be one of the most active yet delayed PR's I can remember. Which is understandable since we want to get it right, but it will be great to see the system finally in the engine following all the great improvements on shaders lately.

One thing I've been wondering is if reflections will be possible on things other than water: It would be nice if the shader could also be used to make shiny metal and similar. Though I suspect that isn't its intent at least for the time being: Could that at least be possible in the future?

@lhofhansl lhofhansl merged commit d8f1daa into luanti-org:master Sep 24, 2024
@lhofhansl
Copy link
Contributor

lhofhansl commented Sep 24, 2024

@GefullteTaubenbrust2 Thanks for your perseverance!

@MirceaKitsune Agreed. I finally merged it.

Hopefully additional features can now be done more quickly.

As for more reflections... There's #14828 and other future improvements. In any case I think it's great to have this simpler water reflection for less performant H/W.

@GefullteTaubenbrust2
Copy link
Contributor Author

GefullteTaubenbrust2 commented Sep 24, 2024

@GefullteTaubenbrust2 Thanks for your perseverance!

Absolutely no problem, awesome to have it merged now, thanks to everyone for your feedback!
I'll compile some additional features including features from the closed PR and an option for the fog for a Vol. 2 soon.

Edit: Or do you reckon a separate PR for the fog would be better?

@lhofhansl
Copy link
Contributor

@GefullteTaubenbrust2

Edit: Or do you reckon a separate PR for the fog would be better?

IMHO, whatever makes the most sense... As long as the PRs are somewhat easy to review, engineers have a pretty short attention span :)

nerzhul pushed a commit that referenced this pull request Sep 27, 2024
* Fix uninitialized shadow tint

This resulted in shadows having a different, random color each time I started a game

* Fix formatting mistakes from the same PR
@lhofhansl
Copy link
Contributor

@GefullteTaubenbrust2 In any case, looking forward to ... vol 2 :)

@Wbjitscool
Copy link

Wbjitscool commented Oct 3, 2024

one minor thing I did notice was it deliberate for godrays to no longer shine through leaves or was it accidental? or maybe I am not noticing it as much

@GefullteTaubenbrust2
Copy link
Contributor Author

one minor thing I did notice was it deliberate for godrays to no longer shine through leaves or was it accidental? or maybe I am not noticing it as much

They still do, but aren‘t as visible at close range. This is to emulate the way real volumetrics work, but to be quite honest should be optional and might need work too. I will address this in the next PR…

@Wbjitscool
Copy link

Wbjitscool commented Oct 4, 2024

yeah um maybe add a setting to select what way you want the godrays to look like in the game? either to look like in this pr or the older godrays version or something

Mahoyomu pushed a commit to Mahoyomu/minetest that referenced this pull request Oct 7, 2024
This PR adds a variety of effects to enhance the visual experience.

    "soft" clouds look
    Tinted shadows
    Crude water reflections (sky and sun) and waves
    Translucent foliage
    Node specular highlights
    Adjusted fog color (more saturated where the fog is lighter)
    Minor changes to volumetric lighting (crudely simulates the effect of depth)

Co-authored-by: sfan5 <sfan5@live.de>
Mahoyomu pushed a commit to Mahoyomu/minetest that referenced this pull request Oct 7, 2024
…i-org#15197)

* Fix uninitialized shadow tint

This resulted in shadows having a different, random color each time I started a game

* Fix formatting mistakes from the same PR
@Wbjitscool
Copy link

Wbjitscool commented Oct 7, 2024

was also thinking can there be away for more frames for smoother moving shadows on more modern pc's like 1 to 16 is what we have now but if possible to have it to 32 to 64 frames too?

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 >= Two approvals ✅ ✅

Projects

None yet

Development

Successfully merging this pull request may close these issues.