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

Draw frustum splices on top of direction shadow atlas for debug purposes #77085

Conversation

BastiaanOlij
Copy link
Contributor

@BastiaanOlij BastiaanOlij commented May 15, 2023

To help debug issues with directional shadows this PR introduces a mechanism of drawing the view frustum splices into the directional atlas when displayed in the interface:

image

This will help with setting up better splits and to see if we're effectively culling out objects that do not need to be drawn into the shadow map.

@BastiaanOlij BastiaanOlij added this to the 4.1 milestone May 15, 2023
@BastiaanOlij BastiaanOlij self-assigned this May 15, 2023
@BastiaanOlij BastiaanOlij requested a review from a team as a code owner May 15, 2023 04:14
@BastiaanOlij BastiaanOlij force-pushed the visualise_direction_shadowmap_frustum branch 3 times, most recently from 5e891bc to 2b23361 Compare May 15, 2023 04:26
@BastiaanOlij BastiaanOlij force-pushed the visualise_direction_shadowmap_frustum branch from 2b23361 to 2bda4e7 Compare May 23, 2023 03:32
@BastiaanOlij
Copy link
Contributor Author

Added some wireframe lines to make it easier to recognise the frustums.

Note that the frustums drawn are based on their actual application, so we break the main frustum up like so:
frustum

If overlap is enabled the drawn frustums include the overlap.

@Calinou
Copy link
Member

Calinou commented May 23, 2023

If overlap is enabled the drawn frustums include the overlap.

This should be mentioned in the class reference 🙂

@BastiaanOlij BastiaanOlij force-pushed the visualise_direction_shadowmap_frustum branch from 2bda4e7 to 63e72be Compare May 26, 2023 03:04
@BastiaanOlij BastiaanOlij requested a review from a team as a code owner May 26, 2023 03:04
@BastiaanOlij
Copy link
Contributor Author

This should be mentioned in the class reference 🙂

@Calinou added a description, let me know if this is clear enough

@BastiaanOlij BastiaanOlij force-pushed the visualise_direction_shadowmap_frustum branch from 63e72be to a952eb8 Compare May 26, 2023 03:06
@BastiaanOlij
Copy link
Contributor Author

One more change I thought was worth it, the shadowmaps are squashed vertically because we're rendering to 1/4th of the screen. The shadowmaps however are a square. So I changed the logic to keep the aspect ratio:

image

@BastiaanOlij BastiaanOlij force-pushed the visualise_direction_shadowmap_frustum branch 2 times, most recently from 8a7ed7e to dc78f27 Compare May 26, 2023 06:24
@BastiaanOlij
Copy link
Contributor Author

And one more little enhancement. The last cascade now shows all slices with only the final slice having a wireframe:
image

This more clearly communicates the relationship between the slices and the total coverage.

@BastiaanOlij BastiaanOlij force-pushed the visualise_direction_shadowmap_frustum branch from dc78f27 to b92fa3c Compare May 26, 2023 06:47
Copy link
Member

@clayjohn clayjohn left a comment

Choose a reason for hiding this comment

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

Just some nitpicky formatting comments, otherwise this looks good to go

doc/classes/RenderingServer.xml Outdated Show resolved Hide resolved
servers/rendering/renderer_rd/effects/debug_effects.cpp Outdated Show resolved Hide resolved
@BastiaanOlij BastiaanOlij force-pushed the visualise_direction_shadowmap_frustum branch from b92fa3c to c6a2f08 Compare May 29, 2023 00:04
@BastiaanOlij BastiaanOlij force-pushed the visualise_direction_shadowmap_frustum branch from c6a2f08 to 85ca16b Compare May 31, 2023 06:51
@BastiaanOlij BastiaanOlij modified the milestones: 4.1, 4.2 Jun 4, 2023
@BastiaanOlij
Copy link
Contributor Author

@clayjohn @Calinou if you're happy with the changes, any chance to approve this PR so it can be merged once we're working on 4.2?

Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

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

Tested locally (rebased against 0f76ff2), it works.

Blend Splits disabled

Screenshot_20230605_181801
Screenshot_20230605_181826

Blend Splits enabled

Screenshot_20230605_181815

Screenshot_20230605_181830

@BastiaanOlij BastiaanOlij force-pushed the visualise_direction_shadowmap_frustum branch from 861e132 to d9eb966 Compare June 11, 2023 01:49
@YuriSizov YuriSizov merged commit 0fa808b into godotengine:master Jul 12, 2023
@YuriSizov
Copy link
Contributor

Thanks!

@akien-mga akien-mga changed the title Draw frustum splices ontop of direction shadow atlas for debug purposes Draw frustum splices on top of direction shadow atlas for debug purposes Nov 29, 2023
@BastiaanOlij BastiaanOlij deleted the visualise_direction_shadowmap_frustum branch December 5, 2023 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants