Puddles with rain drops #375
Replies: 3 comments 2 replies
-
Rain drops puddle normal map image generated by myself and released to the public domain under MIT license for anyone to use for any purpose. Good luck! |
Beta Was this translation helpful? Give feedback.
-
Here is the relevant code (from my t3d fork), be aware this GLSL will not work in stock T3D without edits, but those should be pretty straight forward for anyone used to writing shaders.
If you're wondering what "get_current_time()" is, that's a function in another file that just returns TIME, but only if a define disabling TIME access is not set. If that disable-time define is set, it returns 0 and TIME ref is stripped out of the shader, so animation can be disabled within the editor (and then it won't constantly update, which annoys me to no end). Also, v_role is processed earlier, here's the function to get that value from world mesh normal:
Also, in another area I calculate 'how creased is the normal map at this texel', it's a one liner, here's the one line:
I would bet that the above calc also functions pretty well to provide an 'implied AO' value, too. More creased = more occluded, makes sense to me. Haven't tried that yet though. |
Beta Was this translation helpful? Give feedback.
-
really interesting results adding the following lines to the above (just before the last 'if defined':
What that will do is put the same puddles texture (except not animated, cause it doesn't matter here) inside the texture normal cracks that got highlighted and watery earlier in the script, so they get subtle ripples flowing down the surface. I started it with intention of triplanar implementation, but it really isn't necessary, at least with this scene, because the cracks being filled are so thin, the texture distortion of this stages normal map being misaligned really doesn't impact the visuals much. This could be expanded a bit, with proper triplanar (or dual planar, at least, x/z), and a proper 'sheets of rain flowing down a surface' normal map (not animated), so it puts 20-40% of that over any vertical surface, for partial effect, but inside the filled cracks, it's 100%, for maximum ripple flow there. I've seen that before and it looks quite nice, but raises the sample count to 3 for this (with drops only, it's 1, with drops and vertical crack flow, it's 2, with proper triplanar it'd be 3) |
Beta Was this translation helpful? Give feedback.
-
So this is what it looks like so far:
Here I'm cranking up spec and shine for areas that have heavily creased normal maps, so the less flat the normal map is, the more 'watery effect' it gets, which seems to be working pretty well. Feels natural. Also adds same effect, to a less extent, to areas that are mostly flat (mesh, not texture).
But animated rain drops in those puddles was pretty tricky, I had to generate an image I could either sub-sample as an animated sprite sheet, or convert into a texture2darray, which meant the Blender frames output had to be laid out as a grid, etc etc. So that was a whole process, and to save anyone else the trouble, here it is as a highly compressed 'webp' file, which works fine in Godot just like a png or jpg. Except its 55k for a 2048x2048 normal map, which is pretty amazing levels of compression.
Unfortunately github won't let me drag the webp straight in here like a normal image, so here's a zip, and underneath I'll put the actual png even though it's 3400% larger file size for the same image. Whatever, 1.7mb still isn't too bad and maybe some people would prefer a png anyways.
rain_drops_compressed.zip
Beta Was this translation helpful? Give feedback.
All reactions