prman-pixar / RenderManForBlender

RenderMan for Blender render addon
MIT License
808 stars 133 forks source link

Appending/Linking objects with textures causing a black render and freeze #630

Closed TzurH closed 3 years ago

TzurH commented 3 years ago

I think this is TxManager related. If appending/linking an object from an external .blend scene, TxManager doesn't add the textures "attached" to said object automatically, the user has to parse the scene manually, which is prone to human error. Is it possible to run "parse scene" on import/append/linking of objects to the scene?

Here's a capture to better show what's happening. I append an object with textures in the material, and TxManager isn't finding them automatically. * Please disregard the diffuse texture in the TxManger, I have a hidden object in the scene this belongs to.

https://user-images.githubusercontent.com/10125645/136289097-17cc1cc0-b22f-401e-9d6a-472554d3d93d.mp4

And this is the log: src\liboslexec\instance.cpp:480: RMAN_1697a56_OSL::pvt::ShaderInstance::copy_code_from_master: Assertion 'm_instops.empty() && m_instargs.empty()' failed. src\liboslexec\instance.cpp:489: RMAN_1697a56_OSL::pvt::ShaderInstance::copy_code_from_master: Assertion 'm_instsymbols.size() == 0 && "should not have copied m_instsymbols yet"' failed. src\liboslexec\instance.cpp:494: RMAN_1697a56_OSL::pvt::ShaderInstance::copy_code_from_master: Assertion 'm_instoverrides.size() == (size_t)std::max(0,lastparam())' failed. src\liboslexec\instance.cpp:480: RMAN_1697a56_OSL::pvt::ShaderInstance::copy_code_from_master: Assertion 'm_instops.empty() && m_instargs.empty()' failed. src\liboslexec\instance.cpp:489: RMAN_1697a56_OSL::pvt::ShaderInstance::copy_code_from_master: Assertion 'm_instsymbols.size() == 0 && "should not have copied m_instsymbols yet"' failed. src\liboslexec\instance.cpp:494: RMAN_1697a56_OSL::pvt::ShaderInstance::copy_code_from_master: Assertion 'm_instoverrides.size() == (size_t)std::max(0,lastparam())' failed. src\liboslexec\instance.cpp:480: RMAN_1697a56_OSL::pvt::ShaderInstance::copy_code_from_master: Assertion 'm_instops.empty() && m_instargs.empty()' failed. src\liboslexec\instance.cpp:489: RMAN_1697a56_OSL::pvt::ShaderInstance::copy_code_from_master: Assertion 'm_instsymbols.size() == 0 && "should not have copied m_instsymbols yet"' failed. src\liboslexec\instance.cpp:494: RMAN_1697a56_OSL::pvt::ShaderInstance::copy_code_from_master: Assertion 'm_instoverrides.size() == (size_t)std::max(0,lastparam())' failed. S31020 {ERROR} Inf/NaN detected in bounding of |walls_001|walls_001-MESH after displacement. Displacement will not be applied. S31020 {ERROR} Inf/NaN detected in bounding of |walls_001|walls_001-MESH after displacement. Displacement will not be applied. S31020 {ERROR} Inf/NaN detected in bounding of |walls_001|walls_001-MESH after displacement. Displacement will not be applied. S31020 {ERROR} Inf/NaN detected in bounding of |walls_001|walls_001-MESH after displacement. Displacement will not be applied. S31020 {ERROR} Inf/NaN detected in bounding of |walls_001|walls_001-MESH after displacement. Displacement will not be applied. S31020 {ERROR} Inf/NaN detected in bounding of |walls_001|walls_001-MESH after displacement. Displacement will not be applied. S31020 {ERROR} Inf/NaN detected in bounding of |walls_001|walls_001-MESH after displacement. Displacement will not be applied. S31020 {ERROR} Inf/NaN detected in bounding of |walls_001|walls_001-MESH after displacement. Displacement will not be applied. S31020 {ERROR} Inf/NaN detected in bounding of |walls_001|walls_001-MESH after displacement. Displacement will not be applied.

prman-pixar commented 3 years ago

@TzurH I'll have to think about this. Blender doesn't seem to have a callback for when you link to an object, so we can't add the textures to the texture manager.

TzurH commented 3 years ago

@TzurH I'll have to think about this. Blender doesn't seem to have a callback for when you link to an object, so we can't add the textures to the texture manager.

Hmm, that's quite problematic. Maybe a set of import/append/link scripts under the Renderman side panel that will handle this? Not ideal, for sure, but at least something. Just throwing an idea out there. Not even sure if it's feasible :D

prman-pixar commented 3 years ago

@TzurH can you try the latest commit to see if it improves the behavior?

TzurH commented 3 years ago

@prman-pixar as soon as I click on an object in my scene, Blender crashes. log window crashes as well and I'm not sure how to retrieve the log. If you pause the video below when it happens you can somewhat read the errors hah.

https://user-images.githubusercontent.com/10125645/136637888-0d4d4835-5553-4c8e-9969-caba402ee173.mp4

prman-pixar commented 3 years ago

@TzurH Hmmm...I didn't see the crash, but I had to fix a couple of typos. I wonder if those address the problem?

TzurH commented 3 years ago

I did some more tests and I've noticed this crash only occurs when I open scenes I had previously set up with materials, etc. which is probably why you aren't experiencing it? If I start a new scene and then build the material from scratch it doesn't crash.

TzurH commented 3 years ago

Maybe it's best not to merge the commits addressing this issue into this branch for now?

TzurH commented 3 years ago

I have shared a test scene with you on Goggle Drive. I've packaged this test scene using the new tool you've added. This scene is running fine on this commit: https://github.com/prman-pixar/RenderManForBlender/tree/88c8b2ac3ef8f9f09811845585ec643c69d58184

Let me know if you need anything else to help test/debug.

TzurH commented 3 years ago

Can confirm works now. I'm also able to link collections which I was unable to do previously. Amazing! Thanks for the fix 💯