beyond-all-reason / beyond-all-reason/RecoilEngine
[FR] Make the sun great again
- Dominant language
- C++
- Stars
- 679
- Forks
- 290
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 40
Description
Some context: https://github.com/beyond-all-reason/spring/pull/833
Currently there is no simple (one-two callouts that just take a number) way to say "the sun is now less bright".
There is this huge table of parameters (diffuse color, specular color, shadow density, etc): https://github.com/beyond-all-reason/Beyond-All-Reason/blob/master/luarules/gadgets/map_nightmode.lua#L129-L154
And to tweak the sun (less bright, different hue) you need to apply the change to them all: https://github.com/beyond-all-reason/Beyond-All-Reason/blob/master/luarules/gadgets/map_nightmode.lua#L287-L300
There is some sort of `intensity` parameter to `Spring.SetSunDirection` which currently doesn't do anything, and is also misplaced (if anything, it belongs with sun color).
I think ideally you would set stuff like ambient light level once, and then `sunColor` (float3) and `intensity` (float) would multiply all the other parameters automatically. So for example:
* if `intensity` is 0.468 then `shadowDensity` also automatically becomes 0.468 (currently you need to set shadow density explicitly). Perhaps you can set some "base" shadow density or opt out of the automated system entirely, but the defaults would ideally work automagically.
* if ambient color of ground (or units) is `{0.2, 0.4, 0.6}` and `intensity` is 0.5 then the actual color of units automatically becomes `{0.6, 0.7, 0.8}` (currently you need to set the color explicitly, and separately from shadow density).
* in the above example, if `sunColor` is then changed to `{0, 1, 1}` then the actual color of units automatically becomes `{0.2, 0.7, 0.8}`. Perhaps `sunColor` and `intensity` should be a single float4, after all intensity is a lot like alpha, though it makes sense the current way too.
* specular is adjusted as well (currently also yet another separate entry) as well as anything else that might be missing in the BAR widget above (it's probably comprehensive, but it's burdensome to keep track of all the parameters) or that might be added in the future.
That's all ground for a larger rework though, and fairly low priority.
Contributor guide
Research direction
Start with the Spring.SetSunDirection API and compare its intensity parameter with the parameter table and updates in luarules/gadgets/map_nightmode.lua. Review PR 833 for context and trace how sun color, ambient light, shadow density, and specular settings are currently applied. Done requires an agreed design and coordinated behavior across these parameters, but the issue does not define final semantics or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, lua
- Domain
- api, computer-graphics, game-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100