-
Notifications
You must be signed in to change notification settings - Fork 2k
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
base: master
Are you sure you want to change the base?
Visual Effects Vol. 1 #14610
Conversation
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
Tried it, works well. I'll try to find some time in today or tomorrow evening to do a proper review. |
Sorry. Very busy work week. Haven't gotten to it, yet. |
} | ||
|
||
#if (defined(MATERIAL_WAVING_LIQUID) && defined(ENABLE_WATER_REFLECTIONS)) || defined(ENABLE_BUMPMAPS) | ||
float snoise(vec3 p) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
snoise is not used in this shader as far as I can tell... Only gnoise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, i think the preprocessor stuff is also not in the right place…
@@ -46,7 +46,7 @@ float sampleVolumetricLight(vec2 uv, vec3 lightVec, float rawDepth) | |||
if (min(samplepos.x, samplepos.y) > 0. && max(samplepos.x, samplepos.y) < 1.) | |||
result += texture2D(depthmap, samplepos).r < 1. ? 0.0 : 1.0; | |||
} | |||
return result / samples; | |||
return result / samples * pow(texture2D(depthmap, uv).r, 128.0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain this one?
Maybe add a short comment here in the code, too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So basically, the closer an object is to us, the less air we are looking through that scatters light, hence the pixel should not be as bright. The exponent of 128 is just a value that made it look reasonable to me.
Left two nits... Looks pretty good otherwise. |
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 |
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. |
yeah thanks also any ideas for the god rays to have a setting to control the strength of it too |
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. |
|
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) |
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) |
yeah okay |
I'm happy to have this merged - with redundant snoise removed and the pre-preprocessor stuff (that @GefullteTaubenbrust2 mentioned) fixed. |
Awesome! I do have an idea on how to fix the „jello“ thing too, hoping to have everything done this weekend. |
when done please share some screenshots :D |
Removed redundant stuff from nodes shader and made smooth normals for liquids.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some feedback:
-
There's a shader compilation error when enabling "Waving Liquids" and "Liquid Reflections", then disabling "Waving Liquids" again:
ERROR[Main]: Irrlicht: GLSL (> 2.x) shader failed to compile: shaderType: 35632 ERROR[Main]: Irrlicht: 0(515) : error C1503: undefined variable "WATER_WAVE_SPEED" 0(516) : error C1503: undefined variable "WATER_WAVE_LENGTH" 0(517) : error C1503: undefined variable "WATER_WAVE_LENGTH" 0(521) : error C1503: undefined variable "WATER_WAVE_HEIGHT" ERROR[Main]: generate_shader(): failed to generate "nodes_shader", addHighLevelShaderMaterial failed.
Please make sure that all "invalid" setting cases are handled correctly.
-
Volumetric lighting looks less cool than before.
before:
after:
-
Comparing the screenshots above, I can also see that something has changed about the way dynamic shadows look. What happened there?
-
What does "Node specular" do? I can't notice a difference between enabled and disabled.
disabled:
enabled:
-
Even though you already mentioned that there are still "jello" artefacts, I'd like to point out that they're especially bad when looking up a hill:
don't worry about the delay :P. the jello looks acceptable now (especially in inside block corners) . to the person above i think the god rays changed intensity and the shadows may be a bit brighter? i personally like it but maybe it should be a setting |
@grorp The volumetric strength can be configured - by the server and client. The change makes it more "correct' (more natural, see explanation above) The "Jello" effect is OK, IMHO. Not sure how else we would tweak the reflections there. Perhaps we can just not have flowing water have specular reflections. I do not think that stops this PR. For node specular you have to be at the right angle so that the sun reflects to you. For me that works just fine. Perhaps like @GefullteTaubenbrust2 I had expected that disabling a setting would disable all settings depending to their default. In any case, this has to be fixed. |
Agreed that this needs addressing.
This is very intentional. While it may look „cooler“ when you get intense god rays at a close distance like this, it is actually an entirely non-physical artifact of the non-volumetric nature in the way „volumetrics“ are done. It may look cool in the case you posted, but the issues become more apparent when you have objects both very close and very far away from you being lit at the same level of brightness, it just doesn’t look right, because it physically doesn’t make sense. The brightness of the scattered light should decrease as the depth of the scattering volume decreases. I suppose it’s up for debate how much sense my simple power function makes as a fix, but it does create the expected effect that objects that are very close are affected less by the scattering.
Now you bring it up, that is true and I’m honestly not sure. I did notice something changed from when I was working on this before but I just attributed it to changes to post processing, but this is definitely something else and not intentional.
The reason for that is because the specular is modulated by a fresnel effect, so it becomes most apparent when the sun is at a shallow angle.
It is sort of both in the nature of both the problem and the way minetest renders water that we see artifacts. Properly interpolating all the normals would not only require major changes to the mesh generation, but would also introduce artifacts of its own, so I don’t really have a „perfect“ fix for this. |
Actually, it looks like the look of the dynmaic shadows changed simply because I set a bad default value for the tint. Probably left that in from debugging, very embarrassing indeed. |
this works quite nicely now I really like the shaders in this |
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
Lua API additions
shadow
field controls the color of the cloud's basetint
controls shadow color{ r = 0, g = 0, b = 0}
{ r = 0, g = 50, b = 180 }
Settings
Screenshots
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: