Jump to content

Search the Community

Showing results for tags 'shadowgenerator'.

  • 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 17 results

  1. This was entirely accidental. I was adding large voxel maps (126x126x32) together with Mesh.MergeMeshes and trying to have them self-cast shadows. I was testing frame rates on a few computers to see which techniques were better for performance. A strange and buggy texture appeared on everything that looks like stripes, but for whatever reason it is lighter near the outwards facing edges of meshes and darker towards the inner edges. I think it looks like ambient occlusion. Before fixing it, I figured I should take a few pictures in case it was the type of thing worth trying to reproduce in the future. Sorry if this is just some normal thing that shadows do, for me it was a surprise. The interesting looking "bug": How my game usually looks: Example of the performance test, this used to be 9 meshes, but I merged them into one. Some of the meshes were 5 MB+ of voxel noise converted to meshes via magicavoxel. The striped pattern (not a texture, i have no textures) is visible in the pink area, meanwhile all of the voxels in the distance look like they're being shaded. The tree and the stairs behind it got some special texture and shading. Normally the steps on the stairs aren't even distinctly visible b/c they're the same color and I've done nothing to make them pop out. Just seeing this makes me want to add some textures or maybe learn about shaders.
  2. I'm trying to cast some shadows from a voxely mesh onto itself, and I seem to be getting a bit of light right at the base of the shadows. Any idea how to fix? First picture is the shadows in their simplest mode before any blurring: And here are some shadows with all of the effects, which causes even more light to appear: I'm not sure how to reproduce it in the playground. I got my shadows just by copying and pasting the ShadowGenerator from the shadow demo: https://playground.babylonjs.com/#FH3FM2 In the shadow demo there is no problem, the shadow goes right to the foot of the columns without any light appearing underneath. My scene is one single mesh, so I tried merging the ground and the columns in the shadow demo but that didn't reproduce it either. Here is the merged: https://playground.babylonjs.com/#FH3FM2#12 Any ideas?
  3. Hi, I use TransformNode as parent for my meshes and would like to add all children to ShadowGenerator, like this `addShadowCaster(node, true)` but it accepts just AbstractMesh as input there, what about changing type to TransformNode ? Like this: public addShadowCaster(mesh: TransformNode, includeDescendants = true): ShadowGenerator { if (!this._shadowMap) { return this; } if (!this._shadowMap.renderList) { this._shadowMap.renderList = []; } // Need to check if is real mesh if (mesh instanceof AbstractMesh) { this._shadowMap.renderList.push(mesh); } if (includeDescendants) { this._shadowMap.renderList.push(...mesh.getChildMeshes()); } return this; } for `removeShadowCaster` similar public removeShadowCaster(mesh: TransformNode, includeDescendants = true): ShadowGenerator { if (!this._shadowMap || !this._shadowMap.renderList) { return this; } // check if real mesh if (mesh instanceof AbstractMesh) { var index = this._shadowMap.renderList.indexOf(mesh); if (index !== -1) { this._shadowMap.renderList.splice(index, 1); } } if (includeDescendants) { // use getChildMeshes instead of getChildren to support nested TransformNodes for (var child of mesh.getChildMeshes(true)) { this.removeShadowCaster(<any>child); } } return this; } Any objections on this ? I haven't tested / profiled change impact so its just an idea now Would like to hear feedback, as maybe I am missing something here
  4. Hi, found case that can trigger null pointer for removeShadowCaster, (possibly addShadowCaster as well). As includeDescendants is true by default it tries to remove shadow from children as well, but _children array can be null. if (includeDescendants) { // mesh.getChildren() can be null for (var child of mesh.getChildren()) { this.removeShadowCaster(<any>child); } } So one version is to make check before: var children = mesh.getChildren(); if (includeDescendants && children) { for (var child of children) { this.removeShadowCaster(<any>child); } } Same issue is on addShadowCaster as it tries to push children in the list
  5. Hi folks, I'm having trouble with shadows - they seem to be 'floating', as you can see from the screenshots. The problem is much worse when I don't use usePercentageCloserFiltering. As you can see, the meshes do intersect! Unfortunately, I can't do a PG as it's a complex scene and is heavily copyrighted The settings for shadows are: let shadowGenerator = new BABYLON.ShadowGenerator(2048, shadowLight); shadowGenerator.usePercentageCloserFiltering = true; Any ideas?
  6. http://playground.babylonjs.com/#1NE321#1 Maybe this isn't even a bug but a setting that I'm too newb to figure out... but the shadow distorts pretty bad on smaller spheres. When you make the sphere bigger, it look beautiful. Like this: http://playground.babylonjs.com/#1NE321#2 Is this indeed a bug? Or, is this a setting that I can dynamically change? Or, is it just a limitation that I should just be patient on?
  7. Hey everyone, I am trying to add a basic shadow in scene with directionnalLight but it doesn't seem to work after all kind of tests. I tried to get inspiration from other playgrounds : https://www.babylonjs-playground.com/#1KF7V1 https://www.babylonjs-playground.com/#IIZ9UU And I even went in the source code of this great example : https://www.babylonjs.com/demos/advancedshadows/ I create one that is not working and where I can't see the difference with other scenes : https://playground.babylonjs.com/#TWANP3 It seems very basic but I just can't see the problem. Thanks, Pichou
  8. Sorry for asking, maybe trivial, but I found nothing in the source... How can I switch the shadowgenerator on/off during runtime? Thanks
  9. Objects which at the same time produce and receive shadows show some strange glitches. http://playground.babylonjs.com/#1SGTPA#9 I tested it on Nvidia NVS3100M and Intel HD Graphics (1 st gen.) On each of those cards the the size of circles is different, but looks bad anyway. When you comment lines 92,93: // shadowGenerator.getShadowMap().renderList.push(plane); // shadowGenerator.getShadowMap().renderList.push(videoPlane); Planes start to look ok, but it is not a solution at all, in case of more complicated meshes/scenes selfshadowing is an important feature. Only in very limited scenes it is possible to make it good by disabling some meshes shadows.
  10. So I would like to have my terrain cast shadows on it's self, like the mountains shadow the rest of the terrain, etc. But when I try to do this by adding the groundPlane to the shadowGenerator, the entire mesh turns black. Is there a way to do this, or is this not something that can be done yet? I really hope to be able to pull this off!
  11. Hi everybody! I'm having some troubles with shadows on my scene... I have a scene with a labyrint, a car and some objects that the car can collect while moving (boxes and coins). There is a point light that moves around the scene (the sun), and two spot lights that moves with the car (car lights). Working just with the shadow generator for the sun, I noticed that If I use PBRMaterial for my meshes, I cannot see any shadow (and changes in light's position neither, actually). Now I'm using only StandardMaterial, but I'd like to switch to PBR to have a more realistic effect Boxes project their shadow also on the back side of the walls (as shown in picture). There are problems if a mesh both receives and creates shadows I've created a simplified version of the scene, where there is the problem of the shadow on the back of walls, at http://www.babylonjs-playground.com/#M8O41 In the picture there is a screen of my scene with the "multiple" shadows (light's position is the same of the sphere in the right corner). I'm sure I'm doing something wrong, but I have no idea of what... Can anyone help me? Thank you and sorry for my bad english
  12. OK so I have this endless chunked terrain where I am walking around, I head out a ways, the sun/light objects are moving with the player as I move keeping it's orbit and direction pointed toward the player model, but for some reason the shadows start to go off to the wrong side and distorts (see above image)! Is there a way to tell the shadow generator the light position and target has updated because it looks like it isn't updating since it was instantiated. I'd think it would auto update or something each frame to make sure it was following the light source properly, but that doesn't seem to be the case here. Is there something like shadow generator.update() or something I'm missing? How would I get this to work right, it is bugging me! Here is the bit of code that updates the sun/light position pre-calculated before frame render, less global variables of course.. scene.beforeRender = function (){ skybox.rotate(BABYLON.Axis.Z, -0.00008, BABYLON.Space.PIVOT); if(sunmove && actor){ sunvls.mesh.position = new BABYLON.Vector3(actor.position.x + sunorbdis * Math.sin(sunorbdelta), actor.position.y + sunorbdis * Math.cos(sunorbdelta), actor.position.z); light.position = sunvls.mesh.position; sunorbdelta += sunspeed; } }; How can I work in shadow generator update? Thanks!
  13. Hello, I am having trouble with the shadow generator, this playground illustrate my problem => http://www.babylonjs-playground.com/#DAKLR#4 I made a room with a window. Then I add two lights with a shadowgenerator for each one, the two sphere show their position into the scene. The one outside the room act properly (you can see light pass through the window), but the one inside the room light nothing. If you comment line 97 -> 104 (remove the roof) the light inside act properly. Thanks
  14. Hello, I am trying to generate shadows for a 3D scene with the ShadowGenerator of Babylon. My problem is the following : a mesh can't create shadows and receiving shadows at the same time. Here is a playground where this is illustrated : http://playground.babylonjs.com/#1R4XE8#1 Let's focus on lines 47 & 48 : torus.receiveShadows = true; shadowGenerator.getShadowMap().renderList.push(torus); If the first one is commented the torus doesn't receive shadow and when it pass into the cube shadow, it is still highlight. If the second one is commented the torus doesn't create shadow but when it pass into the cube shadow, it act well. Finally if the both are uncommented the torus is constantly shadowed (like it is occluding by itself...) Thanks for any help !
  15. Hello, I'd like to access the babylonScene.ShadowGeneratorsList that SceneBuilder.Lights.cs uses, but I can't seem to find any variable that doesn't come up as undefined after I've called the SceneLoader.Load private void GenerateShadowsGenerator(Light light) { var generator = new BabylonShadowGenerator { lightId = GetID(light.gameObject), usePoissonSampling = light.shadows == LightShadows.Soft, mapSize = 256 + 256 * QualitySettings.GetQualityLevel(), bias = light.shadowBias / 10.0f, useBlurVarianceShadowMap = light.shadows == LightShadows.Soft }; var renderList = new List<string>(); foreach (var gameObject in gameObjects) { //why not deliver the boolean to the scene? I could use that boolean to manually create shadows inside babylon. var meshFilter = gameObject.GetComponent<MeshFilter>(); var renderer = gameObject.GetComponent<Renderer>(); if (meshFilter != null && renderer.shadowCastingMode != ShadowCastingMode.Off) { renderList.Add(GetID(gameObject)); continue; } var skinnedMesh = gameObject.GetComponent<SkinnedMeshRenderer>(); if (skinnedMesh != null && renderer.shadowCastingMode != ShadowCastingMode.Off) { renderList.Add(GetID(gameObject)); } } generator.renderList = renderList.ToArray(); babylonScene.ShadowGeneratorsList.Add(generator); //***How do i access this list in babylon?*** } The end goal here would be to emulate the Unity mesh renderer option to cast shadows or not. The exporter does this, but if I can't access the shadow generator list, I can't determine which meshes to push into the wanted shadow generators. That's my understanding of the problem at least. As an aside, I've created shadow generators for two point lights (manually), and I'm importing one spot light which I've positively determined has a shadow generator created for it somewhere. "shadowGenerators":[{"mapSize":1536,"bias":0.005,"lightId":"c21fd6a4-701a-4377-86b9-868b221c1c96","useVarianceShadowMap":false,"usePoissonSampling":true,"useBlurVarianceShadowMap":true,"blurScale":0,"blurBoxOffset":0,"renderList":["f808b945-1605-4e8f-8233-f75b89e55c71","0cc9fd1e-1a23-4c9e-9cef-5b0c87faf717","36d7e455-a32f-490a-b837-3043d6f30691","5091d4f8-2767-4e7e-acb6-a7c179b33583","c5313fc0-4edd-43d7-8dcf-85f76e83905f","d3d119e6-37f5-4725-af03-f470a755ac93","d5d11567-f959-4291-b784-ffb07089e6bd","9141800a-91a8-4d51-bceb-85df54d49e39","acce9ece-cd8f-42fb-98e7-53ff7de56315","cd22cc1d-07f7-4845-9de2-967f42eabf5b","0ad378ab-6f73-4861-91a9-bc649ffd4759","a8e8b351-71a2-4bb9-a995-736b637615a6","385b2d6a-a789-4a2a-ba99-73c45f096c8a","d056b786-d3d8-45dc-ae61-509a34b17f1a","0bf62911-a3cf-4bd8-a0b4-96fd20a89fd2","fdfc93be-5a6c-4049-80de-c6912168f1c8","25efb981-7f78-4c5c-8e28-cfde40b304f5","1bf1b3b6-b0fe-4fe5-a5af-1509ed156dbc","673a7d44-10c1-47e4-9d12-2c55322f3b28","aa4d1889-0951-4d43-81d8-5d774a7012d2","157582a5-5887-4661-bbf8-29aaa6da108c","7b3f2c8d-447b-41fa-9366-d007137e6a3c","c4860f5e-d38e-4285-a098-3a158564dd8e","f5e3a43a-4475-4c67-941d-bab8a377290e","49374c28-a289-471b-83df-2af6773d18b2","d8511075-b08c-47ea-a779-7720c91351ae","e2807f9b-3807-4ae0-bdff-86ab12195672","d730e55a-948c-4ac5-beef-a9eb8ae12479"]}],"skeletons":[],"actions":null} The only thing left I have to do is determine which meshes can cast shadows, and then push those meshes into the shadow generator render lists. Thank you for your time.
  16. I am trying to develop a shadow on the ground but after following the tutorial and going over other examples I could find, still its not working for me. Here is the code I have: var canvas = document.getElementById("renderCanvas"); var engine = new BABYLON.Engine(canvas, true); var scene = new BABYLON.Scene(engine); var light = new BABYLON.PointLight("light01", new BABYLON.Vector3(0.5, 3, -1.5), scene); var sphere = BABYLON.Mesh.CreateSphere("sphere", 16, 1, scene); var ground = BABYLON.Mesh.CreateGround("ground1", 6, 6, 2, scene); ground.position.y = -0.5; // Shadows var shadowGenerator = new BABYLON.ShadowGenerator(1024, light); shadowGenerator.getShadowMap().renderList.push(sphere); shadowGenerator.useVarianceShadowMap = true; // throws an error says light.supportsVSM is not a function ground.receiveShadows = true; var camera = new BABYLON.FreeCamera("camera01", new BABYLON.Vector3(0, 2, -3), scene); camera.setTarget(new BABYLON.Vector3(0, 0, 0)); camera.attachControl(canvas); scene.beginAnimation(sphere, 0, 100, true); // Render engine.runRenderLoop(function() { scene.render(); }); This scene does setup and run no problem with a ground plane, sphere which reacts to the light, its just that the ground does not receive shadows from the sphere. I am using babylon v2.2 currently
  17. Hi, I am momentarily writing a report about BabylonJS and as I was analysing my scene I came up with the question if any new instance of a ShadowGenerator would also create a new Texture for its shadow map ... I guess (soly based on the constructor parameters) that each ShadowGenerator creates a Texture of the size specified in the constructor parameter and that the renderer (or a post processing entity) will combine all those shadow maps at the end. Is that true or does it work in another fashion? Thanks for the answers in advance, Dinkelborg
×
×
  • Create New...