Skip to content

Omnilight shadow map wgsl#15

Merged
cart merged 3 commits intocart:pipelined-renderingfrom
mtsr:omnilight_shadow_map_wgsl
Jul 1, 2021
Merged

Omnilight shadow map wgsl#15
cart merged 3 commits intocart:pipelined-renderingfrom
mtsr:omnilight_shadow_map_wgsl

Conversation

@mtsr
Copy link

@mtsr mtsr commented Jun 30, 2021

Replaces #9 with a version using wgsl

@mtsr mtsr mentioned this pull request 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;
Copy link
Author

Choose a reason for hiding this comment

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

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...

Copy link
Owner

Choose a reason for hiding this comment

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

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?

Copy link
Author

Choose a reason for hiding this comment

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

Yes. I'm also not sure what other projections make sense, except maybe infinite reverse.

@cart cart force-pushed the omnilight_shadow_map_wgsl branch from bd87a1f to 955853d Compare July 1, 2021 23:48
@cart cart merged commit 30e4b8d into cart:pipelined-rendering Jul 1, 2021
cart pushed a commit that referenced this pull request Jul 24, 2021
cart pushed a commit that referenced this pull request Jul 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants