cryptovoxels / issues

🐞 Bugs and issues to be resolved on cryptovoxels
5 stars 1 forks source link

Images transparency displays as black and white displays as transparent #5

Closed ghost closed 5 years ago

ghost commented 5 years ago

Steps:

Add an image with transparency and some white in it. https://www196.lunapic.com/editor/premade/transparent.gif

Expected: Image has transparency and colors display correctly

image

Result: Transparent parts become black, white becomes transparent

image

bnolan commented 5 years ago

Oh yeah! So this is sort of intentional. It's because we use a blend mode to apply textures to the wall - like so:

    const material = new B.StandardMaterial('image-feature-texture', this.scene)
    material.diffuseTexture = texture
    material.alpha = 0.999
    material.alphaMode = this.description.inverted ? BABYLON.Engine.ALPHA_SCREENMODE : BABYLON.Engine.ALPHA_MULTIPLY
    material.specularColor.set(0, 0, 0)
    material.emissiveColor.set(1, 1, 1)
    material.backFaceCulling = false
    material.zOffset = -4

However - I think the transparent part of the image should become white, not black - then at least the transparent part will be transparent. I'll try fix this in the image server.

bnolan commented 5 years ago

Ok, fixed this particular bug by making the background color white instead of black. I'll open a seperate issue for being able to use transparent textures.