JohnK Posted June 27, 2016 Share Posted June 27, 2016 Anybody like to explain this behaviour. Note: when I say expected result what I mean is the results I expected not necessarily the developers expected results. In this PG http://www.babylonjs-playground.com/#1G708U#165 the 20 small grounds use the default grey material. Lines 22 - 24 light the green ground under the first 5 yellow spheres and lines 39 - 41 light the green ground under the last 5 red spheres as expected. Line 25 lights the grey grounds under the yellow spheres and line 42 lights the grey grounds under the red spheres, this is what is expected. Now comment out line 42, the grey ground under the yellow spheres is lit and those under the red spheres are not lit - as expected. Now comment out both lines 25 and 42, expected result no grey grounds lit, however what happens is that 4 of the grey ground remain lit. Also all the green ground under the yellow spheres is lit. Now remove the comment from line 42, expected result is grey ground under the yellow spheres are not lit and those under the yellow spheres are not. Actual result is for both commented out. First thought was the PG was using default material for all grey grounds with default light limit. So move to PG http://www.babylonjs-playground.com/#1G708U#166 and repeat which lines are commented in and out, this time using lines 29 and 47. Note that the number of lights for the blue material has been increased, line 16. Actual results are similar to first PG but not quite, neither commented and just 47 commented as before as expected. Both commented five under yellow are lit and all green lit. 29 commented all under red are lit but 5 under yellow are also lit. So I am confused. Are my expectations wrong or is there something else going on? Quote Link to comment Share on other sites More sharing options...
adam Posted June 27, 2016 Share Posted June 27, 2016 It seems odd that you have to explicitly includeOnlyMeshes on both grounds for them to all be lit. Some of the small grounds are not lit here: http://www.babylonjs-playground.com/#1G708U#167 All are lit here using includeOnlyMeshes on both grounds: http://www.babylonjs-playground.com/#1G708U#168 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 27, 2016 Share Posted June 27, 2016 Hey! 1. Now comment out both lines 25 and 42, expected result no grey grounds lit, however what happens is that 4 of the grey ground remain lit : This is because the lights (from 0 to 4) has an empty includedOnlyMeshes collection so they go back to general selection mechanism 2. Now remove the comment from line 42, expected result is grey ground under the yellow spheres are not lit and those under the yellow spheres are not. Actual result is for both commented out. This is because it is not different as light has not an empty list here (see line 38) Quote Link to comment Share on other sites More sharing options...
JohnK Posted June 28, 2016 Author Share Posted June 28, 2016 @Deltakosh sorry but still confused Where and why do you use light.includedOnlyMeshes? In this http://www.babylonjs-playground.com/#1G708U#178 the 10 lights automatically light the 10 grounds. In this http://www.babylonjs-playground.com/#1G708U#179 some lights are excluded and the corresponding grounds are not lit. So far so good. Now only want to include some lights so try http://www.babylonjs-playground.com/#1G708U#180 but everything still lit. OK now try to exclude each light as it is created and then only include those wanted as in http://www.babylonjs-playground.com/#1G708U#181 now they all sort of seem unlit but a little light depending on camera angle. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 28, 2016 Share Posted June 28, 2016 Not sure to understand the problem here: http://www.babylonjs-playground.com/#1G708U#180 Every plane is lit by the light beneath it so what's wrong? In this example (http://www.babylonjs-playground.com/#1G708U#181) grounds are still affected by lights <4 or >8. JohnK 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 28, 2016 Share Posted June 28, 2016 IncludedOnlyMeshes defines the exclusive list of meshes which will receive lighting from the specific light. This means that ONLY the meshes specified will be lit by the light ExcludedOnlyMeshes defines the exclusive list of meshes which will NOT receive lighting from the specific light. This means that ALL meshes but the specified will be lit by the light JohnK 1 Quote Link to comment Share on other sites More sharing options...
JohnK Posted June 28, 2016 Author Share Posted June 28, 2016 @Deltakosh thank you for the explanation, my thinking was all wrong. I was getting confused by the number of lights and thinking that includedOnly also related to the index. I now understand. GameMonetize 1 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.