Skip to content

Fix to render depth or depth/normal of waving grass #4097

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

Merged
merged 24 commits into from
Oct 20, 2021

Conversation

Seongdae
Copy link
Contributor

@Seongdae Seongdae commented Apr 7, 2021

Checklist for PR maker

  • Have you added a backport label (if needed)? For example, the need-backport-* label. After you backport the PR, the label changes to backported-*.
  • Have you updated the changelog? Each package has a CHANGELOG.md file.
  • Have you updated or added the documentation for your PR? When you add a new feature, change a property name, or change the behavior of a feature, it's best practice to include related documentation changes in the same PR. If you do add documentation, make sure to add the relevant Graphics Docs team member as a reviewer of the PR. If you are not sure which person to add, see the Docs team contacts sheet.
  • Have you added a graphic test for your PR (if needed)? When you add a new feature, or discover a bug that tests don't cover, please add a graphic test.

Purpose of this PR

Fix to render depth of waving grass in depth prepass

  • In opaque pass billboard offset was applied
  • But, those offset wasn't added to depth and depth/normal prepass
  • In case of billboard grass, the vertex result was not the same between opaque and prepasses

Testing status

Add new terrain
Add detail billboard grass
Bush detail where you want to check


Comments to reviewers

It wasn't working to draw depth of waving billboard grass to depth texture

@Seongdae Seongdae requested review from ellioman and Verasl April 7, 2021 05:44
@Seongdae Seongdae self-assigned this Apr 7, 2021
Copy link
Contributor

@ellioman ellioman left a comment

Choose a reason for hiding this comment

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

I'm not 100% sure what the bug is that this PR is trying to fix. Would be nice to get that info in the description.

With a PR that got introduced today, we now have a WavingGrassDepthNormalsPass.hlsl file with the DepthNormals passes, which also need to be looked at.

In the same PR, four test scenes were added in the Terrain Project to test depth & normals (Forward & Deferred). Can we expand on that and include some testing for this in order to avoid any breakages in the future?

@Seongdae
Copy link
Contributor Author

Seongdae commented Apr 8, 2021

@ellioman Thanks for letting me know about WavingGrassDepthNormalsPass.hlsl added, I updated and merged from master to my branch.

In case of detail checked as billboard, depth prepass of waving grass didn't work and I tried frame debugger to check if the prepass worked. the prepass was called but depth didn't appear in depth texture.(depth normal is also the same)

TerrainBillboardGrass(v.vertex, v.tangent.xy) was applied in opaque pass before but depth prepasses didn't have it.
So I added TerrainBillboardGrass(v.vertex, v.tangent.xy) to vertex stage of depth and depth/normal pass then the result appeared in the frame debugger and the those work well in screen space features(ambient occlusion and shadow)

here are the comparison

[before adding TerrainBillboardGrass(v.vertex, v.tangent.xy)]
image

[after adding TerrainBillboardGrass(v.vertex, v.tangent.xy)]
image

@phi-lira phi-lira requested a review from russoh April 13, 2021 15:26
@phi-lira
Copy link
Contributor

phi-lira commented Apr 13, 2021

Adding @russoh for terrain review

@russoh
Copy link
Contributor

russoh commented Apr 15, 2021

I'll loop in terrain team for a review, would be good to have somebody from the team, look over this.

@spaceburp spaceburp self-requested a review April 15, 2021 16:47
@spaceburp
Copy link
Contributor

would it be possible to cover what Elvar brought up regarding tests?

In the same PR, four test scenes were added in the Terrain Project to test depth & normals (Forward & Deferred). Can we expand on that and include some testing for this in order to avoid any breakages in the future?

Copy link
Contributor

@russoh russoh left a comment

Choose a reason for hiding this comment

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

The changes logically look sane to me, but I agree with other sentiments that we should probably add a test that would fail an image comparison if those changes were subsequently stripped out again. Also, do we have any larger terrain + grass demos that can be used to validate against?

@phi-lira
Copy link
Contributor

@Seongdae please ping reviewers for another look.

@Seongdae Seongdae requested a review from ellioman May 31, 2021 00:33
@Seongdae
Copy link
Contributor Author

