Convert RenderTexture to Texture

In one of our plugin we are creating render textures for various uses and we would like to assign the textures to a material. The problem we are facing is that the material accept a Texture object and we have a RenderTexture object. How can one convert between these two? Do we need to add the texture to the document and retrieve the texture somehow?

Thanks a lot,

You should be creating RenderMaterial instead of Material. Then you can assign your RenderTexture to your RenderMaterial instance.

And what is the name of the child slot to set? Are there some constants that we can use for that?

Thanks
Alberto

I suggest you save out a material of the type you want to create and set up as a .rmtl file. You can open that in your favourite text editor, it is XML. You’ll find the slot names for those you want to assign textures to.

FWIW if you are developing new tools that should work in Rhino 7 and newer then you should create and use Physically Based materials, not Custom materials.

1 Like