Jump to content

Lightmaps from blender


micage
 Share

Recommended Posts

hello,

 

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)

 

,"uvs":[0.2066,0.2066,0.7934,0.2066,0.2066,0.7934,0.7934,0.7934]
,"uvs":[0.2066,0.2066,0.7934,0.2066,0.2066,0.7934,0.7934,0.7934]]
,"indices":[0,1,2,1,3,2]
 
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?
Link to comment
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!

Link to comment
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(',')
            uvs2+="]\n"
 
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.
 
cheers
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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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