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

Visual Effects Vol. 1 #14610

Merged
merged 26 commits into from
Sep 24, 2024
Merged

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

@lhofhansl
Copy link
Contributor

@sfan5 All good for you now?

@AbduSharif
Copy link

AbduSharif commented Sep 15, 2024

Can't use Liquid reflections, Node specular, Translucent foliag on Android (no option appears for any of those). If I have to guess its because of the dynamic shadows dependency?

Why are dynamic shadows required for those effects?

@DragonWrangler1
Copy link

DragonWrangler1 commented Sep 15, 2024

Can't use Liquid reflections, Node specular, Translucent foliag on Android (no option appears for any of those). If I have to guess its because of the dynamic shadows dependency?

Why are dynamic shadows required for those effects?

Well they all need the sun’s position. So that would explain part of it.

@AbduSharif
Copy link

AbduSharif commented Sep 16, 2024

Well they all need the sun’s position. So that would explain part of it.

That's actually more confusing now, why do you need dynamic shadows for that? Does the game not have any way to get the sun position at all without dynamic shadows or what?

@DragonWrangler1
Copy link

That's actually more confusing now, why do you need dynamic shadows for that? Does the game not have any way to get the sun position at all without dynamic shadows or what?

Correct the game does, however the shaders handle a good part of the usage of that.

@GefullteTaubenbrust2
Copy link
Contributor Author

Can't use Liquid reflections, Node specular, Translucent foliag on Android (no option appears for any of those). If I have to guess its because of the dynamic shadows dependency?

Why are dynamic shadows required for those effects?

Reflections need shadows to correctly display, well, shadows. I guess this isn't strictly necessary but having these fancy light effects in the absence of basic shadows looks and is silly. Node specular needs shadows because else it applies everywhere which again looks silly. And translucent foliage needs them because otherwise all leaves and plantlike nodes would just appear to glow brightly when looking toward the sun.

@AbduSharif
Copy link

AbduSharif commented Sep 16, 2024

Reflections need shadows to correctly display, well, shadows. I guess this isn't strictly necessary but having these fancy light effects in the absence of basic shadows looks and is silly.

I disagree with doing it like this, there's a good number of games without shadows or with the option to disable shadows (because they can obviously be intensive) and have water reflections work just fine.
Making shadows a requirement for reflections would not be intuitive.

@AbduSharif
Copy link

AbduSharif commented Sep 16, 2024

Node specular needs shadows because else it applies everywhere which again looks silly. And translucent foliage needs them because otherwise all leaves and plantlike nodes would just appear to glow brightly when looking toward the sun.

I can understand that, not many can get them to look good enough without shadows.

@lhofhansl
Copy link
Contributor

lhofhansl commented Sep 16, 2024

Folks. We have been through this.

  1. Features that need other features are disabled when those other features are disabled. This is how features in Minetest work. @rubenwardy mentions here: Visual Effects Vol. 1 #14610 (comment) that he plans to improve this. This is not the PR to discuss this.
  2. The shaders only know about the sun direction when shadows are enabled.

I'm going to mark further discussions on this here as "offtopic".

@AbduSharif
Copy link

The shaders only know about the sun direction when shadows are enabled.

While I'm not sure if that's true as I'm not a developer but this exists, sun/moon position are part of the sky API to be used in shaders easily, a change introduced here:
#12662

Even if it was the case that you need shadows enabled, I'm not so sure if that's a good enough reason to relay on them, seems like something that would need rectification down the line, you would need sun position for other things too that reliance on shadows being enabled doesn't make any sense for.

Features that need other features are disabled when those other features are disabled. This is not the PR to discuss this.

It seems only appropriate to discuss in the same PR that introduces the change, and I'm not sure if this would have a chance to be corrected if pushed for a later time, the reliance on shadows when it comes to water reflections is part of this PR.

I'm going to mark further discussions on this here as "offtopic".

😐

@DragonWrangler1

This comment was marked as off-topic.

@AbduSharif
Copy link

AbduSharif commented Sep 17, 2024

If it is out of scope for this PR I wouldn't mind opening an issue for that, unless it is something that can be corrected quickly/simple.

Waiting on response from the PR author to understand how to move forward with this all in any case (or if it is possible at all for now).

@lhofhansl
Copy link
Contributor

lhofhansl commented Sep 19, 2024

Do we want this or not? If we keep discussing here and try to make to make it perfect (including changing how Minetest handles unavailable features - by hiding them, or if/how shaders know about the direction of the sun) we'll never get this merged.

In part that is why I find this discussion slightly frustrating. I've been trying to get someone else to review it so it can get merged - we can improve things afterwards. Now everyone is confused again about something that has nothing to do with the features of this PR, and so merging is put off again.

@sfan5 Any further comments/requirements for this after @GefullteTaubenbrust2 's last updates?

@DragonWrangler1
Copy link

Do we want this or not? If we keep discussing here and try to make to make it perfect (including changing how Minetest handles unavailable features - by hiding them, or if/how shaders know about the direction of the sun) we'll never get this merged.

We absolutely want this.

@sfan5
Copy link
Member

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
Member

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
Member

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 minetest:master Sep 24, 2024
15 checks passed
@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?

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.