Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some cubemap reflections issues #1311

Merged
merged 15 commits into from
Sep 25, 2024

Conversation

VReaperV
Copy link
Contributor

@VReaperV VReaperV commented Sep 17, 2024

Fixes:

  • Reading data into cubemaps

  • Texture coordinates on debug probes when using r_showCubeProbes on

  • Overbright on debug probes

  • A culling issue when used with the material system

  • Incorrect texture bind

  • Colour grading setup for the reflection cubemaps

  • Also made the highligting of the selected cubemaps use an outline so the contents of the cubemap can still be seen.

  • Added r_showCubeProbeFace and r_showReflectionMaps for debugging.

  • Added r_cubeProbeSize to allow for custom reflection cubemap sizes.

  • Hash epsilon for cubemaps hashTable slightly increased.

See below for screenshots.

The reflections also correctly show up on surfaces (although the cubemap selection is still bad).

@VReaperV
Copy link
Contributor Author

Added a fix to stop UI from being rendered into the cubemaps, and added an r_showCubeProbeFace cvar to aid with debugging.

@VReaperV
Copy link
Contributor Author

The cubemaps are pretty much rendered correctly now, however there's some bug with cameraEffects_fp shader's colour grading that results in those images getting completely black in the end. Commenting out that part makes them work correctly. Not sure what the issue with colour grading is yet, the texture itself seems to be correct, and the texture coordinates are based on colour.

@VReaperV VReaperV force-pushed the fix-cubemap-reflections branch 2 times, most recently from 259ac9a to 3fd7a50 Compare September 19, 2024 18:41
@VReaperV
Copy link
Contributor Author

Fixed the issue with colour grading now. This now properly renders cubemaps, the reflections work.

@illwieckz
Copy link
Member

AMD Radeon PRO W7600 (navi33), Mesa 24.0.9 radeonsi, Linux:

20240919-214537-000.unvanquished-relief-mapping.webm

@illwieckz
Copy link
Member

I can actually see the reflection:

unvanquished_2024-09-19_215633_000

Of what's behind me:

unvanquished_2024-09-19_215639_000

@VReaperV
Copy link
Contributor Author

Good. This is pr is more less ready, I just wanna see if I can add a couple more settings/debug cvars for this.

@illwieckz
Copy link
Member

I can clearly recognize what is reflected, good job!

unvanquished_2024-09-19_220755_000

unvanquished_2024-09-19_220814_000

@VReaperV
Copy link
Contributor Author

Thanks! I'll see if I can add a cvar to be able to set the size of reflection cubemaps as well.

@VReaperV
Copy link
Contributor Author

Added a cvar to see only the reflections themselves.

src/engine/renderer/tr_bsp.cpp Fixed Show fixed Hide fixed
src/engine/renderer/tr_bsp.cpp Fixed Show fixed Hide fixed
src/engine/renderer/tr_bsp.cpp Fixed Show fixed Hide fixed
src/engine/renderer/tr_bsp.cpp Fixed Show fixed Hide fixed
src/engine/renderer/tr_bsp.cpp Fixed Show fixed Hide fixed
@VReaperV VReaperV force-pushed the fix-cubemap-reflections branch 5 times, most recently from 2400b08 to ed01ebf Compare September 19, 2024 22:49
@VReaperV
Copy link
Contributor Author

VReaperV commented Sep 19, 2024

All of these use r_cubeProbeSize 256:

Plat23:
unvanquished_2024-09-20_020729_000
Correct r_showCubeProbes on rendering:
unvanquished_2024-09-20_022316_000
r_showReflectionMaps on:
unvanquished_2024-09-20_022614_000

td:
unvanquished_2024-09-20_023429_000
unvanquished_2024-09-20_023441_000

Vega:
unvanquished_2024-09-20_023555_000
unvanquished_2024-09-20_023644_000
r_showReflectionMaps on:
unvanquished_2024-09-20_023722_000
unvanquished_2024-09-20_023829_000

Usstremor:
unvanquished_2024-09-20_024307_000
r_showReflectionMaps on:
unvanquished_2024-09-20_024434_000

@VReaperV VReaperV added the T-Improvement Improvement for an existing feature label Sep 19, 2024
@VReaperV
Copy link
Contributor Author

More screenshots by @illwieckz:
image
unvanquished_2024-09-20_002830_000
unvanquished_2024-09-20_003418_000
unvanquished_2024-09-20_004302_000
unvanquished_2024-09-20_004619_000

@VReaperV VReaperV force-pushed the fix-cubemap-reflections branch 3 times, most recently from 16ac017 to 065da5e Compare September 20, 2024 14:09
This allows seeing the contents of the selected cubemap.
The comment about a bugfix seems to be wrong since:
1. We only run it at 32x32
2. It tries to read out of bounds data, so it was never correct in the first place
@VReaperV
Copy link
Contributor Author

I've added a commit that stops probes from being added in the void. There are still some around patch meshes though. Skies also tend to generate some in unreachable areas, due to how skybrushes are placed.

src/engine/renderer/tr_backend.cpp Outdated Show resolved Hide resolved
src/engine/renderer/tr_bsp.cpp Show resolved Hide resolved
src/engine/renderer/tr_init.cpp Show resolved Hide resolved
Copy link
Member

@slipher slipher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drawing the cubemap images with r_showCubeProbes still doesn't seem quite right. The image can change discontinously with a slight movement and for some reason it's all white a lot of times. I guess it's better than before though

src/engine/renderer/tr_scene.cpp Outdated Show resolved Hide resolved
src/engine/renderer/tr_scene.cpp Outdated Show resolved Hide resolved
src/engine/renderer/tr_backend.cpp Outdated Show resolved Hide resolved
@VReaperV
Copy link
Contributor Author

Drawing the cubemap images with r_showCubeProbes still doesn't seem quite right. The image can change discontinously with a slight movement and for some reason it's all white a lot of times. I guess it's better than before though

Yeah, noticed both of that too sometimes, don't know the reason yet though.

Debug option: render from the perspective of a selected face of a cubemap after the static reflections cubemaps are built. The index is a global index, where each 6 consecutive indices correspond to one cubemap; -1: disabled.

.
This should help a bit with reflections disappearing until a proper solution is implemented.
Debug cvar to see only what gets reflected. This requires running `/buildcubemaps` *after* `/vid_restart`.
Add a cvar to set static reflections cubemaps size.
Copy link
Member

@slipher slipher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

src/engine/renderer/tr_scene.cpp Outdated Show resolved Hide resolved
@VReaperV VReaperV merged commit 5d689e4 into DaemonEngine:master Sep 25, 2024
9 checks passed
@VReaperV VReaperV deleted the fix-cubemap-reflections branch September 25, 2024 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Renderer T-Bug T-Improvement Improvement for an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants