Improve external lightmaps interpretation

Recommended Posts

Hi guys!

Since I use BJS, I always be kind of stucked with lightmap blending with my materials. I was working on standard workflow, but now I'm testing PBR, I have still the same issue, so this thread to understand deeper the blocking factor.

I never succeeded to get (basically) the same render from my 3D lighting scene to BJS, after many many tests :)

So I consistently had to tweak my hundred of lightmaps files in Photoshop to increase contrast/luminosity. These lightmaps could came from the usuals RenderToTextures passes from 3D softwares:

  • 3DSMax & VRay, from a RawTotalLighting pass
  • Blender & Cycles, from a Diffuse Direct & Indirect pass

Having to manually tweak these lightmaps cause me to lighting my scenes in a blind way (which is of course very annoying), and to not have a WYSIWYG workflow (like: tweak a lightmap > save > reload BJS scene > retweak > etc).

So here a test scene to discuss about: http://www.babylonjs-playground.com/#59ZXVF#11 (sources) (here the lightmap of the room).

You can easily switch or add lightmap mode using the line 32, default here is lightmap file set in lightmapTexture as shadowMap.

Because I'm a devianted person, I wanted to compare with another engine, so I made a scene on https://playcanv.as/b/OuZIGpY0/ : here you can see that my white data on my lightmaps files are read in a better way, they burn materials a little ; I think dark data are darker too. (note that PlayCanvas allow to send HDR files and convert them to RGBM, giving an interesting result, but in the link above I used the exactly same png file than in BJS, of course). And the result is totally satisfying.


So, have I missed a magic parameter? Is the shader need a little tweaking? Is my workflow totally wrong? How do you personally deal with lightmaps?


Edited by V!nc3r

Share this post

Link to post
Share on other sites

I think the playcanvas scene is on PBR


but it's true that default environment is not the same (and I don't find where is it in playcanvas, scene ambientColor doesn't change anything, and there is not default skybox), but! when I play with the gamma button, render tend to be similar than BJS! (below 1.0 instead of the default 2.2)


Is this related to the lightmap linear mode you talking about, or another path to investigate?

About the level parameter, I believe it tends to burn too fast lightmaps values (like the light impact on the ground).

I'm waiting about the linear thing ;)

Share this post

Link to post
Share on other sites

Yeah, you rocks!

It seems to work much better: http://www.babylonjs-playground.com/#59ZXVF#15

I've added a neutral environment, by not using the default one of createDefaultEnvironment, it adds a more... neutral... light (line 6).

It looks like we now have a better interpretation than playcanvas :lol: (playcanvas ref vs BJS patched).

Thanks for that great patch!

Share this post

Link to post
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.

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.


  • Recently Browsing   0 members

    No registered users viewing this page.