Render transparent area of texture as a color?

Here I have the mesh with texture applied, part of that texture is transparent.

However, instead of rendering the transparent part of the texture AS transparent, it needs to be rendered as a color set in three.js.

I did try this:

    function (geometry) {
      var textureLoader = new THREE.TextureLoader();
      var texture = textureLoader.load('../../assets/shirt_test.png?1');
      var material = new THREE.MeshLambertMaterial({
        //transparent: true,
        map: texture,
      texture.minFilter = THREE.LinearFilter;
      texture.wrapS = texture.wrapT = THREE.ClampToEdgeWrapping;
      geometry.traverse(function (child) {
        if (child instanceof THREE.Mesh) {
          child.material = material; 
          child.material.color.setHex(0x<?php echo $color; ?>);
      geometry.rotation.y = 3.14159;
      geometry.position.x = 1.5;

However that just colored the texture.

Thanks for any help

It’s actually way simpler than you think… just import it to blender, and literally change the colors…it’s super simple
If you need more instructions I will give them to you

That’s not what I’m looking for as:
-the ‘shirt’ will be changed/created by the user
-the ‘skin color’ will be set by the user, and, like in real life, would need to be independent of the shirt

Ahh…sorry, I did not understand…

I think need to modify fragment shader. After calculation of “diffuse”, need to diffuse add color*transparent from uniform.

You can use emissive color with it’s own map (the inverse black & white version of the texture you use), like in this example:

If you need the colorized part to show Lambertian diffusion, you can create the texture on the fly. Make a 2D canvas, paint it with user-defined color, then overlay your transparent texture on top and use this composite as a normal opaque texture for the model.