Jump to content

What is the standardmaterial.lightmapTexture for?


heyzxz
 Share

Recommended Posts

Hi there,

I found there are both 'ambientTexture' and 'lightmapTexture' properties on StandardMaterial in the doc, and I think I got a little confused with them.

Firstly, if I'm not mistaken, a lightmap is an image with not only the shadow data but also include some environment colors on it. It's not the same thing as the Ambient Occlusion(AO) map, which is just a black and white image with only shadow data, right? If so, my questions are:

1. I used to think the 'ambientTexture' means the AO map, until I read this: 'Unleash the StandardMaterial for your babylon.js game'. It says the 'ambientTexture' on StandardMaterial is for the lightmap, if so, what is the StandardMaterial.lightmapTexture for??

2. About the AO map, so the StandardMaterial doesn't support it, right? 

3. Does the PBRMaterial.ambientTexture means the AO map? Because I found it says 'AKA Occlusion Texture in other nomenclature' in the doc.

Thanks!

 

Link to comment
Share on other sites

Hey

1. ambientTexture is used to add a value to the lighting computation: (check the baseAmbientColor here: https://github.com/BabylonJS/Babylon.js/blob/master/src/Shaders/default.fragment.fx#L375)

2. if you are looking for a multiplicative value, then this is the goal of lightmapTexture: https://github.com/BabylonJS/Babylon.js/blob/master/src/Shaders/default.fragment.fx#L384

3. I leave this one to @Sebavan

Link to comment
Share on other sites

8 hours ago, V!nc3r said:

When we put lightmap in lightmap channel, and then set useLightmapAsShadowmap to true, is it the same process that put lightmap in ambient channel ?

Actually no. See the shader code which Deltakosh mentioned (The first reply). The ambientColor only effects on the diffuse color, it has no effects on the other colors (specular, reflection, or emissive...). But the lightmapColor (with 'useLightmapAsShadowmap' to true) effects on the final output color.

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