There are lots of empirical (and less-well undrestood things) scaling
color values in native code, it makes sense to consolidate them in one
place:
- less weird math in shaders. shader should be as streamlined as
possible
- one big block of weird math is untangleable in the future when we get
to work on light and clusters
1. Sample point lights as spheres. Use existing pdf value (`one_over_pdf`), as it was basically correct.
Compute max_theta angle based on light radius and distance to the
center. Sample cone direction based on this theta angle, in z=n space.
Don't do anyhting fancy wrt horizon, etc.
2. Sample environment light with max theta derived from real world sun
solid angle. Uses the same cone direction sampling.
Known issues:
- still get some NaNs sometimes, esp. on test_light map.
- Too many different light sources try to use the same code. They should
be split.
Relevant issues: #266, #151
Introduce several shader debugging/validation tiers:
1. Basic key values validation, to make sure there are no nasty NaNs or
invalid values written to G-buffers. Enabled by `DEBUG_VALIDATE` macro
in debug.glsl
2. Key value validation with whining: use `debugPrintfEXT()` function to
report any invalid values to Vulkan validation layers. Enabled using
`DEBUG_VALIDATE_PRINT` macro. Currently this is the one enabled, as
it allows us to catch any serious numerical issues during development
and testing.
3. Extra validation and printing for intermediate values. This is for
deeper investigations, and enabled only there temporarily.
- Turn off old-vs-new brdfs comparison.
- Enable picking up specular bounces.
- Use the same final color mixing for bounces too (except for legacy
blending, which will remain suboptimal)
Found out that it wasn't really clearing anything.
Now it does call clear, but still there are temporal denoising
artifacts. The issue remains elusive.
Related: #661
For some very unknown reason there's a line that fixes image size to
w*h*4, which would correspond to RGBA8 pixel format w/o alignment.
This is extremely incorrect for other pixel format, e.g. compressed
ones.
Not sure why this size-fixing was there, but removing it fixes sided
KTX2 compressed skybox corruption.
Engine imagelib already has skybox loader. It uses rgbdata_t
IMAGE_CUBEMAP flag.
1. Support IMAGE_CUBEMAP
2. Utilize imagelib skybox loader, do not try to load individual skybox
sides manually.
This will allow loading KTX2 cubemaps directly.
Known issues:
1. Compressed KTX2 sides are not rotated correctly. Engine/imagelib is
unable to rotate compressed images.
2. Some KTX2 sides are corrupted. Cause unknown.
- Do not load skybox at all if there are no SURF_DRAWSKY, #706, #579
- Do not reload the same skybox, #706
Also refactor skybox loading a bit. Prepare for KTX2 skyboxes.
They don't really belong to neither rt_model_t, nor render model.
Allows having dynamic polylights for func_water entities without "main"
render model, and only water submodels.