Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Lighting: Colors  (Read 417 times)

RavingManiac

  • Bay Watcher
    • View Profile
Lighting: Colors
« on: August 13, 2009, 04:20:38 am »

This suggestion adds on to Footkerchief's lighting thread:
http://www.bay12games.com/forum/index.php?topic=27999.0

Essentially, instead of having a fixed range of tiles around a light source being "lit" or "unlit", light sources emit light in the three primary colors - red, blue and green. Depending on the light source, the amount of each color being emitted varies. In addition, the tiles being lit have three variables, each recording how much red, blue and green light is shining on the tile. This will give the tile and all objects and creatures in it a slight hue.

The end result - The halls of the fortress will be tinted blue by hanging orbs of luminous fungi. The forges are lit orange by the sweltering heat of magma.  Stained glass ceilings filter out the sunlight, casting patterns on the floor. Overall, a much more colorful, vibrant fortress.
Logged
Thief:"Quiet kitty, Qui-"
Cat:"THIEF! Protect the hoard from the skulking filth!"
The resulting party killed 20 dwarves, crippled 2 more and the remaining 9 managed to get along and have a nice party.

Hungry

  • Bay Watcher
  • Former controller of Zombie Fenrir
    • View Profile
Re: Lighting: Colors
« Reply #1 on: August 13, 2009, 06:53:35 am »


  From what I understand of lighting issues, this is not the best aproach and would leave lots of "what kind of rock is this" problems around but the method is sound.
What I grasp of colored light in acii It sould be accompanied with a "coated with __ __ colored light" mechinism, that is only removed when exiting light source line of sight, and color based on item light generation color, which I should go in detail as illumination on said coated object is most probably Color+Intesity/Distance=Final light color and intesity coating, an example Illumination is 5 tiles from coated object and has an intensity of 3 tiles and is 255,0,0 monochromatic red, at its distance it would be just 2 tiles outside the optial illumination and be reduced in intensity, to put this into more elegant lighting function you'd need to set several different lighting grades, say well lit, fairly lit, poorly lit, unlit, and darkness for example in my previous example the objects in the closer three tiles would be well lit, the objects in the next three would be fairly lit and so on not taking shadows, reflection, or object color into place.

  Conserning shadows an algorithm to determine LOS would be best with recheck from the illumination point only when moved or when objects in LOS change as for the object would have to check its own coating when sighted or checked, as to the working of that the issues of sight are adressed.
  Viewed color would have to be determined by object color and illumination color and intensity...mutiple color chains make this harder to determine, say an object is 25,53,71 and is coated with 255,135,68 Intensity poorly lit what color derived would have to be determined for it?...ect...refraction is a part to this as this object would illuminate with this newly derived color with a contined intesity LOS, which gives a new illumination color to be combined with other object's colors till light intensity is gone, and your left with one light in a room making 30+ colors which makes color changing an annoying algorithm to make...much as it sounds it would be life-like.....simplest way to put this would be to say that color reflection is a pain in programer asses of many mediums.

Fire is a diferent story...one told best by a pyrotechnition, and I'm not one....
Logged
Breccia isnt in DF, like garden slugs.
Cheese for the Cheese boat!

Bricks

  • Bay Watcher
  • Because you never need one brick.
    • View Profile
Re: Lighting: Colors
« Reply #2 on: August 13, 2009, 10:42:13 am »

While I know it is vastly oversimplifying things, and my optics class was mostly dumbed down to the point where we were handed the answers...

The other day I spent some time (not long, mind you) observing the way light was emitted from an LED flashlight.  I saw separate 'cones' of light, one for the direct beam, one dimmer cone for light scattered randomly before exiting the flashlight, and then a small mirror-like reflection from the immediate source.  Assuming you have something like a hallway with a recessed torch, it seems like you could have a single LOS detection for the light that only pays respect to walls (with perhaps a [OBSCURING] tag for those hulking or umbral baddies), then an ambient light circle that radiates from the center and hits the walls that also spacefill from the torch (so unconnected but nearby hallways wouldn't be lit).  Also see http://en.wikipedia.org/wiki/Phong_shading and http://en.wikipedia.org/wiki/Gouraud_shading.

Granted, in a more complicated, z-level spanning scenario, I'm not sure how this would play out.  Hope my description isn't too confusing.

As far as light confusing what mineral happens to be in a certain level, I'm usually too thick to remember anyway.  Just being shaded slightly different (no matter what the color) is enough for me.  Presumably pure-color lights would be rare.
Logged
EMPATHY - being able to feel other peoples' stuff.