Skip to content

Conversation

adrien-de-tocqueville
Copy link
Contributor

@adrien-de-tocqueville adrien-de-tocqueville commented Oct 15, 2020

Purpose of this PR

Fix for https://fogbugz.unity3d.com/f/cases/1282977/
and https://fogbugz.unity3d.com/f/cases/1217722/

Add a ScenePicking Pass to most shaders to have a custom picking
This allows to have picking depend on the material culling mode and to be able to correclty pick objects with vertex displacement.
This is done on HDRP Lit, LayeredLit, AxF, and Decal shaders and ShaderGraphs

[OUTDATED: This PR doesn't change anything for LitTessellation and LayeredLitTessellation so they are still 'broken']
Fix for https://fogbugz.unity3d.com/f/cases/1285370/
and https://fogbugz.unity3d.com/f/cases/1285367/
Tessellation picking now works correclty

The Unlit shader as well as URP shaders will be fixed by this PR:
https://ono.unity3d.com/unity/unity/pull-request/114181/_/editor/fix-picking-raster-state

Decal projectors cannot be picked because they are not taken into account by the picking pass.

To sum up, every object picking should be correct, with or without vertex displacement/tessellation

Materials for test scenes are upgraded in #2349


Testing status

Tested picking of front and back faces of all aforementionned materials with alpha transparency and vertex displacement.
Tested the repro scene given in the second bug case

Lit Tessellation show selected outline on backfaces
2234_tess_culling

Lit Tessellation picking with vertex displacement
2234_tess_picking

@github-actions
Copy link

It appears that you made a non-draft PR!
Please convert your PR to draft (button on the right side of the page)
and cancel any jobs that started on Yamato.
See the PR template for more information.
Thank you!

Copy link
Contributor

@TomasKiniulis TomasKiniulis left a comment

Choose a reason for hiding this comment

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

Checked all SG and HDRP shaders, backfaces are correctly ignored now(except for unlit since it's handled by another pr and tessellation).
RHGGilXWu4

For tessellation shaders I've filed a ticket here so it wouldn't get lost in the future: https://fogbugz.unity3d.com/f/cases/1285367/
Like Adrien mentions selection also ignores tessellation displacement and should be taken into account

@sebastienlagarde sebastienlagarde changed the title Fix backface picking for HDRP Fix backface picking for HDRP [21.1] Oct 19, 2020
@adrien-de-tocqueville adrien-de-tocqueville requested review from a team as code owners October 23, 2020 14:34
@adrien-de-tocqueville adrien-de-tocqueville changed the base branch from HDRP/staging to master October 23, 2020 14:43
@adrien-de-tocqueville adrien-de-tocqueville removed request for a team October 23, 2020 14:43
@sebastienlagarde sebastienlagarde changed the title Fix backface picking for HDRP [21.1] Fix backface picking for HDRP Oct 23, 2020
@adrien-de-tocqueville adrien-de-tocqueville changed the title Fix backface picking for HDRP Fix backface and displacement picking for HDRP Oct 26, 2020
@sebastienlagarde sebastienlagarde merged commit 31fc479 into master Oct 27, 2020
@sebastienlagarde sebastienlagarde deleted the HDRP/backface-selection branch October 27, 2020 22:19
sebastienlagarde added a commit that referenced this pull request Oct 27, 2020
* Scene selection pass

* Don't cull backfaces

* changelog

* Lit Shader picking pass

* hdrp shaders

* Added ScenePickingPass to ShaderGraph

* Fixes for decals

* Tessellation picking

* Update Upgrading-from-2020.1-to-2020.2.md

* Move function to common.hlsl

* Reorder decal passes

* Minor changes

Co-authored-by: Sebastien Lagarde <sebastien@unity3d.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants