Lightmaps are being Rotated :/

Hi All,

Humble Potato here again looking for some support :grimacing:

I am trying to upskill in the world of lightmaps and I have created a sample scene to try this out, its a large scene as I wanted to see how lighting would work over large surfaces and I have some procedural textures in my scene, one being over the large floor that I wanted to test first. I am also using ‘The Lightmapper’ tool in Blender, although the documentation isnt great so if anyone knows of good settings for this i would appreciate it :blush:

here is the lightmap generated in Blender, I did notice the lightmap seemed a little washed out but probably to do with the light source i am using:

This is what it looks like in a Blender render view:

and when i apply this in the Sandbox this is what i get, it looks like these lightmaps are being rotated for some reason and I dont know why as I tested with another item in this scene with a set of proedural textures and the lightmap again ended up rotated.

If anyone can help steer this potato :potato: in the right direction I would really appreciate it!

Thanks

I think it may not be a rotation issue.

The tool probably generates an extra uv set for your model. The Texture in babylonjs uses the first uv by default.

You can try changing the uv set of the mapping to see if that solves the problem.

    texture.coordinatesIndex = 1

Then, you’d better check the exact uv, because it can sometimes be more than two.

1 Like

Also check this parameters

mesh.material.useLightmapAsShadowmap = true;
mesh.material.lightmapTexture.uAng = Math.PI;
mesh.material.lightmapTexture.level = 1;
mesh.material.lightmapTexture.coordinatesIndex = 1;
2 Likes

Yes, as per @DRLeria I’d say it must be something around this. Quite a common issue when converting right vs left-handed:

Although, as I said in my post there are different solutions to address this issue.

2 Likes

Hi All,

Sorry for the delay in replying here its been a crazy few weeks and I have been travelling.

I have tried the suggestion provded for the texture coordinates and it works as expected now :slight_smile:

This humble potato thanks you :potato: :blush: :potato:

1 Like