Jump to content

Search the Community

Showing results for tags 'bias'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 2 results

  1. I am having trouble with my shadows. Everything that receives shadows but is not occluded is covered with what I think is elsewhere referred to as "shadow acne". 1 blender exported ESM shadows do not work at all. Why? Are they for a later version of Babylon? 2 I am not clear on how the shadows are being mapped. My first approach was to try to minimize field of illumination to increase the apparent resolution by pointing spot lights at my model and setting the camera clipping plane (which apparently is mapped in the blender exporter to the shadowMinZ/MaxZ) to conservative levels. I have had inconsistent results with this, so I really would like to understand clearly what it does. Is there in fact a Z axis resolution of the shadow map? 3 Of course I toyed with the shadow bias settings as well. However, when I set the map resolution to 512, by the time I get rid of the problems, the shadows begin well, well below the overhangs that create them. Much further than the apparent resolution of the shadow map would suggest is necessary. Then I decided to turn up the shadow map resolution to 4096, but then, even adding .00001 to the default bias setting offsets the shadow map by a huge amount, rendering the setting essentially useless. This makes no sense to me. Also, what does the shadow map "resolution" mean for the directional lights, which have an infinite projection field? Is it somehow using the camera's FOV? In my use case, I don't actually need the shadows to be dynamic, so I can set their resolution high and their refresh rate to 0. Clearly I do not understand the shadows system, and am sorry to load so many questions at once. Any help is welcome! I can't give you the actual file I am working on due to non-disclosure issues, but I tried to recreate it with a simple model that has similar scale, thickness, light position, etc. Thanks! experiments.babylon
  2. Hi guys, trying to wrap my head around how shadows are working inside of BJS, and have a few questions. First off, I have this scene here: http://client.elementxcreative.com/public/bjs/fog_test/index.html You can move around the scene with the mouse/arrow keys. You can see the shadows looked a bit jacked up. Not only are the shadows low rez looking (despite having the resolution cranked up in BJS) but there is weird self shadowing on the objects themselves? Attached below is an image of the scene I'm exporting from Unity, what I'm expecting shadows to look closer to. It's just a single directional light. I'm manually fiddling with the filtering options on the BJS to try and get closer to this, but I'm not having much luck. Attached is code were using: var engine, scene; var mouseX,mouseY,dx,dz; var cameraTarget = new BABYLON.Vector3(0,0,0); var renderPlane, renderTarget; var DEBUG = true; var showstats = false; // Get the canvas element from our HTML above var canvas = document.querySelector("#render"); // var stats = document.querySelector("#stats"); // Load the BABYLON 3D engine engine = new BABYLON.Engine(canvas, true); engine.enableOfflineSupport = false; //this stops the manifest errors in the console BABYLON.SceneLoader.Load("assets/","fog_test.unity.babylon",engine,function(newScene){ scene = newScene; //CAMERA doCamera(newScene,canvas); // FOG doFog(newScene,canvas); // SHADOWS doShadows(newScene); // RENDER LOOP engine.runRenderLoop(function(){ newScene.render(); update(); }); }); function doShadows(newScene){ for (var i = 0; i < newScene.lights.length; i++){ var shadowGenerator = new BABYLON.ShadowGenerator(8192, newScene.lights[i]); newScene.meshes.forEach(function(mesh) { shadowGenerator.getShadowMap().renderList.push(mesh); shadowGenerator.bias = 0.0000001; //shadowGenerator.useVarianceShadowMap = true; shadowGenerator.usePoissonSampling = true; }); }; newScene.meshes.forEach(function(mesh) { mesh.receiveShadows = true; }); } function doCamera(newScene,canvas){ //new camera var newCamera = new BABYLON.FreeCamera("FreeCamera", new BABYLON.Vector3(0, 0, 0), newScene); newCamera.position = newScene.cameras[0].position; newCamera.rotation = newScene.cameras[0].rotation; newCamera.target = newScene.cameras[0].target; newCamera.fov = newScene.cameras[0].fov; newCamera.inertia = newScene.cameras[0].inertia; newCamera.mode = newScene.cameras[0].mode; newCamera.speed = 0.1; newCamera.attachControl(canvas,false); newScene.activeCamera = newCamera; //newScene.activeCamera.wheelPrecision = 90; //newScene.activeCamera.minZ = .01; // Define z key to rotate object z axis left newScene.actionManager = new BABYLON.ActionManager(newScene); newScene.actionManager.registerAction(new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnKeyDownTrigger, function (evt) { if (evt.sourceEvent.keyCode == 90) { console.log("z key pressed"); newScene.meshes.forEach(function(mesh) { //mesh.rotation = new BABYLON.Vector3(0, 0, 1); mesh.rotate(BABYLON.Axis.Z, 0.06, BABYLON.Space.Local) }); } })); // Define x key to rotate object z axis right newScene.actionManager.registerAction(new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnKeyDownTrigger, function (evt) { if (evt.sourceEvent.keyCode == 88) { console.log("x key pressed"); newScene.meshes.forEach(function(mesh) { mesh.rotate(BABYLON.Axis.Z, -0.06, BABYLON.Space.Local) }); } })); } function doFog(newScene,canvas){ newScene.meshes.forEach(function(mesh) { mesh.applyFog = true; // allow all meshes to be effected by fog }); // newScene.fogMode = 2; // newScene.fogColor = new BABYLON.Color3(1, 1, 0.85); // newScene.fogDensity = .0075; } function update(){ if (renderPlane){ //console.log('hey'); var v1 = new BABYLON.Vector3(1,0,0); var v2 = scene.cameras[1].target.subtract(scene.cameras[1].position); var vec = math.cross([v1.x,v1.y,v1.z],[v2.x,v2.y,v2.z]); var w = math.sqrt(v1.lengthSquared()*v2.lengthSquared()) + math.dot([v1.x,v1.y,v1.z],[v2.x,v2.y,v2.z]); var q = new BABYLON.Quaternion(vec[0], vec[1], vec[2], w); // Quaternion q; // vector a = crossproduct(v1, v2) // q.xyz = a; // q.w = sqrt((v1.Length ^ 2) * (v2.Length ^ 2)) + dotproduct(v1, v2) renderPlane.rotation = q.toEulerAngles(); //console.log(q.toEulerAngles()); } } Any thoughts on what we could do to improve the shadows? thanks!
×
×
  • Create New...