-
Notifications
You must be signed in to change notification settings - Fork 1
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
Investigate possibility of a custom 'flipped depth' prepass in bevy #15
Comments
This may be achievable without a custom prepass - since separate shaders can be specified for the main pass and prepass, using a vertex shader to flip normals in one of them would allow use of rasterized fragment depth in conjunction with the pre-rendered (flipped) depth texture. In which case, would probably have to switch to front-face culling instead of no culling; ensures backsides are always available while allowing a vertex shader to control visibility via flip. |
Also worth investigating prepass / shadow interaction; may be a route to making SDFs cast shadows. |
Access to the depth prepass texture from Rust shaders is blocked on a combination of limited
|
Might be able to work around this similarly to uniform vs storage buffers - i.e. by forcing bevy to use a simpler depth texture format. |
Ended up being a naga bug - patching SPIR-V passthrough into bevy results in correct behaviour. However, the flipped-depth operation is not achievable without a custom prepass, or specialized vertex shader logic that isn't general enough for the use case. Reprojection code is in place for when this becomes available, but a working implementation will have to wait on upstream. |
Since rasterized depth can be used as a free start / end distance for raymarching, using prepasses to make both front-side and back-side depth available would ensure maximum performance regardless of whether the camera is inside or outside a given SDF's bounding mesh. (Prepass perf overhead notwithstanding.)
The text was updated successfully, but these errors were encountered: