Sign in to follow this  

Lightmaps from blender

Recommended Posts



i'm trying to export my baked ligthmaps from blender. As my model should not receive any dynamic lighting, i created the first UV set for the "Emit" slot and a second one, lightmap packed, for the "Ambient" slot. So i have two different sets of texture coordinates for two different texture slots. The python exporter seems to have problems with that:


(excerpt from a simpe babylon file, exporting a quad)


It produces two identical UV arrays and mistakingly adds a bracket "]" at the end of the second one.
Does Babylon support multiple texture coordinates?
And Is there a way to get them from blender or maybe with FBX?
In addition, is there a way to exclude objects from dynamic lighting or specific lights?

Share this post

Link to post
Share on other sites

First, big thänx for your prompt reply.

At the moment i have no clou how to share a file. (could you give me a hint ;))


For test purposes i corrected the exported babylon file manually:

one array "uvs" and the second "uvs2", also setting "coordinatesIndex":1


Finally Lightmaps are working fine for a handcrafted quad. Fixing the exporter remains ...


"excludedMeshes" is great news. But wouldn't it be easier to include meshes explicitely to a given light?

Normally you wouldn't want all or most of your meshes be lit by diffuse light ... just thinking.


Keep up the good work!

Share this post

Link to post
Share on other sites

For me, by default a light should includes all object (this is the obvious behavior)


If you have a skydrive or a dropbox you can share the blender scene (else you can send me a PM:))

I found the error in the python export script, around line 553:


        if hasUV2:
            uvs2=uvs.rstrip(',')        # this has to be:  uvs2=uvs2.rstrip(',')
I also used "mesh.uv_layers" instead of "mesh.tessface_uv_textures" to get the uvs.
Maybe this is not necessary, but while testing i found out, that len(mesh.tessface_uv_textures) was zero.
@ diffuse lighting:
this is a complex topic, depends a lot on level design and shader management, also a matter of taste ;)
It remembered me of the first steps with the DirectX fixed function pipeline.
What one would not like is having static geometry lit by vertex lighting.
But there is the possibility to write custom materials, not depending on vertex lighting or even any lights.

Share this post

Link to post
Share on other sites

yes, it's working now! No need for extracting UVs from "uv_layers".


I think, i didn't get UVs from "mesh.tessface_uv_texture" because i was in EDIT mode and inside the phyton console.


Fine. Excited to see the shape of things to come ...

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.