freetoplay

Texture color question

Recommended Posts

Is it possible to change the texture color in code if I am given a texture image by the artist? Would the best approach be swapping out the texture url with a different url that contains a desired color? For example:

scene.meshes[2]._material._albedoTexture.url

 

 

 

Share this post


Link to post
Share on other sites

Hello, you can replace the texture like this:

scene.meshes[2].material.albedoTexture = new BABYLON.Texture("url," scene);

But if you only want to mix a color with your texture you can also use this:

scene.meshes[2].material.albedoColor = new BABYLON.Color3(1, 0, 0);

 

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

  • Recently Browsing   0 members

    No registered users viewing this page.