foumfo Posted March 23, 2018 Author Share Posted March 23, 2018 I'll try to make a playground but it will be big Quote Link to comment Share on other sites More sharing options...
V!nc3r Posted March 23, 2018 Share Posted March 23, 2018 So just import some walls, the light, and the ground, it should be enough. Quote Link to comment Share on other sites More sharing options...
foumfo Posted March 23, 2018 Author Share Posted March 23, 2018 https://playground.babylonjs.com/#M6HJ3P#1 It's not working though Quote Link to comment Share on other sites More sharing options...
V!nc3r Posted March 23, 2018 Share Posted March 23, 2018 (I fix some little things, now we have a scene for testing https://playground.babylonjs.com/#M6HJ3P#2) [edit] as asked, here my changed: attach camera to player seems to be break, so I disable player - doesn't need for tests add a mesh sphere to the light position push meshes to shadowgenerator now, just try to find time to help [/edit] Wingnut 1 Quote Link to comment Share on other sites More sharing options...
foumfo Posted March 23, 2018 Author Share Posted March 23, 2018 1 hour ago, V!nc3r said: (I fix some little things, now we have a scene for testing https://playground.babylonjs.com/#M6HJ3P#2) Nice, thanks about that. What did you change? I've added also a ceiling grid and nothing changed. That was just a check Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted March 23, 2018 Share Posted March 23, 2018 https://playground.babylonjs.com/#M6HJ3P#4 closer. Quote Link to comment Share on other sites More sharing options...
V!nc3r Posted March 24, 2018 Share Posted March 24, 2018 I don't understand, even by playing with shadowGenerator bias I haven't nice shadow result. https://playground.babylonjs.com/#M6HJ3P#6 (line 83 to 85 you can choose the light type) I think we have to test on meshes coming from .nanylon or .gltf file to see if the issue comes from generated meshes or not. Quote Link to comment Share on other sites More sharing options...
foumfo Posted March 24, 2018 Author Share Posted March 24, 2018 Is there any way we could rasterize (if that's the right term) a group of merged meshes? Perhaps that would help Quote Link to comment Share on other sites More sharing options...
Wingnut Posted March 24, 2018 Share Posted March 24, 2018 https://playground.babylonjs.com/#M6HJ3P#8 Hey, I get to play, too, right? I cranked-up the shadowGenerator's resolution a bit, and then did a bunch of other un-helpful things. What's the issue, here? Merged wall panels don't act correctly when used to block light? Never mind telling me, I'm terrible at shadow management, anyway. All in all, that .25 in line 86... really affects the shadows. The slight "tilt". Interesting. Sorry for killing the light sphere mesh. I was in a spotlight frame of mind. heh. Quote Link to comment Share on other sites More sharing options...
foumfo Posted March 24, 2018 Author Share Posted March 24, 2018 After some testing, I've made some observations: 1. light.shadowMinZ is necessary it seems for lighting to work 2.light.shadowMaxZ breaks the lighting in the scene 3. shadowGenerator.bias = 0.0001 is the only value of it that works, but with a few glitches 4. adding a mesh as the lights parent definitely breaks everything up. And thats the worst of it because I need this to work. check it out: https://playground.babylonjs.com/#M6HJ3P#10 Quote Link to comment Share on other sites More sharing options...
foumfo Posted March 24, 2018 Author Share Posted March 24, 2018 I still can't get it to work in my scene: var shadowGenerator = new BABYLON.ShadowGenerator(1024, playerLight); for(i = 0; i < scene.meshes.length; i++){ if(scene.meshes[i].name != "sphere"){ scene.meshes[i].receiveShadows = true; } } shadowGenerator.addShadowCaster(wallsFinal); shadowGenerator.bias = 0.0017; light.shadowMaxZ = 100; light.shadowMinZ = 0.0001; and this when I add all the meshes as shadowCasters: The only kind of light that works surprisingly well is a spotlight, just like wingnut's example but that's not what I'm looking for: Quote Link to comment Share on other sites More sharing options...
foumfo Posted March 26, 2018 Author Share Posted March 26, 2018 https://playground.babylonjs.com/#M6HJ3P#13 I managed to do something like what I had in mind but I still need to achieve this using a pointLight and not a spotLight. Plus, could anyone tell how to soften the shadow's edges? Quote Link to comment Share on other sites More sharing options...
foumfo Posted March 27, 2018 Author Share Posted March 27, 2018 Is there a way to merge the vertices of merged meshes ; Quote Link to comment Share on other sites More sharing options...
Guest Posted March 27, 2018 Share Posted March 27, 2018 What do you mean by merging the vertices? Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted March 27, 2018 Share Posted March 27, 2018 I would assume he wants to drop duplicate vertices. so like he he merged two planes instead of the point array being //First Plane -1, -1, 0, -1, 1, 0, 0, -1, 0, 0, 1, 0, //second Plane 0, -1, 0, 0, 1, 0, 1, -1, 0, 1, 1, 0 it would be: -1, -1, 0, -1, 1, 0, 0, -1, 0, 0, 1, 0, 1, -1, 0, 1, 1, 0 after merge. I think that's what he is going for. Quote Link to comment Share on other sites More sharing options...
foumfo Posted March 27, 2018 Author Share Posted March 27, 2018 18 minutes ago, Pryme8 said: I would assume he wants to drop duplicate vertices. Yeah, something like that. For example, 'merging' all duplicate vertices in a MergedMesh. Would it help in any way in terms of lighting and performance? Quote Link to comment Share on other sites More sharing options...
Guest Posted March 28, 2018 Share Posted March 28, 2018 It could break lighting as normals will be merged as well Regarding performance it clearly depends on the number of duplicates we will remove Quote Link to comment Share on other sites More sharing options...
foumfo Posted March 28, 2018 Author Share Posted March 28, 2018 1 hour ago, Deltakosh said: It could break lighting as normals will be merged as well Regarding performance it clearly depends on the number of duplicates we will remove Still if it can be done it's worth a shot Quote Link to comment Share on other sites More sharing options...
JohnK Posted March 28, 2018 Share Posted March 28, 2018 There is a method to remove duplicated vertices http://doc.babylonjs.com/samples/minimise_vertices however this will have an effect on lighting and textures where planes meet so you many find it produces more problems than it solves. You need to read this as well http://doc.babylonjs.com/resources/facets (incorrect link on min verts page - will correct) Note the following PG ONLY deals with minimizing vertices (196 before to 92 after) and makes no attempt to help with lights and shadows issues. https://playground.babylonjs.com/#M6HJ3P#14 Quote Link to comment Share on other sites More sharing options...
foumfo Posted March 28, 2018 Author Share Posted March 28, 2018 50 minutes ago, JohnK said: There is a method to remove duplicated vertices http://doc.babylonjs.com/samples/minimise_vertices however this will have an effect on lighting and textures where planes meet so you many find it produces more problems than it solves. You need to read this as well http://doc.babylonjs.com/resources/facets (incorrect link on min verts page - will correct) Note the following PG ONLY deals with minimizing vertices (196 before to 92 after) and makes no attempt to help with lights and shadows issues. https://playground.babylonjs.com/#M6HJ3P#14 I see. So it's better to just leave the merged planes as it is right? Quote Link to comment Share on other sites More sharing options...
JohnK Posted March 28, 2018 Share Posted March 28, 2018 Probably. Try a test with a couple of planes. 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.