Repository navigation
Reflect the playfield in the balls, light ray-traced reflections with every lamp, and toggle depth of field - #38
Merged
Merged
Conversation
…on missing screenshots
…he light cluster to the playfield. HDRP's ray tracing light cluster is a fixed 64x32x64 grid around the camera. At the default range, the playfield fell into a few 30 cm cells, many of them holding more lamps than a cell can, and HDRP leaves the extra lamps out of the reflections. Every frame, the range now shrinks to the smallest cube around the camera that still holds the playfield up to the glass, which keeps the cells a few centimetres wide. A LightCluster component is added when a ray-traced effect is on and the profiles have none. Lamp lights are now included in ray tracing. The bulb models had left it off, and packages exported with them still do.
Each ball gets a reflection probe the size of the ball. A custom pass fills its cubemap from the frame the camera just rendered: every direction is marched through the depth buffer, which finds what stands on the playfield, and falls back to where it meets the playfield plane, or to the sky. HDRP applies the cubemap through each ball's own material, so every ball look keeps working, and SSR still wins where it finds a hit. The graphics applier puts the component on the main camera while the setting is on. Turning it off restores the camera's frame settings. It costs about 0.14 ms of GPU and 0.35 ms of CPU time per ball.
…mera's frame settings. The applier handles VpeGraphics.SetDepthOfField by adding the auto focus to the main camera, or restarting it so it finds the volume a table load brought. The auto focus' compute shader moves to Resources (same GUID), so a camera that gets the component at runtime still finds it. Ball reflections and the auto focus both turn on the camera's custom pass frame setting. CameraFrameSettings counts who needs a field and restores the camera's own value only when the last one lets go, so turning one off no longer switches the other's pass off.
[Medium impact] The latest change appears safe to merge and fixes the previously reported depth-of-field issue. SummaryAdds playfield reflections in balls, fits ray-traced lighting around the playfield, and supports runtime depth-of-field controls.
Reviews (2) · Last reviewed commit: "graphics: turn a table's own depth of fi..." · Reviewed by Greptile |
Switching depth of field off only stopped the auto focus, so a table whose profile brings a depth of field of its own stayed blurred: with no auto focus on the camera nothing touched it, and an auto focus that was already off didn't reach the volume a new table load brought. Off now sets the focus mode off on every global volume the camera sees.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
HDRP side of the player's new graphics options: the balls reflect the playfield, ray-traced reflections see every lamp, and depth of field can be toggled at runtime. It implements the hooks added in freezy/VisualPinball.Engine#612 and needs that PR.
Summary
LightClusteris added when a ray-traced effect is on and the profiles have none. Lamp lights are included in ray tracing.VpeGraphics.SetDepthOfFieldby adding the auto focus to the main camera, or restarting it so it finds the volume a table load brought. The auto focus compute shader moves toResources(same GUID), so a camera that gets the component at runtime still finds it.CameraFrameSettingscounts who needs a field and restores the camera's own value only when the last one lets go, so turning one off no longer switches the other's pass off.Testing