I do have a .png with transparency, when I load as a texture in a mesh the transparent parts are transparent. My problem goes I need the transparent parts to be the color of the material and not transparent.
I was thinking a shader could help with that, since I’m already using a shader to merge two separate images into one for the material in another instance, but the problem I have now is, I want to use MeshLambertMaterial to fuse the color with the image and having some lights applied to the model, but I have no idea where to start replacing code using onBeforeCompile to get the result I need.
#ifdef ALPHATEST
if ( diffuseColor.a < ALPHATEST ) discard;
#endif
I guess my question would be something among the lines of: How I can, instead of discard that pixel, give it alpha 1 and color white (Or the color of the material)? Because if I go diffuseColor.a = 1, the console.log at jsfiddle go kinda crazy.
Seems like a simple built-in option would be nice because drawing an extra mesh is a whole new GPU call and double the processing, and using alphaTest can leave sharp edges between the texture and non-texture areas (instead of a smooth gradient).
I am willing to change my sleeve color to red in png transparent area, and logo to default color. I am sure there will be a easy way but I am new in this
my code for texture:
texturePatch = new THREE.TextureLoader().load(
./…/…/assets/img/3d/1/patch-01.png,
function (t) {
t.flipY = false;
}
);