Sign in to follow this  
DylanD

Clone Custom Material

Recommended Posts

Hello everyone

I was wondering

Is it intended that cloning a custom material makes a standard material? As in

customMaterial.clone(){

    return standardMaterial;

}

because in typescript that is what I get.

Or is this a mix up

Share this post


Link to post
Share on other sites

Maybe just make a support function that you can pass the custom fragments to in a constructor and then have it “rebuild” the custom material when you need to clone it. 

And have the function bind the custom parts set with the constructor after it gets initialized.

Share this post


Link to post
Share on other sites
On 8/10/2018 at 4:45 PM, Pryme8 said:

Maybe just make a support function that you can pass the custom fragments to in a constructor and then have it “rebuild” the custom material when you need to clone it. 

And have the function bind the custom parts set with the constructor after it gets initialized.

This is a good idea.  But the material I need was actually just the diffuseTexture (mine specifically uses a texture from a server, so less load time I think) of that custom material so I had done clone just because I know it is slightly better to clone than to make a whole new one, so I just ended up cloning before editing the .Fragment_Before_FragColor which lets it work.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.