Closed laurentopia closed 3 years ago
this object is using that shader
which should bake properly
since those objects are also using this shader
and if i add a plane with URP baked lit, it doesn't get baked in preview.
and if i bake it i get this scramble
URP Baked Lit shader seems to work for me (testing in 2020.2.7, URP 10.3.2):
So the shader is not the cause. No UVs or something?
The metallic strawberry clearly has UV so that's not the cause.
When I switch it to baked lit it still doesn't light up so shader isn't the issue. Maybe a setting?
Here is mine.
Not sure. Can you bake the strawberry in a separate scene? If it still doesn't bake (related to single mesh/material), then it should be easy to track down the problem.
isolated scene, one bakery direct light, real time preview:
Can you send me a unitypackage with this model/material/maps to check?
here it is strawberry.zip
Hi. Your graph doesn't compile because it can't find MeshAnimatorSubGraph. I removed it to test. It also used some different version of BakeryDecodeLightmap.hlsl, as you were feeding occlusion parameter to it. Removed it as well. I also had to re-export the model to FBX on a different PC, because I don't have Maya here. Unity doesn't have a built-in Maya importer, it just looks for Maya on your machine and asks it to export to fbx...
After that (with stuff cut from the graph and model coming from fbx), I tested the strawberry, and it... seems to work:
RTPreview:
Here it is with Baked Lit:
And with your graph (baked with strawberry not being static to prevent voxel self-occlusion):
So not sure how to reproduce the bug above.
That was quite an ordeal I put you through. Thanks for bearing with me.
So you're recommending that I remove the occlusion?
What data does preview use for render?
I tested things with a simple cube.
It turns black with the strawberrie's texture and material settings
then if I switch smoothness from metallic off and set metallic and smoothness to 0 it works
but here is where it gets fun: if set the material parameters back to original it now works!
With this stunt the strawberry still look borked like bad UV. might be UV that you got right in by doing a separate fbx pass and the unity+maya importer being super borked, lemme try that. nope.
Might be related, maybe not related but what I see is preview keeps stuff that's been changed.
here the foliage has disappeared after i changed the shader to what you have and then I brought that old shader back from git and it's still gone. Also these green things at the top were erroneously set to bake, I switched that off but they still show up in preview.
I use version ... no idea... maybe add the version number in the preview window like you did with bake.
or if it's easier, in the console.
Not sure if occlusion is the problem. But maybe it is. Preview reflects "how lightmapper sees the world", i.e. GI will bounce from the same color; the color is from Meta Pass of every shader; in case of graphs it should come from what you put to albedo/emission outputs.
if set the material parameters back to original it now works!
OK wow this is confusing :) I'm not sure why it can be this way. Unity forgets to reset something on the shader?
Preview version doesn't matter in this case, it didn't change that much. Scene exporting is on the lightmapper's C# side.
Here is some idea:
... but my bet it's related, in case you CAN'T reproduce it with Baked Lit or other built-in shaders.
Possible resolution: I can make some switch to force Bakery extract albedo/emission for GI not from the Meta Pass (your graph), but directly via common texture names (_BaseMap, _BaseColorMap, _MainTex, etc). Very easy to do globally. Less easy to do per-material. Maybe you can add some specially-named property to the shader and I can scan for it?
Maybe you can add some specially-named property to the shader and I can scan for it?
That would work very well.
OK, I added a little patch.
Now if your shader has a property named BAKERY_FORCE_NO_META, it will ignore the meta pass and use _MainTex/_BaseColorMap/_BaseMap instead.
e.g. BAKERY_FORCE_NO_META ("BAKERY_FORCE_NO_META", Float) = 0.0
Here is how it can look in a graph:
Can you try it?
absolutely amazing, man, thank you so much!