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
Use `vk_use_material_textures` cvar to show new PBR material textures
for traditional rendering.
Note that they're often sampled in an incorrect colorspace, so they look
different from RT.
Fixes#711
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.
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.
Get `alignment_hole` right from the `alolcator` instead of calculating
outside.
Improve allocation slot variable naming on slot allocation selection.
Restructure internal `vk_devmem_t` fields into `internal` struct.
Make `VK_DevMemUsageTypeString` visibility scope to file-only.
Use `PRI_VKxxxFLAGS_FMT` as an inline format macro and
`PRI_VKxxxFLAGS_ARG( ... )` as an inline argument macro for that format.
Also bring back those `!!`.
PBR model used implies the following rules:
- for metals both diffuse and specular components should be tinted by
material base color.
- for dielectrics, only diffuse should be tinted, specular should remain
as is.
Partially fixes#666
Skip adding animated surfaces as static lights. We'd like them to be
static, but currently there's no distinction between immovable lights
and switchable lights or lights with dynamic emissive value.
Fixes#679
Indirect specular and diffuse have half frame resolution.
Denoiser code was incorrectly reading past the valid range for indirect
specular values. This was sometimes giving visual glitches at frame
borders.
Fixes#685
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.
Makes acid water surfaces emissive again.
However, they are not assinged proper emissive color values for direct
ray hits yet, so they do emit light, but look dar still.
Ref: #56
Only leave water surfaces directed towards "air".
This is consistent with:
- non-`kRenderNormal` surfaces, for which there's only one surface present
- opt2 for translucent surfaces, where we aim to detect medium boundary
direction based on normal-vs-ray-direction
Also add notes about translucent surfaces in general, more info about
water rendering under ref_gl, etc.
Fixes#264
Cull everything except:
- opaque geometry: to avoid shadow and reflection holes
- bleded geometry: particles and such should be visible from any angle
Alpha-tested geometries result in visual glitches when not culled
(double-sided ladders, double shadows, etc). These glitches are worse
than slightly misaligned shadows.
Translucent geometries are still matter of research.
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
Many static worldmodel surfaces still contain alternate texture chains.
That was making these surfaces dynamic, even though there's no way to
trigger these alternate anims.
Make worldmodel ignore alternate_anims when looking for animated
surfaces.
Fixes#644
Pass current entity to compute wave height. Still doesn't switch to
negative height when underwater for some reason.
And still displays water sides.
Add some notes regarding water geometry generation and drawing.
Adds `_xvk_tex_rotate` field for surface patches. Angle is specified in
degrees.
Note that it rotates the texture around origin, which might be very far
away. So offset patching might be needed to re-align.
This makes it easily switchable at any point in time.
Still not sure how to properly manage log verbosity cvars:
- cvars are loaded after initialization and map load, so we can't really
depend on saved cvar values.
- reloading cvars each frame cancels `-vkverboselogs` arg that is
supposed to work around the above limitation
Fixes a typo that rewrote roughness value with garbage.
Also adds a few more debug channel displays for lighting phases. And
prints out available debug displays.
Fixes#641
Now:
- Not necessarily vulkan-specific cvars are prefixed with `r_`
- Vulkan-specific but not RT-specific things are `vk_`
- RT-specific are `rt_`
Fixes#632
When texture coordinates are inverted, it makes tangent look into
oppsite direction, which inverts TBN and therefore normal map.
Make sure the tangent points to a consistent direction.
Fixes#627
It was using old pre-transform values for prev_verts, and that was
confusing temporal denoiser.
We should bone-transform vertices first, and only then store them as
prev_verts.
Fixes#585
Uses `_xvk_smoothing_excluded` field.
Surfaces can still be smoothed with a limited list of neightbours explicitly
by being included in a smoothing group.
Fixes#619
This is not a valid reason to assert/crash, even though it is clearly a programming mistake.
If the stack is corrupted, just print its contents as an S_ERROR and continue.
Also:
- Fix the ultimate reason for stack being unbalanced for #604
- Do not analyze scopes when not needed, i.e. when `r_speeds` is zero.
Fixes#604
Use dedicated hash table for new material names.
Updates a lot of dependent code:
- surface patches now target materials, not textures:
`s/_xvk_textures/_xvk_material`
- patching now affects only materials, not texture ids. All logic that
depends on texture ids now operate on original textures.
- brush normal smoothing now ignores patched surface materials when
deciding whether two surfaces can be smoothed.
The rationale is that patching should only affect newer PBR/RT code paths.
Legacy ref_interface_t texture access is not refcountable. It does
create/destroy texture in a single call regardless of other users.
Track it with a separate flag that affects refcount with a single +1/-1.
Too many places in the engine and the renderer expect texture names to
be insensitive: RAD files, material references, probably engine and game
calls too.
Make it universally case insensitive. Also, add rudimentary tests for
it.
Previous hash table was case insensitive, while the new one is
sensitive.
For now the workaround is to tolower texture names in rad files.
Proper way would be to address case-sensitivity globally. Currently it's
not very consistent.
Known issues:
- pbr materials are completely broken. They end up not being able to
find textures, seemingly due to memory corruption on materials side,
not textures.
- There are still places that try to get texture=1
Adds unordered_roadmap simple hash map:
- open addressing with linear probing
- size is fixed at init/compile time
- operates on an pre-allocated array of items with hashmap headers
Also adds basic tests for it.
And properly enables tests for ref_vk (i.e. alolcator)
THIS COMMIT IS BROKEN AND LEADS TO MISSING TEXTURES
There's a "race" between texture release/acquire on changelevel.
Textures end up being deleted when they shouldn't.
Addressing this is tedious, will be done in the following commits.