sadx-dc-lighting icon indicating copy to clipboard operation
sadx-dc-lighting copied to clipboard

Palette Lighting API

Open michael-fadely opened this issue 7 years ago • 11 comments

As mentioned in other issues (such as #20), the Dreamcast mods would benefit greatly from an API allowing them to control palette selection and lighting parameters manually. With this issue, I intend to outline all the functionality required by such an API to determine feasibility and implementation method.

So far, we know that the following would be a great help (if I've forgotten anything, let me know @PiKeyAr):

  • [x] LandTable specular toggle (see #20)
  • [x] Palette selection (expose LanternInstance::SetPalettes)
  • [x] Separately-addressable palette selections (implement and expose LanternInstance::SetDiffuse and LanternInstance::SetSpecular)

As a bonus, the following would be nice for otherwise custom palette handling by misc. mods:

  • [x] Palette file overrides (provide a callback interface so that a mod can indicate that it has a suitable replacement)
  • [x] Expose d3d::SetShaderOptions for toggling fog, lighting, alpha, blending, etc.
  • [ ] Implement explicit multi-palette support (e.g. Sky Deck multi-palette)

Some more ideas from @PiKeyAr:

  • [x] Possibility to blend between diffuse A/specular B and diffuse A2/specular B2 without touching other palettes
  • [x] A "disable built-in vertex colors" switch for objects described in #50. This isn't material-specific though... Basically anything that loads a non-level PVM/texlist has all its vcolors nullified if this is on.
  • [x] A "force default material color" switch. Basically set the material's R G B to B2 if this is enabled. Or better yet, have this on by default and have a "use built-in material color" flag for special cases.
  • [x] Parse only the first material in the model to determine whether the model ignores specular.
  • [x] Parse specular color 0x00000000 as "ignore specular".
  • [x] The "environment mapping on -> force object specular" condition is only getting in the way of accuracy at this point, and I suggest removing it or making it optional (disabled when the landtable specular switch is on).
  • [x] White diffuse+specular (currently implemented via manual palette selection, sometimes with modified PL files)
  • [x] If a material doesn't have the "use texture" flag, it doesn't get specular applied.
  • [x] Material overrides that persist across PL file changes (Sky Deck)
  • [x] Expose the alpha rejection value so that a mod could change it in real time
  • [x] Light direction override
  • [x] Palette override that works similarly to set_diffuse/set_specular but replaces the entire diffuse/specular palette with a specified color
  • [x] Blending between a palette and a specified color
  • [x] Adding a specific color on top of an existing palette? (Egg Viper)

michael-fadely avatar Feb 17 '17 03:02 michael-fadely