Jump to content

Lights Strange Behaviour


JohnK
 Share

Recommended Posts

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?

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

@Deltakosh sorry but still confused :unsure: 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.

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...