how do you sample two textures on the same object?

Well firstly you are blending them but not blending using an alpha-mask, when the example image seems to have been blended with an alpha-mask.

An example could be something like below; provided the coin has got an alpha-channel.
(Otherwise you’ll have to calculate an alpha or add one in an image editing software.

    float3 blend(float4 CoinTex, float3 GridTex)
    {
         // Inverse of alpha, to get the area around the coin
         // Alpha spans from [0,1] so the expression below would suffice
         float1 inverseAlpha = (1 - CoinTex.a);

         float3 blendedTex = 0;
         
         // If-else that is evaluated to decide how they'll be overlayed
         if (inverseAlpha > 0.0 ){
             blendedTex = GridTex.rgb;
         } else {blendedTex = CoinTex.rgb;}

         return blendedTex;
    }

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top