|
Ok, I have many different surfaces (renderers) that I want to dynamically create procedural materials for. What I'm doing now : I have a reference material : I have a table of procedural materials : Then for each of them I want to create a clone that I can change independently : Now, if I change the property of one : It changes them all. It seems to be changing the original and not the clone. I must be missing something here.. Thanks for your help.
(comments are locked)
|
|
Hi, I figured it out, and will share my finding here. I had a material (not procedural) reference, which I was tweaking before I would apply it to other objects. I found that applying the material to an object "creates" the instance I was looking for. So the proper process is :
I was trying to instantiate the material before I would assign it. It now works as I want, with pretty good performances. Thanks!!
(comments are locked)
|
|
You can instantiate substances at runtime using renderer.material instead of renderer.Sharedmaterial, Instanciate should not be used with procedural materials. ProceduralMaterial Instance = GameObject.renderer.material as ProceduralMaterial; This will instanciate dynamically a new copy "Instance" of the procedural material applied to GameObject. I really must be missing something here. I tried using : GameObject.renderer.material as ProceduralMaterial; All I get is 3 materials using the same procedural material textures. I want to "duplicate" a procedural material. In other words, I want to duplicate the generated textures as well. Say I have a procedural material that has a property called "sbs_color", I want to create several duplicates, each with a different colour. Is that possible at all ? Thanks
Aug 07 '12 at 09:58 PM
CgShady
(comments are locked)
|
