1

基础入门 环境搭建
参考链接参考
1.天空盒[CubeTexture]
api
6张图片名字顺序非常重要:
TropicalSunnyDay_nx.jpg,TropicalSunnyDay_ny.jpg,TropicalSunnyDay_nz.jpg,TropicalSunnyDay_px.jpg,
TropicalSunnyDay_py.jpg,TropicalSunnyDay_pz.jpg

//天空盒
var skybox = BABYLON.Mesh.CreateBox("skyBox", 700.0, carScene);
var skyboxMaterial = new BABYLON.StandardMaterial("skyBox", carScene);
skyboxMaterial.backFaceCulling = false;
skyboxMaterial.reflectionTexture = new BABYLON.CubeTexture("textures/TropicalSunnyDay", carScene);
skyboxMaterial.reflectionTexture.coordinatesMode = BABYLON.Texture.SKYBOX_MODE;
skyboxMaterial.diffuseColor = new BABYLON.Color3(0, 0, 0);
skyboxMaterial.specularColor = new BABYLON.Color3(0, 0, 0);
skyboxMaterial.disableLighting = true;
skybox.material = skyboxMaterial;

2.天空盒HDRCubeTexture
api
案例1

// Skybox
var skybox = BABYLON.MeshBuilder.CreateBox("SkyBox", {size:1000.0}, scene);
var skyboxMaterial = new BABYLON.StandardMaterial("skyBox", scene);
skyboxMaterial.backFaceCulling = false;
skyboxMaterial.reflectionTexture = new BABYLON.HDRCubeTexture("textures/room.hdr", scene, 512);
skyboxMaterial.reflectionTexture.coordinatesMode = BABYLON.Texture.SKYBOX_MODE;
skyboxMaterial.diffuseColor = new BABYLON.Color3(0, 0, 0);
skyboxMaterial.specularColor = new BABYLON.Color3(0, 0, 0);
skybox.material = skyboxMaterial;

3.env环境光

//环境光
var hdrTexture = BABYLON.CubeTexture.CreateFromPrefilteredData("./env/environment.env", scene);
hdrTexture.name = "environment";
hdrTexture.gammaSpace = false;
hdrTexture.level = 0.4;
scene.environmentTexture = hdrTexture;

4.env环境光做天空盒

//环境光
scene.environmentTexture = BABYLON.CubeTexture.CreateFromPrefilteredData("./env/environment.env", scene);
scene.createDefaultSkybox(scene.environmentTexture, true, (scene.activeCamera.maxZ - scene.activeCamera.minZ) / 2, 0.3, false);

陌然浅笑
25 声望3 粉丝

坚持自律