Open HakuWang opened 1 year ago
Ah yes, I think it's related to this:
https://geom.io/bakery/wiki/index.php?title=Partial_scene_baking#Material_compatibility
Internally, capture points render the scene in 6 directions using special shaders that output albedo, normal and depth. As these shaders don't have original shaders' logic, procedural albedos may be lost. Currently every rendered object will draw _MainTex/_BaseMap/_BaseColorMap of the material (whichever is present). As capture points draw objects directly as seen (with perspective projection), they can't, unlike the lightmapper or the RTPreview, use the Meta Pass
TBH, I'm not sure how to fix this in some universal way, but you can replace my built-in shader (ftFarSphereRender.shader) with yours and e.g. read color from your own constants.
Thank you for quick reply!
I modified your ftFarSphereRender.shader to apply the _Color property and tried to modify the static function GenerateFarSphereData in ftBuildGraphics.cs and found that i could not set color property to the farSphereMat successfully. I do not know its unity's api bug or the Material.SetColor function can not be used with Graphics.DrawMeshNow. I also tried to use meterial block with Graphics.Draw Mesh, but i could not see the mesh drawn when clicked Preview.
Another problem is that if i change the _Maintex property to _Basemap in ftFarSphereRender.shader and use farSphereMat.SetTexture() with the _Basemap, the main texture could not be applied either.
Here is the snapshot of where I modified the code:
I was wondering if I found the wrong place to modify or is there other places i need to modify ? Thanks again!
Hmmm not sure what you're doing wrong. Just tried it and it worked (there is no bug in DrawMeshNow):
What seems like a bug on my side though is that I'm checking for _BaseMap AFTER I check for mats[s].HasProperty("_MainTex")! D'oh!
Just removed that check completely. https://github.com/guycalledfrank/bakery-csharp/commit/26a7ed217d370bec3c0261db7655648a5a455c99
What seems like a bug on my side though is that I'm checking for _BaseMap AFTER I check for mats[s].HasProperty("_MainTex")! D'oh!
Actually i had removed the checking you mentioned here.
I also tried to use SetVector but failed before. Since you made it work i will try to foucus on why my SetColor and SetVector not worked. Thanks for your reply and quick test!
I wanted to test-out Bakery's sectors, but am having issues on getting bounced lighting from one sector to another sector.
Here is the simple test scene baked by sector:![image](https://github.com/guycalledfrank/bakery-issues/assets/35250931/2c0cf2d1-a4a3-408c-989b-b12b3a8b7b7c)
and the same scene baked fully:![image](https://github.com/guycalledfrank/bakery-issues/assets/35250931/ab333111-3f1f-4818-90e3-40116245b1e8)
and the previewed results:![image](https://github.com/guycalledfrank/bakery-issues/assets/35250931/bb8e5c29-7522-4d14-927e-7482fcdc8208)
In preview mode, the models of other sectors could be seen, but the "white sector" could not receive the bounced lighting from the "Red Sector". Could you give me some suggestions to fix this problem? Thanks a lot!
PS. I used custom shaders with custom renderpipeline.