fenomas / noa

Experimental voxel game engine.
MIT License
611 stars 87 forks source link

A easier way to make skyboxes #102

Closed Roy-Ermers closed 4 years ago

Roy-Ermers commented 4 years ago

At this moment it is very difficult to add a skybox to the game. Maybe Noa can make this easier?

Jarred-Sumner commented 4 years ago

Here's some code that adds a skybox:

const box = Mesh.CreateBox("SkyBox", 1000.0, scene, true, Mesh.BACKSIDE);
box.material = new SkyMaterial("sky", scene);
box.material.inclination = 0;
box.material.turbidity = 5;
box.infiniteDistance = true;
box.material.disableLighting = true;
box.material.luminance = 1;
box.backFaceCulling = false;

noa.rendering._octree.dynamicContent.push(box);

You'll need @babylonjs/materials for SkyMaterial:

import { SkyMaterial } from "@babylonjs/materials";