Omnilight shadow map wgsl#15
Merged
cart merged 3 commits intocart:pipelined-renderingfrom Jul 1, 2021
Merged
Conversation
Closed
mtsr
commented
Jun 30, 2021
Comment on lines
+360
to
+368
| // do a full projection | ||
| // vec4 clip = light.projection * vec4(0.0, 0.0, -major_axis_magnitude, 1.0); | ||
| // float depth = (clip.z / clip.w); | ||
|
|
||
| // alternatively do only the necessary multiplications using near/far | ||
| let proj_r = light.far / (light.near - light.far); | ||
| let z = -major_axis_magnitude * proj_r + light.near * proj_r; | ||
| let w = major_axis_magnitude; | ||
| let depth = z / w; |
Author
There was a problem hiding this comment.
This is something that should be discussed. This bit trades a full matrix multiplication for these couple of lines, but at the cost of needing to update the shader if the light projection changes.
Because it's in the fragment shader it might be worthwhile as an optimization, but early optimization etc etc...
Owner
There was a problem hiding this comment.
I think this is reasonable for now, given that the projection needs to be a 90 degree field of view to fully cover the cube map. Any more would result on overlap, any less would result in gaps right?
Author
There was a problem hiding this comment.
Yes. I'm also not sure what other projections make sense, except maybe infinite reverse.
bd87a1f to
955853d
Compare
cart
pushed a commit
that referenced
this pull request
Jul 24, 2021
cart
pushed a commit
that referenced
this pull request
Jul 24, 2021
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.
Replaces #9 with a version using wgsl