guycalledfrank / bakery-issues

Bug tracker for Bakery
4 stars 0 forks source link

RTP not working with a custom Shader Graph & ProBuilder #51

Closed Zurigan closed 3 years ago

Zurigan commented 3 years ago

This is the post-Bakery-Render scene view: image

And this is the Bakery Preview: image

The two objects at the back are using the custom shader graph, the ones at the front are using URP/lit. Objects on left are default Unity spheres, ones on right are ProBuilder poly shapes.

In RTP the sphere works fine with the custom shader graph ... the ProBuilder poly shape is shown as black.

There's something about the ProBuilder poly shape that's preventing it from showing up properly in RTP but only when using this custom shader graph ... is this anything I can fix? A ProBuilder bug? or Bakery? or ShaderGraph? :)

Zipped example scene: ProBuilder & Bakery Test.zip

guycalledfrank commented 3 years ago

There is something weird about ProBuilder geometry. Firstly, it doesn't have a Mesh Filter component. Second, if I just copy the object and paste it to another scene, there is no geometry. Third, using FBX Exporter package and converting this object to FBX makes it perfectly usable. I did not use it myself, but maybe there is an option to convert ProBuilder geometry to a "normal" mesh?

Zurigan commented 3 years ago

ProBuilder itself does have export ability ... RTP on top, lightmapped Game view bottom, exported objects middle/front:

image

Front/left of center is the ProBuilder object exported as an obj - looks good in RTP, lightmapping is broken.

Front/right of center is the ProBuilder object exported as a prefab - RTP looks the same as pre-export (mostly black, some slivers getting lit) but lightmapping works.

So, hrm, lots of strangeness going on here. The bit I don't understand is how RTP is working with ProBuilder with the lit material but not with my custom ShaderGraph one.

guycalledfrank commented 3 years ago

I think I've found the cause: https://issuetracker.unity3d.com/issues/emissive-custom-pbr-shadergraph-material-only-works-for-primitive-unity-objects

Shader Graphs generate incorrect Meta Pass shaders. Simply setting PBR Graph to Two-sided makes it work:

image

This issue affects built-in lightmappers as well. I'm not sure there is anything on my side to fix it :( The issue is still present in 2020.1.14 & latest URP, even though it's marked as "fixed". See comments.

Zurigan commented 3 years ago

Oh, great find, thank you so much for digging into this - can confirm stuff is now showing up with two-sided toggled on, in RTP.

That link claims it's fixed in 10.1 URP which, I think, needs 2020.2 Unity ... might have to try upgrading.