Search Issue Tracker
Fixed in 10.1.0
Votes
10
Found in [Package]
7.1.2
Issue ID
1190225
Regression
No
Emissive custom PBR ShaderGraph material only works for primitive Unity objects
How to reproduce:
1. Open the user's originally attached project (GIContributionBug.zip)
2. Make sure GiContributionBug scene is loaded
3. Observe the Game view
Expected results: All four cubes in the scene are emitting light
Actual results: Custom made cube (on the far right) with a custom PBR Shader is not emitting light
Reproducible with: 2019.3.0b9, 2020.1.0a10 (Shader Graph 7.1.2)
Could not test with earlier Unity versions or Shader Graph versions because crucial parts of the scene in the reproduction project would turn into a pink color
Notes:
- URP Lit Shader works for both custom made and primitive objects
Developer Update:
The issue comes from enabling "Generate Lightmap UV" on the imported mesh. The current workaround is to provide lightmap UVs in the imported model not enable "Generate Lightmap UV" to see GI contributions from a Shader Graph emissive material.
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- [Android] [GameActivity] UI is unresponsive when Application Entry Point is set to GameActivity
- [Linux] VR template "Tutorial Player" GameObject becomes blank after entering Play mode
- Editor window minimizes when changing the Layout while using the Windows split-screen function
- Object pools do not reset when re-entering the Play Mode with reload domain disabled
- Performance issue when using Shadow-Casting Lights with Batch Renderer Groups
jonathanrpace_unity
Jun 23, 2020 20:37
Can confirm this is still an issue in Package 8.0.1
(Editor 2020.1.0b8)
Owers
May 18, 2020 14:36
I believe I have found the issue and a solution:
When Shader Graph generates a meta pass for your shader, it sets its culling mode to 'Back' instead of 'Off'. If you check the code for the default Lit shader for URP, the Cull property is set to Off instead of [_Cull]. I guess the lightmapper requires meta passes to be double-sided when reading surface data and calculating GI.
You can fix this issue by setting your shader to Two-Sided in the Master node, baking your lightmap, and then disabling Two-sided again. Be sure to clear your GI Cache before baking. You'll need to do this for each of your custom shaders. This solution may not be permanent, so you may have to repeat this process.
Unity, please fix this. It's literally one property that needs to be changed. Make sure the meta pass always uses 'Cull Off'.
j-rei
Feb 05, 2020 18:12
Hello, I am just copy pasting my message from GitHub where the fix for review was commited, just in case that it gets lost. I did post it because it seems like the fix includes only adding emission checkbox to shader graph material, while the main issue still remain unsolved.
Posted message on Github:
"
I just wanted to point out that the provided fix doesn't solve the issue. While having the emissive toggle for materials for setting proper lightmap flag is definitely appreciated and helpful, the main issue still persist.
If you open the attached project in the bug report, you can see that the lightmap flag was correctly set on material via Debug mode in inspector, and the object still wont bake. However, it only doesn't bake on custom made 3D models, Unity's default primitives work for some reason.
Thank you!
"
j-rei
Nov 01, 2019 09:50
I have made another test with the latest GitHub branch "release/2019.3" and the 2019.3.0b8 Unity version. This is the 7.2.0 SRP version.
Tested HDRP : this works as expected, all of the objects are emitting light to the lightmaps GI.
Tested URP : the problem still persists, the custom made cube behaves the same way as the one in the example scene.
j-rei
Nov 01, 2019 08:53
Just an additional info:
The emitting part is only related to baked lighting. It appears that custom made objects are not contributing GI light to the lightmaps when using custom emissive Shadergraph material.
Also, I have rebuild the same scene in 2019.2 with the older LWRP, and all the custom objects were emitting light to the lightmaps GI correctly, so it must be somehow related to the new SRP version.