Light in 3D Models

I used blend2bam to export lighttest.blend (742.6 KB), which is a simple model of a cube with pointlight+spotlight to make light.bam (4.5 KB).

They don’t light up the surroundings for some reason, how do I get lighting in 3D models to affect?

I would imagine that, as with lights made in code, you would have to apply the lights to the nodes that you want them to affect, via the “setLight” method. See the manual page linked below for more:

What child node is it? or do I just use setLight() for the actual model?

Plus how do you usually deal with lighting? I presume you don’t manually add them by code.

It would be whatever node or nodes you want to have affected, or a common ancestor thereof.

That depends on the project.

For my main project, lighting is fairly sparse, and I don’t need to add many. On top of that, I use custom shader handling of my lights. What lights I do add I then add via a combination of nodes in my level-models and some code.

In other projects with simpler requirements, I may well add lights by code.

Note, however, that I don’t use blend2bam. (I’m sticking to Blender 2.7 + YABEE for now, since my asset pipeline for my main project is set up for that.)

1 Like

Oh, I meant the other node.

So a generic command would be render.setLight(plnp)

What would I put instead of plnp?

Aah, I see! The parameter to “setLight” is the NodePath that contains the light itself.

I haven’t used a light loaded in this way, that I recall, so I don’t know whether you can just use the whole loaded model-NodePath, or whether you would have to search that model-NodePath for the relevant nodes within it.

It seems that this approach doesn’t really work

However, I did try using .getChildren() to find the child node and it worked! Thanks a lot for your help :slight_smile:

1 Like

Not a problem! I’m glad that you got it working! :slight_smile:

1 Like