This is now a "mix" between the original and the alternate drawing
strategy, hopefully combining its strength. In detail:
1. Intensity of light sources aren't added together anymore. Instead,
the brightest light source decides end brightness pre-smoothing.
2. For smoothing, we update normals more quickly than brightness. This is
the main change relative to the first "alternate" version. Actually
quite embarassing that I didn't think of this solution before %)
This is still a tad busier than what we have currently, simply due to
normals changing around more quickly. On the plus side, Clonk faces
shouldn't go dark anymore while walking, so that's something.
Color value is now uint32_t, removed superfluous conversion to unsigned value, simplification in the shader.
Open: C4DP_Last and number of drawing passes
The color of object lights can now be changed. This includes the following changes:
- added light test scenario, based on DarkCastle, with some lights,
- new functions SetLightColor() and GetLightColor() with C4Script documentation,
- third drawing pass for rendering the light color, the drawing passes are now referenced by enum,
- the blending of light from multiple colored light sources works correctly with alpha blending,
- light color value affects the intensity of the light,
- alpha blending of the light depends on color value and lightness. This means that brighter (= more value) and lighter (= more whiteish) light will be preferred in blending over other lights,
- the object light color is rendered to the lower half of the fow light texture now,
- the shader accesses the brightness/direction information and color information correctly,
The patch was created from the following commits:
dab898a SetLightColor()
f57286e Color texture experiment
d0702f5 Dynamic color
fa14cdf Light test scenario
f99203d Alternate lights
474bade Bugfixes
3113698 Brightness handled better
516fb21 GetLightColor
1d91ec9 Improvements
3cfbf6c Documentation
95ec185 Improvements: Light Shader
a63bffc Scope of alpha
20c7ca0 Improvement: C4FoWLight
17d9123 Undo code style
d79411b Cleaner code
(cherry picked from commit 36dec610e36860b88417e91ce727250673bc2ec2)
Conflicts:
src/landscape/fow/C4FoWRegion.cpp, merged
- Increase light fade-in/fade-out quite a bit (4 times stronger)
- Fixed normal jump when multiple lights intersect (will make things a
little less nice with only one light, but this takes priority)
- Don't draw objects without light in light-debug mode
This allows to see the whole landscape without any areas covered by FoW
in the global viewport. Basically the ambient lighting is set to 1.0
independent of the ambient light map. In the course of this, a second
shader for the landscape has been introduced.
This allows to ignore slice declarations using `#define slice(x)`, which
mill be useful for custom mesh material shaders, allowing to write them
such that they can be used standalone in a mesh viewer but also as slices
for OpenClonk, in which case lighting and color modulation will be applied
automatically.