nint22 / dwarfcraft

Automatically exported from code.google.com/p/dwarfcraft
Other
0 stars 0 forks source link

Create basic lighting system #12

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
"Basic" meaning per vertex bind a color. Consider: Gaussian lighting? What 
about shadows, or hidden volumes? What about doing an iteration-down approach 
with lighting?

Original issue reported on code.google.com by nin...@gmail.com on 26 Oct 2011 at 10:11

GoogleCodeExporter commented 9 years ago
Implementation / design ideas:

1. Add a 3-float color to each cube point (but for now, we just assume the same 
light)
1.1: What if it comes from a 30 degree angle, so the left sides are more 
visible, then front, then top etc.. Math is basically just take the dot-product 
and apply the light constant. 
2. Apply a top-to-bottom "sun" cast, where any cube that faces (sans 
obstruction) up; value is 1
3. For each light surface, apply a linear decay function in all three 
dimensional spaces

Original comment by nin...@gmail.com on 27 Oct 2011 at 8:47

GoogleCodeExporter commented 9 years ago
Added torch and lava item for testing. Doing research on Minecraft's approach. 
Currently there are three light sources:

1. Sun
2. Lit surface
3. Artificial (torches, lava, etc.)

1 and 3 are self-evident as to how they work; 2 is used as a method of making 
the scene look more realistic. The sun applies 100% to any visible surface, 
while 2 applies a secondary application of light.

Current approach: (linear-decay pass)
Init: Create a "light map" octree
1. Apply all source lights onto source blocks (i.e. sun applies to 
non-obstructing surfaces & light sources)
2. For each world block that has light, bleed to adjacent visible blocks with 
slightly less light
3. Repeat 2 up to n blocks (n being a "fudge" value around 3-5?)

Original comment by nin...@gmail.com on 30 Oct 2011 at 1:59

GoogleCodeExporter commented 9 years ago
Implemented a simplified version of the above mentioned system.

Original comment by nin...@gmail.com on 30 Oct 2011 at 2:05

GoogleCodeExporter commented 9 years ago
Closing; will open new bug for torches when the time comes.

Original comment by nin...@gmail.com on 8 Jan 2012 at 10:27