Three.js - Using multiple textures in a single PointCloud

后端 未结 3 1130
庸人自扰
庸人自扰 2021-01-03 03:28

I\'m trying to use multiple textures in a single PointCloud using a ShaderMaterial. I\'m passing a texture array to the shader along with texture index attributes and select

3条回答
  •  滥情空心
    2021-01-03 03:51

    Also you can cast vTexIndex to int.

    int textureIndex = int(vTexIndex + 0.5);
    
    if (textureIndex == 0) {
        finalColor = texture2D(textures[0], gl_PointCoord);
    } else if (textureIndex == 1) {
        finalColor = texture2D(textures[1], gl_PointCoord);
    } else if (textureIndex == 2) {
        finalColor = texture2D(textures[2], gl_PointCoord);
    }
    

提交回复
热议问题