Start a new topic

3D lighting and material

3D lighting and material

I'm curious if there's support for lighting in a 3D model.  I'd like to position a light in the scene so it matches the direction of the sun (in order to make the model fit into its surroundings better).

Also, can inidividual components of a model be animated?  I'm thinking of something like a treasure chest that opens up.

Thanks in advance for any information.


Lighting is already supported, however you won't be able to change just the position of the light. Transformations are currently applied on the complete loaded model scene. Additionally we are working on supporting animations exported from 3D modeling tools and will let developers know as soon as it is available.

I like the idea of matching lightning to the sun's direction and as we already discussed this idea internally a while back, we might provide this as built in functionality somewhen in the future.


If you can provide built-in sunlighting capability, that would be even better.  Less code for me to write.   :-)

Support for exporting 3D animations would also be great, and would open up lots of possibilities.

Thanks for your prompt answer, and thanks for Wikitude!


I've been experimenting with lighting.

I create my file in Blender, with a single light source.  I export it as FBX, and bring it into the Wikitude 3D encoder.  No errors or warnings.

If find that if I use a point light, it has no effect -- the object is lit uniformly, the same as if I don't have the point source there.  The scene hierarchy display does show my point light source.

If I use a directional light (i.e. "sun" in Blender), it works -- but of course, half of my object is black because it receives no light.  This is a problem, since I animate the rotation (i.e. heading) of the object at runtime.

Am I overlooking something?


Point light is supported, so it would be great to have a look at your .fbx and/or blender file. If you aren't comftable posting it in the forum, please send it as email (or a link to the file) to info AT wikitude DOT com.

Regarding directional light, you can set an ambient light so the backside won't be black. Have you tried that?

Thanks, I'll email you a zip in a few minutes.  I appreciate the help.


One interesting thing I notice is that when I use a directional light source, the Wikitude 3D Encoder shows me the light's properties when I click on it in the hierarchy view.  It has direction and light color.

However, if I use a point light, I see no properties at all when I click on it in the hierarchy.

I've also tried using a directional light and increasing the ambient value (Blender's World button, Ambient Color setting) but it has no effect.

I've also looked at the FBX file, and in the material properties I see:


Property: "AmbientColor", "ColorRGB", "",0.5382,0.5382,0.5382

Property: "AmbientFactor", "double", "",1.0000

Property: "Ambient", "ColorRGB", "",0.5,0.5,0.5


And in AmbientRenderSettings I see:


AmbientLightColor: 0.5,0.5,0.5,0


... so that all seems reasonable.


If I can get some ambient light into the scene, I would be fine with a single directional light.  Alternatively, if i could have two or three directional lights, that would be fine too.


Thanks in advance for any help or suggestions.

Thanks for the model file. It helped to speed up things. So here's what I found out:

First the bad news: Blender does not export point lights correctly when using fbx. They end up without attenuation values (regardless of what is defined as falloff). This is nothing under our control and might change with a future exporter version.

However: The way point lights are exported is picked up as an ambient light source in our encoder. Therefore you can use a point light in blender to define ambient light. Additionally define a directional light and you should be able to get the desired effect.

A side note to DAE:

If exporting the scene as DAE you have to manually delete the attenuation paramters of the point light (which seem to be exported wrong as well) within the .dae file.

First of all, thanks for the suggestion about using a point light to produce ambient lighting.  I would never have thought of trying that.

I notice that the directional light doesn't appear to be pointing in the same direction in the encoder as it is in Blender.  If I have the directional light pointing straight down in Blender (illuminating the top half of my model), it appears to come from the right side in the encoder.  It's probably something to do with the coordinate system orientation being different (Blender has Z "up", whereas almost everyone else, including Wikitude, has Y "up").

At first I thought it might be a problem with Blender's FBX exporter (as it turned out to be for the point light issue), but when I look at the file in Autodesk's FBX viewer plugin for Quicktime it's correct.




I did see this happing and we will have a look at this next week. Have you tried it on the device? Is the light correctly rendered there?

FYI: One addition to the ambient light:

The odd thing is that exporting an ambient light from maya to fbx (where an ambient light is just another light type, like point, sun, spot ) will produce exactly this: a point light without attenuation. Still not intuitve but it explains why the encoder does handle a point light this way.

I'll try it on the device and let you know what the results are.  I would think they would be the same, since you're (probably) using the same OpenGL ES based renderer in both the encoder and the SDK.

Yes, very strange about the point light.  It sounds like the FBX exporter in Blender and one in Maya have the same issue with point lights.  That's surprising, since I believe the Blender FBX exporter is written in Python while the one in Maya is (I assume) written using Autodesk's FBX SDK.



I just verified that the rendering on the device is the same as in the encoder.


Hi, I've good news. We fixed the issue this week and it will be in the upcoming Wikitude 3d Encoder release, only days away ;). You will get an automatic update notficiation once we publishe the release.

That's great news!

Thanks very much for all your hard work, Wolfgang.  It's much appreciated.

Have a good weekend.

Login or Signup to post a comment