Jump to content

Lights per mesh?


Recommended Posts

I saw that there was some discussion that the limit of four lights was not per scene, but per mesh. Can anyone explain how you'd assign a light to a certain mesh, or a group of meshes and not the scene?


Also, is this something that the Blender exporter supports so we can do this without code?



Link to comment
Share on other sites

You can use light.excludeMeshes array to exclude a mesh from a specific light


Trying to work on something that involves more than 4 lights in a scene - in fact 8+ lights and 40+ meshes (see layout on this thread)


The more I think about it, the more I feel it would be a lot easier if there was an "includeOnlyMeshes()" function/method.


In the example, it would be easier to include 10 meshes in the area a light is in, rather than exclude the 30 meshes outside the light area. (which has to be done 8x for the example).


It also makes it easier to add new meshes to an one area (don't have to change meshes data for all the other lights).



3dsmax exporter can export this info but not the Blender exporter


Any reason why?


cheers, gryff :)

Link to comment
Share on other sites

I totally agree with gryff  : light.includeOnlyMeshes(mesh); or light.includeOnlyMeshes = mesh; or light.includeMeshes "array"


It would be easier to include objects lighting by a light rather than exclude several objects.

But the exludeMeshes function is equally interesting depending on if you have a lot of mesh to include or exclude.
But I think the problem is that all objects are enlighten by default, so it must exclude the objects you don't want to enlighten by one light.
Link to comment
Share on other sites

Because I did not find such features in BLender



Well DK - an explanation of how Blender recognizes lights and meshes that may help. See the images below of a simple scene in Blender.


1. Blender allows you to build in layers - useful as the scene gets more complicated. In the big image below you will see five objects - a cube, a sphere, A Hemi light and a Point light and a camera. The cube and the Hemi are in Layer1 (L1 in image), the sphere and the Point light are in Layer 2. In the light properties (purple boxes) I have checked "This Layer Only"  for both the Hemi and Point lights. The camera is by itself in Layer 11.


2. The second,smaller, image is the render result I get when I select both the layers L1 and L2 (Shift +Left Click on the layers). Note the cube has flat Hemi Light and the sphere has shadow areas caused by the Point light only.


The actual .blend file is here if you wish to play yourself with layers and lights : Light Demo


My guess is to export meshes and lights you would have to sort them by layer then check the "This Layer Only Option" for specific lights. No idea how complex that is.


I've just published v1.14 beta with this new feature


C'est bon :)


Part of the roadmap for BJS 1.13 was shapekeys - how is that ?


cheers, gryff :)



Link to comment
Share on other sites

For Blender there is no other way to specify a list of mesh per lights?


DK, that is really the only way I know. There is a method using the Cycles Rendering Engine - but only for rendering so no use for BJS. Even if it is a little messy and takes a few seconds longer to export it can save a lot of time over manually getting all the meshes and lights and using that in code.


do you have a simple blender scene with a sample of mesh morphing?


Here is one to start with - single mesh ~1100 verts that has a morph/shapekey animation.Two shapkeys -Basis(undeformed) and "Draped" (fully deformed).


Above the regular timeline is the Dopesheet Timeline->ShapeKey Editor. Drag the green square and watch the values of the "Draped" shapekey change.


Or click the "Play" button to play the animation.


If that is not quite what you want PM me with requirements.


Deform Mesh Demo


cheers, gryff :)


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.

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.


  • Recently Browsing   0 members

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