Deprecate `brdf.h` usage, start writing our own BRDF functions.
Use glTF 2.0 BRDF mixing model as a simple starting point.
Mix-in base_color into specular early, as it is light-direction
dependent and cannot be easily separated.
Disable bounces for now, as we don't have yet good sampling story, need
to write "backwards" BRDFs that give us ray directions to sample, and
accommodate for that sampling bias in BRDF attenuation itself.
Also introduces some other weird artifacts on `test_material` map, investigation pending.
Related to black metals in #666
E.g. add `desert.mat` alongside `desert.ktx2` (or
`desrt_{rt,lf,...}.png` files) with the following contents:
```
exposure 0.3
```
Skybox texture color will be multiplied by this value.
Adds a few things:
- verbose logs about surface flags/type/orientation
- same about surface subdivided polys
- tries culling back water surfaces (doesn't work that well)
- tries culling in rt shaders
This still unfinished
Storing it linearly was a mistake: it is 8-bit only, and lacks enough
precision for dark values. It also doesn't really need any more
precision, and should be limited to 0..1 range.
Therefore, it makes sense to treat it as sRGB explicitly.
Make sure that all SRGB-gamma textures are marked with SRGB format (this
includes all the original textues, 8bit PNG textues). All other
textures (roughness, metallic, normal maps) are linear (UNORM).
Trust KTX2 texture that they store in the correct colorspace.
Then we can just sample textures w/o SRGBtoLINEAR'izing them. Supposedly
this is better because of hw interpolation in the correct colorspace.
This is a bit experimental because Compressonator can't really into
BC7_SRGB, which is sad. And also we need to re-gamma all the textures
for the gamma/srgb-unaware traditional renderer.
Needed to hide invisible geometry on e.g. c5a1. Breaks de_dust2 roofs
(#474). That will need to be addressed some other way.
Still uses special value for base_color texture to signal SKY SURFACE.
A supposedly better way to do this would be to have them have a special
material.
1. Completely remove them from geometries
2. Draw skybox where the ray hasn't hit anything
3. In the same fashion sky is not shadowed when there's nothing hit by
the shadow ray.
This allows completely removing the sky material flag.
Also supposedly fixes#474
This is to more clearly distinguish between simple blended things that
don't participate in lighting, and future more involved blending with
refraction and being affected by light
Known issues:
- apparently BLEND_MIX surfaces should also participate in lighting. Figure out how.
- sensitive to ray tracing order. Need proper OIT (or hacks)
They have mismatching frequencies. ModelMetadata should be per-Model, there should be only a few dozen of these.
There maybe hundreds (or even thousands) of materials, but one material can be still referenced by many kusochki.
This only moves fields into new structs, which still belong to Kusok. The real extraction will happen later, see #52.
de_cbble contains a bunch of floating boxes, which makes sunlight leak if internal back-facing surfaces are culled.
Generally, we should not be culling ray traced triangles (unless absolutely necessary for correctness), as it makes the shader perform additional unnecessary checks.
Try disabling culling universally and see whether it breaks anything.
Fixes#507