rogerst Posted February 7, 2016 Share Posted February 7, 2016 Hi. I've built a scene that loads my meshes with assetsManager.addMeshTask. But when I add fog to the scene the loaded models aren't effected by the fog. Is there a special trick in getting fog to work with the assets manager? Thanks. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted February 8, 2016 Share Posted February 8, 2016 They should be affected. Can you share a sample somewhere? (with reference to babylon.max.js) Quote Link to comment Share on other sites More sharing options...
RaananW Posted February 8, 2016 Share Posted February 8, 2016 8 hours ago, Deltakosh said: Can you share a sample somewhere? (with reference to babylon.max.js) You wrote this sentence again... GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
rogerst Posted February 9, 2016 Author Share Posted February 9, 2016 var canvas = document.getElementById("renderCanvas"); var engine = new BABYLON.Engine(canvas, true); var createScene = function () { var scene = new BABYLON.Scene(engine); var assetsManager = new BABYLON.AssetsManager(scene); var camera = new BABYLON.ArcRotateCamera("Camera", 6.3, Math.PI / 2, 0.1, new BABYLON.Vector3(5, 1, 0), scene); camera.attachControl(canvas, false); var light0 = new BABYLON.PointLight("Omni0", new BABYLON.Vector3(0, 10, 0), scene); light0.diffuse = new BABYLON.Color3(1, 1, 1); light0.specular = new BABYLON.Color3(0.55, 0.55, 0.55); light0.range = 20; var skybox = BABYLON.Mesh.CreateBox("skyBox", 100.0, scene); var skybox0Material = new BABYLON.StandardMaterial("skyBox", scene); skybox0Material.backFaceCulling = false; skybox0Material.reflectionTexture = new BABYLON.CubeTexture("skyboxes/stars01/skybox", scene); skybox0Material.reflectionTexture.coordinatesMode = BABYLON.Texture.SKYBOX_MODE; skybox.material = skybox0Material; scene.fogMode = BABYLON.Scene.FOGMODE_LINEAR; scene.fogColor = new BABYLON.Color3(0.9, 0.9, 0.85); scene.fogStart = 0.0; scene.fogEnd = 100.0; var projector1material = new BABYLON.StandardMaterial("projector1texture", scene); var projector1emissive = assetsManager.addTextureTask("image task", "models/planetarium1b.jpg"); projector1emissive.onSuccess = function(task) { projector1material.emissiveTexture = task.texture; } var green1material = new BABYLON.StandardMaterial("green1texture", scene); var green1emissive = assetsManager.addTextureTask("image task", "models/green.png"); green1emissive.onSuccess = function(task) { green1material.emissiveTexture = task.texture; } var gold1material = new BABYLON.StandardMaterial("gold1texture", scene); var gold1diffuse = assetsManager.addTextureTask("image task", "models/gold2.jpg"); gold1diffuse.onSuccess = function(task) { gold1material.diffuseTexture = task.texture; gold1material.diffuseTexture.uScale = 6.0; gold1material.diffuseTexture.vScale = 6.0; } var base2material = new BABYLON.StandardMaterial("base2texture", scene); var base2diffuse = assetsManager.addTextureTask("image task", "models/tower5c.jpg"); base2diffuse.onSuccess = function(task) { base2material.diffuseTexture = task.texture; base2material.diffuseTexture.uScale = 3.0; base2material.diffuseTexture.vScale = 3.0; } var floor1material = new BABYLON.StandardMaterial("floor1texture", scene); var floor1diffuse = assetsManager.addTextureTask("image task", "models/tiles3.png"); floor1diffuse.onSuccess = function(task) { floor1material.diffuseTexture = task.texture; floor1material.diffuseTexture.uScale = 300.0; floor1material.diffuseTexture.vScale = 300.0; } var scene1mesh = assetsManager.addMeshTask("scene1 task", "", "models/", "planett.babylon"); scene1mesh.onSuccess = function (task) { var projectorBase1 = task.loadedMeshes[2]; projectorBase1.material = gold1material; var projector = task.loadedMeshes[6]; projector.material = projector1material; var projectorBase2 = task.loadedMeshes[7]; projectorBase2.material = base2material; var floor = task.loadedMeshes[9]; floor.material = floor1material; } var scene2mesh = assetsManager.addMeshTask("scene2 task", "", "models/", "planett1.babylon"); scene2mesh.onSuccess = function (task) { var control = task.loadedMeshes[0]; control.material = green1material; var button1 = task.loadedMeshes[1]; button1.material = base2material; } engine.runRenderLoop(function () { scene.render(); }); assetsManager.useDefaultLoadingScreen = true; assetsManager.load(); engine.loadingUIText = "LOADING..." return scene; } var scene = createScene(); window.addEventListener("resize", function () { engine.resize(); }); Here is a sample and a screenshot. Thanks. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted February 9, 2016 Share Posted February 9, 2016 I meant: a live sample Quote Link to comment Share on other sites More sharing options...
rogerst Posted February 11, 2016 Author Share Posted February 11, 2016 So I figured out the problem. It looks like an issue with the Unity exporter. I've been using it to convert all my models. But when I export the same models using Blendar, the meshes are affected by fog. I'm using Unity 5.3.1. Is there a different version that works better with the exporter? Thanks. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted February 11, 2016 Share Posted February 11, 2016 You can check if your meshes have mesh.applyFog == false? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.