avaraline / Avara

Port of the original 1996 game from Ambrosia Software.
MIT License
122 stars 19 forks source link

Implement accurate lighting that honors level-specified values #7

Closed rherriman closed 4 years ago

rherriman commented 6 years ago

From the Avara Level Design Manual:

  // Lights (default light settings are stored here)
  ambient = 0.4
  light[0].i = 0.4  light[0].a =  45  light[0].b = 20
  light[1].i = 0.3  light[1].a =  20  light[1].b = 200
  light[2].i = 0.0  light[2].a =  45  light[2].b = 90
  light[3].i = 0.0  light[3].a =  45  light[3].b = 180

There are four posible light sources in addition to ambient light. To place a lightsource, give it an intensity (the i component) between 0 and 1.0. The two angles indicate the direction that the light is coming from. The b angle is the compass reading and the a angle is the angle from the horizon. All lights are monochromatic white.

avara_frag.glsl should be modified to handle multiple (configurable) directional light sources, and similarly allow the ambient light to be configurable.

avara-3d-math

assertivist commented 5 years ago
rherriman commented 5 years ago

I wasn’t really thinking that the input values were incorrect, just that the directional lights generated from them were incorrect. But I don’t really understand shaders at all!

Interesting point about the rotated block normals... and lends an explanation as to why the ramps are screwed up, too: in Avara, ramps are really just blocks that are scaled and rotated into place. If you fix the issue, I am pretty confident the lighting will look completely correct.

On May 5, 2019, at 5:01 PM, andy notifications@github.com wrote:

Just realized that the above screenshot had ambient turned off, and Grimoire definitely sets a custom one. so here's an updated screenshot:

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

assertivist commented 4 years ago

this is probably as close as we're going to get: image