Topic: Light is present in Maratis editor, in project models are black

I have one light in my scene in Maratis editor. Models are look fine.
When I'm loading project on iOS, models are black (looks like there is no light in scene).
I set breakpoint in drawScene method, and I see that scene contains one light (lSize = 1).
Looks like that models textures are loading fine (I added debug output in MMeshRef ).
Where should I look at to solve this problem?
What may be wrong?

Re: Light is present in Maratis editor, in project models are black

I found that if I add one of my models to Demos.mproj , lighting for whole scene works ok (include my model) both in Maratis Editor/Player and on my iOS device,
and if I load  my own scene (in that scene ~10 such models and ~ 5 lights) it  displays fine in Maratis Editor/player, but models appears black (as without lighting) on device.
I'm loading both scenes (Demos.mproj with my model and my scene) in the same project, so I think the code is ok, and error something in settings of my scene.
I tried to compare .mproj. files and .level files, but cannot find error.

Re: Light is present in Maratis editor, in project models are black

can you check that your camera is looking at the objects and that the clipping is correct,
also, just try the light with a big radius (in case)...

You are not using a custom shader with the mesh or something like that ?

Re: Light is present in Maratis editor, in project models are black

anael wrote:

can you check that your camera is looking at the objects and that the clipping is correct,
also, just try the light with a big radius (in case)...

You are not using a custom shader with the mesh or something like that ?

Al is correct as I can see with camera, and light radius is quite big.

I created small scene. scene
Light is ok on that scene both in editor,player and on the iOS device.
On device however the torch is not animating.
If I remove torch from scene or make the spot light  non-spot or remove this spot light from scene, the box become black on the device, in editor and player all is ok.
On iOS Simualtor all is ok in all cases, so I think this somehow related to realization of  GL ES on iOS devices.
I will try to find the reason of such behavior now and fix it.

Last edited by Petr (2012-09-13 08:04:13)

Re: Light is present in Maratis editor, in project models are black

I have found that if I remove omni light (light above the box) from the scene, and move spot light above the box (so the box is lighted), light is work ok on the device.
I think the reason may be in cooperative behavior of spot light and torch object (latter has transparency in one of its sub meshes, as I noticed).

I found that if in addition I set spot angle of spot light to 90.0, light remains on editor/player, and disappears on device.

Last edited by Petr (2012-09-13 09:37:58)

Re: Light is present in Maratis editor, in project models are black

Only difference I have found in execution when the spot angle < 90 and when the spot angle is 90 is that

                    render->getLightSpotDirection(i, &LightSpotDirection\[i\]);

in MiOSStandradRenderer::drawDisplay  line 405
returns non-zero vector when spot angle < 90 and  {0,0,0} when angle = 90
After that LightSpotDirection\[i\] is passed to shader, where is is used in computeLight.
May be there are other differences, but I couldn't find them.
In Simulator values of LightSpotDirection is the same as on the device, but the light is present for both scenes.
Also I cannot understand now how the presence of torch object affects on scene light.

Re: Light is present in Maratis editor, in project models are black

Wait, I taught there was only one light in your scene,
if there is more than one I think I know what is going on,
in Maratis each entity use only the closest light around :

For desktop it's the 4 closest lights, but on iOS because it slower, it's only the closest.
So that's why you can see a different behavior than on Maratis editor.
Try to use less number of light for ios, or to be sure the lights radius don't overlap too much.

Re: Light is present in Maratis editor, in project models are black

I tried to remove torch from scene , and lighting works.
Now I have in scene one mesh (box), one spot light with angle 89 and camera, and light works ok on the device. If I set spot angle of spot light to 90.0, light stops working.

On iOS simulator that code works fine both for 89 and 90 spot angles.

Last edited by Petr (2012-09-13 12:50:49)

Re: Light is present in Maratis editor, in project models are black

I tested my real app scene with one spot light with angle < 90.0. It works fine on the device, light is working.
I will use this approach in my scenes for now (only one light in scene, spot, with angle < 90.0).

Re: Light is present in Maratis editor, in project models are black

Yes, a spot cannot be more than 89.9 because it cannot be more than 180 degrees (fact 90x2 = 180° total angle)