Baked lighting?

In jme3,

I’m wondering how to go about baking the lighting of a 3d model, for the purposes of speed improvement by not having to use lighting in a scene.



My main question is it possible to import a blender model and show it without using a light? - that way I could bake the textures in blender.



If not, then what method would be best ? (I’ve hunted around the forums/net for solutions but couldn’t find much).



I get the feeling that I’ll have to build my own textures onto the model face by face, according to a light/dark algorithm of some kind, but hope there is an easier way,

Thanks.

I was thinking about it too…but the other way around, baking shadows, but that’s the same idea.



It could be interesting on a scene to bake lightings/shadows, but only on static objects, and of course if the light source does not move.



I guess the best solution would be to bake shadows/lightings into the model texture with blender or any other modeling application.

but you’ll have to build your scene in blender, place the light source, bake textures and then in JME place the light source at the exact same place.

So you could have static shadows on static objects and you would only compute dynamic shadows on moving objects.



I think there is a request in the issue tracker about importing lights an cameras in .scene ogre format. It could hep in the process.

yes, but if I import a blender object - can I show it in the scene without using a light?

it other words it’s 100% ambient (using the baked texture to simulate light/dark) - similar to how a simpletextured model can be shown without using a light.

That’s why i think baking shadows is easier.

You’ll always need a light in a scene.

ok

maybe you could me with this way-



I’m trying to import a model with a baked texture,

then create a SimpleTextured material,

copy over the texture/image data with tex coords into the new SimpleTextured material,

apply this new material onto the model,

switch off the lights,

and the model should show up with baked textures.



possible?

I guess it will, but honestly i never tried

And with SimpleTextured you won’t be able to use normal mapping or specular mapping.

i’m happy to sacrifice spec and norm mapping for speed increase,



i’m trying to figure out the code though, i know how to copy over image like so,

mat.getTextureParam(“m_DiffuseMap”).getTextureValue().setImage(newimage);



but where are the tex coords stored, and how do I copy them from the imported model into a new simpletextured material,

thanks.

I don’t get it… you don’t have to.

create your model, uv map it, create a texture and bake shadows/lightings in it with blender.

then export it to JME, load it, and that’s it.

sorry if i’ve confused,

but I want to render the scene without using a light - thus saving on performance - by just using simpletextured materials…

actually I nearly have it,

all working except the texture isn’t repeating -

how do I set the texture of a simpletextured material to wrap?

I know it’s setWrap(WrapMode.Repeat) - but I’m not sure of the java to change this on a newly created simpletextured material.

me again,

got it all working :slight_smile:

cool

and how is the result?

at first glance it looks fine even without the specular ‘sheen’ - and it is definitely faster with the frame rate…