Challenge updating node material

Hey all,
I have what I thought was going to be a simple task that has me really scratching my head. Basically what I have is node shader on a mesh whose visibility is set to 0. While it is still invisible I create a new texture and set the uScale and vScale of the new texture and apply it to the node material using nodeMaterial.attachedBlocks[5].texture = newTexture.

The problem I am having is that when I set the object to visible and render the frame the texture is visible but the uScale and vScale did not set. However after another frame to two everything corrects and looks fine.

Anyway, I am sure I am off here but it seems that the node shader has not completed updating with the new texture, particularly with the uScale and vScale before it actually renders. Is there perhaps a way to force the node shader to “pre-render” so to speak and check that it is ready before I render the first frame?

Hey there! Would you be able to provide us with a playground showing this for us to take a look at? :smiley:

1 Like

Thanks Carol for responding, so after playing around with it a bit more it seems that while I can replace the texture associated with the material and see the results immediately it seems to take more time for the things like uScale and vScale to update. I am sure there is a fundamental lack of understanding on my part regarding how the node shader works.

In the end rather then simply try and update the node material I decided to just create a new one and dispose of the old one.

I’m not exactly sure if you still have questions. If you do, please provide an example so we can help. :slight_smile:

Thanks @bghgary for now I have found the work around. Once my current project is done I plan on swinging back around to this and create a playground for it. But for now consider the topic closed. :slight_smile:

1 Like