Should I handle the tests of terrain and does it allow me to add scenes for comparing with detail shadows?

@phi-lira
Copy link
Contributor

phi-lira commented Jun 3, 2021

@Seongdae yes, please add tests, ping @ellioman or @russoh for help.

@ellioman
Copy link
Contributor

ellioman commented Aug 4, 2021

What's the status on this PR @Seongdae ?
Regarding the test discussion, there are now two tests scenes, in the Terrain Project, for DepthNormals that you can check and verify:

  • 201_DepthNormalsDeferred
  • 201_DepthNormalsForward

And then we also have two other test scenes for Depth, I believe 200.

@github-actions
Copy link

Hi! This comment will help you figure out which jobs to run before merging your PR. The suggestions are dynamic based on what files you have changed.
Link to Yamato: https://yamato.cds.internal.unity3d.com/jobs/902-Graphics
Search for your PR branch using the sidebar on the left, then add the following segment(s) to the end of the URL (you may need multiple tabs depending on how many packages you change)

URP
/.yamato%252Fall-urp.yml%2523PR_URP_2021.2

Depending on the scope of your PR, you may need to run more jobs than what has been suggested. Please speak to your lead or a Graphics SDET (#devs-graphics-automation) if you are unsure.

@Seongdae
Copy link
Contributor Author

@ellioman this is to fix depth/normals of billboard grass, but there is no billboard grass in the test scenes you told me. Should I add billboard grass to the scenes?

@ellioman
Copy link
Contributor

@ellioman this is to fix depth/normals of billboard grass, but there is no billboard grass in the test scenes you told me. Should I add billboard grass to the scenes?

@Seongdae
Yes, I think that's a good idea. Those scenes should be testing as much as possible Terrain related. So if you can structure the scene with the billboards as well, then that's perfect. 👍

@Seongdae
Copy link
Contributor Author

Seongdae commented Sep 3, 2021

Checked it in the terrain test scenes @ellioman told me, and also update the reference images now. I'm waiting for Yamato, but there seem to be an issues in the current test environment.

@Seongdae
Copy link
Contributor Author

Seongdae commented Oct 6, 2021

The tests related to Terrain were passed now.

@ellioman ellioman marked this pull request as ready for review October 14, 2021 09:15
@ellioman ellioman requested review from a team as code owners October 14, 2021 09:15
@Seongdae Seongdae requested a review from russoh October 18, 2021 00:16
@Seongdae Seongdae merged commit 395d1e0 into master Oct 20, 2021
@Seongdae Seongdae deleted the fixGrassDepthPrepass branch October 20, 2021 04:07
odbb added a commit that referenced this pull request Oct 20, 2021
* master:
  Add missing shader stages in shader keyword copying  (#6008)
  [Yamato] Add all DX11 job for URP (#6075)
  [HDRP] Add more performance test coverage (#5814)
  Fix templates ISO date (#6073)
  Fix division by 0 when AO is 0 (#6078)
  Fixed grammar errors (#6077)
  [HDRP][Path Tracing] Improved robustness of the stacklit material (#6066)
  [APV] Cell streaming system (#5731)
  Update revision for URP update test project (#6061)
  [HDRP][Path Tracing] Camera ray misses now return a null value with Minimum Depth > 1 (#6067)
  Renable missing test (Lens Flare) (#5456)
  [HDRP][Path Tracing] Added proper support for interleaved tiling (#5953)
  Fix to render depth or depth/normal of waving grass (#4097)
  Remove ScreenSpaceShadowResolvePass (#6002)
  [HDRP][Docs] Update docs with RendererList related option (#6031)
  Layer drawer used in ray/path tracing now matches 100% with camera's. (#5956)
  Fix iridescence tooltip (#5950)
  [HDRP] Change RenderGraph Begin/Execute function pattern to avoid leaks (#5929)
  [HDRP] Fix errors when switching build targets in editor (#5918)
  Generate a material as a subasset for ShaderGraphs (#5795)
phi-lira added a commit that referenced this pull request Oct 21, 2021
phi-lira added a commit that referenced this pull request Oct 27, 2021
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.

5 participants