I was checking out the visual improvements in PR 14610 which was just merged last night, as we now wait for PR 14828 to add proper water reflections and more. The results are already outstanding and Minetest feels incredibly better since advanced shaders were added! This reminded me of a question and suggested I wanted to bring up a while ago, which I may post on the bug tracker if appropriate but first I'm curious to hear opinions here.
A core visual feature we're missing is the surface shaders... specular maps, normal maps, glow maps, maybe even metallicity if we go as far as simulating PBR: Last night sun specularity was added to the engine, but as expected it's universal across nodes with no way to adjust intensity, it also reflects just the sun rather than real atmospheric lighting. As those familiar with development know, Minetest doesn't use OpenGL hardware lighting like most engines do, instead vertex colors set from a light propagation grid. This grid already simulates bounce lighting albeit with limitations, but I was wondering to what extent it could be used to achieve realtime reflections and light direction information using our own shaders to emulate what hardware lighting does.
I'm curious what those familiar with designing shaders for our lighting system think: Can we bake the light information cells into a 3D cubemap and use it for better specular reflections and global illumination? Also is it possible to extract the direction of light from cells toward the pixel and allow normal maps to filter each cell per angle? Technically this is similar to direct ray tracing and may even yield close results, just done at a low resolution since we're using a 1x1x1 light grid with per-pixel calculations for 16px or 32px texture sets which should be very cheap. Obviously it will require generating roughness and normal maps for every texture, this shouldn't be a problem and I'm sure I can use Blender or ImageMagick to automate a good end result.
Using voxel light data as a cubemap for specular reflections, cell direction for normal map support
- MirceaKitsune
- Member
- Posts: 970
- Joined: Sat May 21, 2011 22:31
- GitHub: MirceaKitsune
- IRC: Taoki
- In-game: MirceaKitsune
- Location: Romania, Bucharest