Lights limit 4. How to change it another way?

Hi all :slight_smile:

I have question about hot turn off limit of lights in the scene ?
I know it is possible with : material.maxSimultaneousLights = 16; but is it possible to make it with some other way ?

Because I have game environment made in blender, if I use standard material it delete all exported material from obj.babylon .

Thanks in advance for your answers :slight_smile:

Hello! not sure to get your problem :slight_smile:
Why not going through the list of your materials after having loaded the scene from blender and set the maxSimultaneousLights value?

1 Like

Also, max lights is a custom property. On the 2.79 exporter it is in Mesh properties. In 2.80, it is in material properties.

As long as you are not using either shadows, or want dark areas in your scene, you can actually have the light(s) move around with the camera. If a mesh cannot be seen, it is going to be culled, so who cares if it is not being light on any given frame?

Here, you can actually set the max lights to however many lights are moving with the camera. Thought this might conserve resources, but not suer. One is usually fine. You cannot do this from the JSON / .babylon exporter, but if you created a point light:

const camlight = new BABYLON.PointLight("Lamp", BABYLON.Vector3.Zero(), scene);
scene.beforeCameraRender = function () {
    var cam = (scene.activeCameras.length > 0) ? scene.activeCameras[0] : scene.activeCamera;
    // move the light to match where the camera is
    camlight.position = cam.position;
    camlight.rotation = cam.rotation;
};
2 Likes

Well the maximum number of lights can be set in Blender before you export - but, as @JCPalmer says, it depends on which version of Blender you are using. Blender 2.79 or earlier in Mesh Properties.

cheers, gryff :slight_smile:

2 Likes

Thanks for answers :slight_smile: I tried to search on google : How to export obj with limitation of lights. But, I didn’t find anything. Maybe I used wrong words.
In blender 2.79, how can I find the limitations of lights and the Mesh Properties ? I don’t see that in blender. Maybe I need better diopters :smiley:

I was talking about the babylon specific JSON exporter for Blender, here. It is by far the most complete format.

1 Like

but, I alredy have babylon exporter … so i need to go in babylon format and change the maxSimultaneousLights value ?

AS I mentioned you can always do it after loading the file

The image is long, so you must click to see whole thing.

2 Likes

Thank you @JCPalmer @Deltakosh and @gryff :slight_smile: Sorry I had banal questions.

Have a nice day :slight_smile:

Is there a max lights setting for the Maya exporter?

@Deltakosh

nope this is only by code for now

Would be a good candidate for a mayaexporter update.