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

Configurable Parallax Depth Settings #1129

Closed
tsa96 opened this issue Nov 1, 2020 · 6 comments
Closed

Configurable Parallax Depth Settings #1129

tsa96 opened this issue Nov 1, 2020 · 6 comments
Assignees
Labels
Outcome: Resolved This was resolved, and will be in a future update. Priority: Low Something not very essential to the release, can be done in free time and bumped back if needed. Size: Medium Something that may take a few days or so to implement. Type: Enhancement This can improve a system/thing already in place.

Comments

@tsa96
Copy link
Member

tsa96 commented Nov 1, 2020

What feature is your improvement idea related to? Please describe.
Currently PBR textures with high parallax occlusion depth show significant "layers", due to a relatively low hardcoded value within the shader code

Modern graphics cards can comfortably handle a higher value than this (my GTX 960 has a 5-10% performance drop on a shader compiled with the value set to 128, when surrounded by 2048x2048 parallax textures).

Additionally, the constant numSteps value means doing a needless number of steps for textures with a very low depth value.

Describe the solution you'd like
Pass a new value into the shader to vary the number of steps proportional to both the $parallaxdepth parameter and a graphics setting. Ideally this would be something configurable in the video settings, though if this requires engine access it could depend on the Texture Detail (mat_picmip) setting (as far as I can tell, the maximum setting ("Very High", mat_picmip -1) doesn't even affect texture scaling).

I suggest having the numSteps value range based on the mat_picmip setting with:
Medium Texture Scaling (picmip 1) - Min: 4, Max: 16
High Texture Scaling (picmip 0) - Min: 8, Max: 32
Very High Texture Scaling (picmip 1) - Min: 16, Max: 64
linearly interpolated between $parallaxdepth of 0 and 0.1. (0.1 is a considerably high depth).

Most textures with mild parallax detail have a depth of around 0.02 - 0.05, so this shouldn't result in any performance loss for anyone unless (a) they're in an area with a lot of highly parallaxed textures and (b) they're running with "Very High" texture settings. Most users who select "Very High" likely have GPUs will comfortably maintain 300+ FPS regardless.

Note that POM is only included in PBR ps30, which has 224 constant registers, so passing new parameters to the shader isn't an issue as with features compatible with ps20b.

Describe alternatives you've considered, if any
Its own graphics setting would be nice, or just a cvar, but it would be best to ensure people with decent machines who've selected highest possible graphics settings have this change by default.

Additional context
Here's a texture with $parallaxdepth 0.1 on Steam build (20 slices) with very visible layering appearing.

@tsa96 tsa96 added the Type: Enhancement This can improve a system/thing already in place. label Nov 1, 2020
@Gocnak Gocnak added Priority: Low Something not very essential to the release, can be done in free time and bumped back if needed. Size: Medium Something that may take a few days or so to implement. labels Nov 16, 2020
@Gocnak Gocnak added this to To Do in 0.9.0 Release via automation Mar 13, 2021
@tsa96
Copy link
Member Author

tsa96 commented Mar 13, 2021

Just to note, there's two chunks of essentially the same parallax code in https://github.com/momentum-mod/game/blob/5f8c817b3bc8b4e123b9ae442d092b60fe5db707/mp/src/materialsystem/stdshaders/pbr_common_ps2_3_x.h , if we're just changing the value for now,

and

@Gocnak Gocnak moved this from To Do to In Progress in 0.9.0 Release Mar 23, 2021
@Gocnak
Copy link
Member

Gocnak commented Mar 23, 2021

Added as the convar mat_pbr_parallaxmap_quality. To be tested in next push.

@Gocnak Gocnak added the Blocked: Needs testing & verification Needs testing and verification if properly fixed. label Mar 23, 2021
@Gocnak
Copy link
Member

Gocnak commented May 6, 2021

@tsa96 Is this implemented as expected?

@tsa96
Copy link
Member Author

tsa96 commented May 9, 2021

This impression I got from testing was that the maximum setting (I believe 256 slices) was needlessly high and easily causing performance issues, so I'd suggest lower the max down to 128. Besides that it's great!

@Gocnak Gocnak added Outcome: Resolved This was resolved, and will be in a future update. and removed Blocked: Needs testing & verification Needs testing and verification if properly fixed. labels May 30, 2021
@Gocnak
Copy link
Member

Gocnak commented May 30, 2021

Done, that tweaking will be another card.

@Gocnak Gocnak closed this as completed May 30, 2021
0.9.0 Release automation moved this from In Progress to Done May 30, 2021
@SCell555
Copy link
Member

This still needs to get implemented in DX11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Outcome: Resolved This was resolved, and will be in a future update. Priority: Low Something not very essential to the release, can be done in free time and bumped back if needed. Size: Medium Something that may take a few days or so to implement. Type: Enhancement This can improve a system/thing already in place.
Projects
No open projects
0.9.0 Release
  
Done
Development

No branches or pull requests

3 participants