3

I am using the BabylonJS viewer to show a 3D (gltf) model on a website. However, since I have no prior experience using it, and I only need it to show this model, I am using the generic viewer (and I followed this tutorial).

Now, I need to change the background color of the "minimal" configuration, which by default is dark blue. Is there any easy way to do this?

Clarification: I am talking about the skybox color

Anonymous
  • 315
  • 1
  • 5
  • 15

3 Answers3

2

Add this line to change your scene after creating it :)
that would be RGBA colors, for you to choose

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

hope that helps

Gotti92
  • 742
  • 1
  • 6
  • 22
0

You need to use scene.clearColor parameters (in DOM configuration). Below is the code for Babylon Viewer with white scene color.

     <babylon extends="minimal">
    <model url="https://models.babylonjs.com/TrailMeshSpell/spellDisk.glb">

    </model>
    <camera>
        <behaviors>
            <auto-rotate type="0"></auto-rotate>
        </behaviors>
      <position x="3" y="3" z="3"></position>
    </camera>
    <scene>
<clear-color r="1" g="1", b="1"></clear-color>
   </scene>
</babylon>

Another example is here - https://forum.babylonjs.com/t/how-to-use-scene-clearcolor-parameters-with-babylon-viewer/5266

labris
  • 111
  • 1
  • 6
0

for json configuration

"scene": {
    "clearColor": {
        "r": 1,
        "g": 1,
        "b": 1
    }
}
memoricab
  • 425
  • 1
  • 7
  • 28