# Question about transparency

**URL:** https://forum.babylonjs.com/t/question-about-transparency/3583
**Category:** Questions
**Created:** [May 29, 2019, 2:54pm UTC](https://forum.babylonjs.com/t/question-about-transparency/3583 "2019-05-29T14:54:33Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Matt\_Red](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/matt_red/32/2629_2.png) [@Matt\_Red](https://forum.babylonjs.com/u/Matt_Red)
#### Post date: [May 29, 2019, 2:54pm UTC](https://forum.babylonjs.com/t/question-about-transparency/3583/1 "2019-05-29T14:54:33Z")

</div>

Hey guys,

Sorry this is my first time using this software so its probably something straight forward I’ve missed. I have a scene with background set to transparent using:

```
scene.clearColor = new BABYLON.Color4(0,0,0,0.0000000000000001);

```

Which works however my sphere mesh object which is using a JPG texture has become semi transparent also? Please see below for full coding:

```
let canvas = document.getElementById("renderCanvas");

let createScene = function () {
    let scene = new BABYLON.Scene(engine);
    scene.clearColor = new BABYLON.Color4(0,0,0,0.0000000000000001);

    let globeMat = new BABYLON.StandardMaterial("globeMat", scene);
    globeMat.diffuseTexture = new BABYLON.Texture("img/textures/earth.jpg", scene);

    globeMat.diffuseColor = new BABYLON.Color3(255, 255, 255);
    globeMat.specularColor = new BABYLON.Color3(255, 255, 255);
    globeMat.emissiveColor = new BABYLON.Color3(255, 255, 255);
    globeMat.ambientColor = new BABYLON.Color3(255, 255, 255);

    let sphere = BABYLON.MeshBuilder.CreateSphere("sphere", {sideOrientation: BABYLON.Mesh.DOUBLESIDE}, scene);
    sphere.material = globeMat;

    let arcCamera = new BABYLON.ArcRotateCamera("Camera", -Math.PI / 2, Math.PI / 4, 5, BABYLON.Vector3.Zero(), scene);
    arcCamera.setPosition(new BABYLON.Vector3(0, 0, 5));
    arcCamera.target = new BABYLON.Vector3(0, 0, 0);

    scene.activeCamera = arcCamera;

    scene.beforeRender = function () {
        arcCamera.alpha += .01;
    };

    return scene;
};

let engine = new BABYLON.Engine(canvas, true, { preserveDrawingBuffer: true, stencil: true });
let scene = createScene();

engine.runRenderLoop(function () {
    if (scene) {
        scene.render();
    }
});

// Resize
window.addEventListener("resize", function () {
    engine.resize();
});
```

---

<div class="post-metadata">

### Author: ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)
#### Post date: [May 29, 2019, 3:50pm UTC](https://forum.babylonjs.com/t/question-about-transparency/3583/2 "2019-05-29T15:50:22Z")

</div>

Is the canvas itself having some kind of opacity setup ?

---

<div class="post-metadata">

### Author: ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)
#### Post date: [May 29, 2019, 3:52pm UTC](https://forum.babylonjs.com/t/question-about-transparency/3583/3 "2019-05-29T15:52:11Z")

</div>

By the way, WELCOME TO THE FORUM !!!

---

<div class="post-metadata">

### Author: ![nogalo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/nogalo/32/120_2.png) [@nogalo](https://forum.babylonjs.com/u/nogalo)
#### Post date: [May 29, 2019, 5:03pm UTC](https://forum.babylonjs.com/t/question-about-transparency/3583/4 "2019-05-29T17:03:54Z")

</div>

Well I tested everything in your code and it should work fine. So like sebevan said, maybe you set some opacity on the canvas itself which is causing the issue.

I just want to add that you should use values in range between 0-1 inside Color3.

In your case it is not that big of a deal, because you have diffuseTexture on the mesh so basically only specularColor can cause some problems, but you should fix that probably.

---

<div class="post-metadata">

### Author: ![Matt\_Red](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/matt_red/32/2629_2.png) [@Matt\_Red](https://forum.babylonjs.com/u/Matt_Red)
#### Post date: [May 30, 2019, 8:15am UTC](https://forum.babylonjs.com/t/question-about-transparency/3583/5 "2019-05-30T08:15:01Z")

</div>

Cheers for the welcome !

You guys are correct. Seems the containing div had an opacity set to it via another JS file.

Thank you very much !

---

<div class="post-metadata">

### Author: ![Matt\_Red](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/matt_red/32/2629_2.png) [@Matt\_Red](https://forum.babylonjs.com/u/Matt_Red)
#### Post date: [May 30, 2019, 8:20am UTC](https://forum.babylonjs.com/t/question-about-transparency/3583/6 "2019-05-30T08:20:01Z")

</div>

Thanks for the info. I was thinking they were RGB format however that said I don’t have any colours set on the actual material in the live JS. Was messing around with values prior to posting here and forgot to remove.
