Closed lhofhansl closed 4 years ago
We had a few normalmaps years ago but decided to remove them as they were huge, 128px, and the amount of work needed to do this for many textures would have been far too big. ~However i think i'm ok with adding a few low-res normalmaps (16px if possible) for textures that look very bad with the automatically-generated ones.~
Yeh, they don't need to be that large. The size depends on the detail you want to express. 16px works fine or, largest I would consider for default might be 32px but when enabled will make those textures look out of place so 16px is the proper size for default set. And they should be quite subtle.
My biggest issue with normalmaps, is the way the shaders are set up to expose them... the effect is mostly only visible within the peripheral zones of vision. Looking straight ahead they are not pronounced very well, but I do not have experience to know what is required to fix that.
A set of normalmaps can be produced, and perhaps a look into adjusting the shaders at a later date? Looking back HybridDog had a set of NMs back some time ago https://github.com/HybridDog/HybridTP but, were they created in a batch process or did they all simply use a basic setting to be made? I'm not saying this to be insulting so I hope it does not come off that way. I only ask because normalmaps need to be created on a per texture basis, using a standard setting for all will give poor results, and look shoddy/half assed.
If I also recall correctly... I believe (I think it was Calinou) who created a nice online service for creating them. @Calinou ? ~I had the link a couple years ago but no longer have it...~ Found it https://opengameart.org/forumtopic/online-free-texture-and-normal-map-generator
In any case... seeing as the option is there, may as well have the files available for players to use, even if only for some select textures to add some visual depth.
@TumeniNodes I didn't create that service, I just linked to it :wink:
Most people don't seem to be using normal maps in Minetest, so I wouldn't spend a lot of time creating them. This way, we don't have to spend time updating normal maps if we update a node's texture.
Yes, I noticed that after. (I think I noticed it a couple years ago too but my memory is... nil)
I agree, the main ones I would see doing are the water, river water, and lava animations... this will add a little (something) for those who have been long clamoring for nicer looking water. Not really what has been sought for but... at least something.
Looking back HybridDog had a set of NMs back some time ago https://github.com/HybridDog/HybridTP but, were they created in a batch process or did they all simply use a basic setting to be made?
I made each of the normal map images with GIMP's normalmap plugin and tested them individually. For some textures, I have drawn an approximate greyscale heightmap instead of directly using the texture for the normalmap generation because (as far as I know) the normalmap plugin assumes that the input texture corresponds to a heightmap and the plugin has no knowledge about any reflections shown in the texture.
You can use those normalmaps in minetest_game if you need them.
My biggest issue with normalmaps, is the way the shaders are set up to expose them... the effect is mostly only visible within the peripheral zones of vision. Looking straight ahead they are not pronounced very well, but I do not have experience to know what is required to fix that.
I don't fully understand that code. http://github.com/minetest/minetest/blob/d77ea764768f5cde9e8f0781356a67d723aa7609/client/shaders/nodes_shader/opengl_fragment.glsl#L185 Either the bump map normal vector, or the eye and light vectors have to be rotated at some place because the texture does not always face to the same direction. The code seems to calculate light for the Phong reflection model: https://en.wikipedia.org/wiki/Phong_reflection_model https://www.scratchapixel.com/lessons/3d-basic-rendering/phong-shader-BRDF For the diffuse light, the light source seems to be the player and not the sun or something else (as long as the vectors are rotated correctly). The specular light is coloured with the texture, which is not recommended at that scratchapixel page.
Basically, we really need to find someone who can fix, the current shaders (but they are extremely hard/rare to find, especially on a volunteer basis) It's crazy how many quick and simple little games there are out there... which handle shaders so much better than MT. It's actually sort of embarrassing tbh.
I'm not touching them, I've learned my lesson very early on... I either make them worse, or broken.
We'll have to pick through the normalmaps from your old pack, and see what we can use : )
For the diffuse light, the light source seems to be the player and not the sun or something
Yeah, that's weird. For diffuse light the position of the observer is not relevant.
Edit: In fact it looks like the lightVec is miscalculated. The eyePosition passed to the shader is global position, whereas the worldPosition is relative to the camera offset. In https://github.com/minetest/minetest/pull/8889 I pass the cameraOffset to the shaders so that real position can be calculated. We should either do that, or adjust the eyePosition with the cameraOffset before passing it to the shaders.
Edit2: And the sunposition seems to be fixed... Related only to the eye position? Meh :(
One more comment... When I adjust the worldPosition correctly with the cameraOffset in the vertex shader, I can in fact replace float diffuse = dot(-E,bump.xyz); with float diffuse = dot(L,bump.xyz); in the fragment shader.
Which @paramat , removes the weird behavior that the bump mapping effect is only noticeable at the periphery.
Oh man. What a mess!
We don't say "mess" here... we say... interesting. ; ) And there are quite a few, really f-ing interesting things going on here
I guess this is why trying to make "normal" adjustments... makes things even more, incredibly interesting.
lhofhansl, good discovery, Another shaders job for you, it's good to see you improving the shaders. No wonder bumpmapping always looked so bad to me.
We need the change from minetest/minetest#8889 for me to fix this, or alternatively I can create a engine PR just for passing the cameraOffset.
You could additionally make some changes so that https://github.com/minetest/minetest/pull/7987 can be simplified a bit.
Another bumpmapping issue is the missing gamma correction. The colour values in the shaders are in sRGB format (scaled into [0, 1]³) and not linear.
@HybridDog can you be more specific? :) I'll have a look at minetest/minetest#7987 .
Yes i hope engine 8889 can be merged soon, sorry i can't approve it as i'm not keen on the concept (but it's harmless so i don't officially disapprove).
@TumeniNodes you think you can make a nice water normal map for testing?
@TumeniNodes you think you can make a nice water normal map for testing?
try this for now:
Should give this result (sorry, I am absolute poop at doing video, not sure if I can get a decent scene using obj)
meh, gave it a shot https://www.youtube.com/watch?v=o6-EWb4Av4o&feature=youtu.be
A very slightly better video https://youtu.be/REUh-9bNTqg
I tried that water normalmap and can't see any 3D effect, it just has an unpleasant darkness added, textures misaligning at edges, and looks ugly. I can't see any benefit. No offence to the normalmap creator, i expect any water normalmap would look bad.
^ No shaders
^ Bump mapping
^ Bump mapping and parallax occlusion
Note seeing these in motion still doesn't create a 3D effect.
With opaque water a normalmap has this effect, maybe bump mapping cannot be use for water?
I get the effect with all diff settings. This tells me, that these effects will vary upon hardware... The reason I edited the brightness so much, was because I too was getting very dark shadows and the water was completely transparent (but could still see some waves)
Part of this is due to the fact that none of these shaders are set up properly. As I said before, they were set up just enough to work-ish Second part is, shaders are hardware specific in results
The fact they do not work for you, is related to your hardware, as it is obvious for me it does... in the video I posted.
One thing is for certain, until these shaders are set up properly, they are mostly useless code. And no one will be able to produce proper normalmaps until the problems are fixed, because even a proper normalmap will look very wrong. This one had to be done in a hackish way to work somewhat properly with my graphics board/chip ... thingy xD Though I say this as one who is not experienced enough to fix them.
I really wish I could find the texture and normalmap I used in the original video I shared titled "choppy" because it looked very good... but alas... I may have accidentally deleted it with old MTG files at some point. I know the TP it was in but it is missing from the few that I did (I still have the others, like cobble, and grass etc.) but the normalmaps I did as 32px for the 16px textures, which looked good-ish
To be clear, there is a '3D effect', but i suspect it is an illusion caused by the dark patches moving around. When i look at the texture pixels i cannot yet see them being displaced up or down. However, we know that bumpmapping is broken and not noticeable near screen centre https://github.com/minetest/minetest_game/issues/2473#issuecomment-534360420 so that needs fixing first, maybe that will make a difference. Do you get the dark water when using opaque water?
As for adding normalmaps to MTG, i am not happy with that due to the bloat of the texture folder, the maintenance, all for a (in my opinion) very ugly effect. This was why we removed them years ago. I would prefer people make optional texture packs to apply normal maps.
Do you get the dark water when using opaque water?
Yes, and no. The darker areas are in the peripheral
As for adding normalmaps to MTG, i am not happy with that due to the bloat of the texture folder, the maintenance, all for a (in my opinion) very ugly effect. This was why we removed them years ago. I would prefer people make optional texture packs to apply normal maps.
I somewhat agree. Normalmaps could be made available as an add-on/plugin, installed as a subfolder within the textures folder, but not shipped by default. I feel the same regarding the shaders altogether. My thought is that it would be better if shaders could be an installable feature rather than to be shipped within MT by default. Though I have no idea how much work that would take.
Sometimes removing code can be very problematic.
And then we have the Bilinear & Trilinear filters which are also broken, and in need of attention. : / Well, maybe not "broken" but, they definitely create those odd edges with meshes.
I had an entirely different outlook on shaders in the beginning, but have come to realize what a pain in the ass they can be... even on MC... and it is not the majority of MC users who are able to actually enjoy them. And even then, you have to know how to set them on your machine. I recently tried some of the most popular shader packs on my machine with 1.14.4 java ed. and I gave up fairly quick... The load on the system, and the results were completely frustrating and disappointing. A couple were just flat out impossible to run on my machine, which is an average one... an AMD A8 w 4Gb ram
The effect is ugly because the math is wrong (the problem I outlined above), should be fixable now. Lemme play with that normal map a bit.
As for the bloat... I call b*llshit :) The normal maps can be small as @TumeniNodes points out. The effect is not nice currently, I'll try to fix that. On the contrary it's potentially a super cheap way to achieve better immersion.
Hmm... I also do not see a 3D-effect. Just some weird light-dark play on the water. It does not look like yours @TumeniNodes . Are there any settings you changed from the default?
I have a 3 year old machine but with 16BG and decent 3D Nvidia HW, but I would all even that outdated!
This is quite odd. Now two people who seem to have the same results which differ from mine. Puzzling. I do notice a difference from the old build I used to make that normalmap, and using it on my newer build Older is 5.0.0-dev-ac6e8e2 (which is what I made those videos on) My newer build is 5.1.0-dev-47da640 I am not sure what changes have been made to shaders in between these two to cause such a dramatic diff in the results.
I will try to make a video using the normalmap on my newer build to show the differences. But, even on the 5.1.0 build I get some similar result with these settings
My machine is definitely older than yours... I think it is around five or six years old now
Yes, by 'bloat' i don't mean problematic file size bloat, just that when we had some normalmaps years ago they made navigating through the texture folder, which is already huge, more of a pain.
I disagree about increasing 'immersion'. Bumpmapping is unsuitable and unnecessary. The whole point of a cube-based voxel game engine is to simplify and abstract 3D forms into simple geometries with flat surfaces. MT is just as immersive without bumpmapping. An abstract world doesn't need realism or fine detail to be immersive.
MT is just as immersive without bumpmapping. An abstract world doesn't need realism or detail to be immersive.
Highly subjective, and I don't think many players agree with this.
Not that it really matter but, I finally found the textures I had used for the "choppy" vid I uploaded to YT a while ago... Definitely tells me that some changes were made to the water shaders since then as with current 5.x.x dev it looks horrid.
I never got around to making a normalmap for the flowing water
I disagree about increasing 'immersion'. [...] MT is just as immersive without bumpmapping.
@paramat We just have to agree to disagree here. :) Yes, it's a voxel game. Yet, it often looks very sterile and unchanging and that - IMHO - reduces immersion. Especially better looking water, some more weather, and better shadows would make a huge difference. Again... IMHO.
I think we can improve all these things and make them optional. Folks who do like bump mapping, better water, etc, simply turn these things off, others switch them on. Everybody wins :)
@TumeniNodes So you have shader based normal generation turned on?! I thought the whole point of providing the normal map manually is so that the shader do not have to do that. Lemme try the latest textures you attached.
@TumeniNodes I don't understand how you do not get the half-screen-is-dark effect without a fix for the shader issue I mentioned above. Incidentally I'll file an engine PR in a few minutes.
I assume above the 1st png is water_source, the 2nd water_source_normal, and the 3rd is river_water_source?
I think the change is centering the world around the camera position - although that has been a while ago.
@TumeniNodes I don't understand how you do not get the half-screen-is-dark effect without a fix for the shader issue I mentioned above.
| ¯_(ツ)_/¯ |
I assume above the 1st png is water_source, the 2nd water_source_normal, and the 3rd is river_water_source?
3rd is water_source_flowing
I think the change is centering the world around the camera position - although that has been a while ago.
lhofhansl, sorry, i accept that bumpmapping can improve immersion for some people and yourself, it is a matter of personal taste. I was considering the word 'immersion' to mean 'engaging', so was trying to say that a game does not need fancy visuals to be engaging, which of course is true, however, it is not true for some people.
When I created the normalmaps, I did not yet know that the alpha channel defines the heightmap for parallax mapping.
There is some fighting over which colour should be used on the sharp corner (due to nearest interpolation). Maybe if we move a very very small distance further in the view direction, the white pixels disappear.
Closing due to #2710
Closely related discussion: https://github.com/minetest/minetest/issues/9711 https://github.com/minetest/minetest/issues/9241
I just realized that MT can use provided normal maps with (without the need to generate normalmaps in the shaders).
We should provide nice normal maps, especially for water. @TumeniNodes