Timeline for How can I implement voxel-based lighting with occlusion in a Minecraft-style game?
Current License: CC BY-SA 3.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 27, 2016 at 23:34 | comment | added | Ethan Bierlein | Okay, so I made a few minor changes (which can be found here) which caused it to start generating semi-correct shadows, but also produced a lot of awful-looking side effects. Any idea as to what's wrong with my implementation? | |
Jul 26, 2016 at 23:32 | comment | added | Ethan Bierlein | Is there an example implementation of this method somewhere? I'm having a lot of trouble trying to implement it based purely on the worded explanation. The code I currently have looks something like this: gist.github.com/Ethan-Bierlein/d26236aa6920e1958226668e930a8eff | |
Dec 28, 2012 at 13:12 | comment | added | Bjorn Wesen | @Felheart: it was a while now that I looked at this, but in essence there is a minimum ambient light level that is usually enough for the underneath of overhangs so they are not completely black. When I implemented this myself, I did add a second pass from down->up, but I didn't really see any big aesthetic improvements compared to the ambient method. Torches/pointlights have to be handled separately - I think you can see the propagation pattern used in MC if you put a torch on the middle of a wall and experiment a bit. In my tests, I propagate them in a separate lightfield then add. | |
Dec 7, 2012 at 21:46 | comment | added | Riki | @khyperia: Good question! Maybe minecraft does two passes? One down one up? Still it would be nice to hear an answer to that from Bjorn | |
Nov 4, 2011 at 20:47 | comment | added | user10835 | What about a "lip" that hangs over, how does light get up there? How does light travel in an upward direction? When you only go top-down, then you cannot go back upwards to fill in overhangs. Also torches/other light sources. How would you do this? (they could only go down!) | |
Nov 3, 2011 at 20:15 | comment | added | Bjorn Wesen | Please note that this method is in no way based on any real physics whatsoever :) The main problem is that you are in essence trying to approximate a non-directional light (the atmospheric scattering) AND bouncing radiosity with a simple heuristic. It looks pretty good. | |
Nov 3, 2011 at 20:14 | comment | added | Bjorn Wesen | Start with the topmost layer (slice of constant height). Fill it with sunlight. Then go to the layer below, and every voxel there gets its illumination from the closest voxels in the previous layer (above it). Put zero light in solid voxels. You have a couple of ways to decide the "kernel", the weights of the contributions from the voxels above, Minecraft uses the maximum value found, but decreases it by 1 if the propagation is not straight down. This is the lateral attenuation, so unblocked vertical columns of voxels will get the full sunlight propagation and light bends around corners. | |
Nov 3, 2011 at 19:47 | comment | added | user10835 | Wait, so how exactly does Minecraft do it? I couldn't get exactly what you were saying... What does "every layer is gathering light from neighbor voxels in the previous layer with attenuation" mean? | |
Nov 3, 2011 at 12:18 | history | answered | Bjorn Wesen | CC BY-SA 3.0 |