PBR material in threejs

I have seen an example which has been developed using “Babylonjs” . In that application they used PBR Material, but threejs don’t have that. Since, threejs is powerful for webgl, definitely, it have some alternates for that . I need to know, what is that. And one more question is, that PBR material having some attributes like “useAmbientOcclusionFromMetallicTextureRed”., how to achieve this in three.js ?
Because that look and feel was too good. I need to achieve that with our three.js engine

You should spend some time reading the MeshPhysicalMaterial documentation. I’ll bet you could achieve the same effect as Babylon with the .aoMap property.

2 Likes

Yes @marquizzo. Thank you so much for your reply. I know, with three.js we can do anything. But how. I tried with aoMap also. My requirement is, the light needs to be taken for the model from it’s metalness or aoMap texture. Any possible way. Now I need to set hdr cubetexture for lighting. This is not fixed. If I rotate the object, the lighting changing accordingly. But For some objects, the lights should be fixed like light baking. So that lighting look and feel is too good. How to do that.

threejs does this automatically. aoMap only uses the red channel, and roughnessMap and metalnessMap similarity only use blue and green channels, so you can assign the same texture to all three.

3 Likes

Wow, great @donmccurdy . It is awesome. But our PhysicalMaterials are highly dependent on lights, If I didn’t set any directional light or Spot light or any envMap, the material will be black completely. Any way to get lights from that aoMap itself?

An aoMap occludes light, it doesn’t provide any information about light sources.

Can you provide a demo or image of what you want? If you just want the same effect you’re getting with envMap, but for it to rotate in sync with the model, there are easier ways to do this like orbiting the camera around instead of spinning the model.

Thank you for your quick response. @donmccurdy. Please have a look into the following link, I am doing a same like this. In interior dashboards and seat and all other parts, there is a fixed light effect, Exactly that’s what I need. And I have another one doubt. What is the use of the .blend property

https://www.toyotabharat.com/urbancruiser-360/

The Main thing in this sample is, the light applied for that interior files are not depending upon any light external light sources or EnvMap. all light effects are taken as some other light baking method lights. So only they are being static even rotate the objects. In exterior, the paint material’s lighting and reflection is depends upon the envMap. So only it is moving while rotating. But interior is not like that. How to do this. Please help me to achieve this. Thanks in Advance :pray:

If you want your material to “glow” without the need of lights, you could:

This is good for something like computer screens, where the color emits regardless of whether a light is shining on it or not.

To see the blending modes, check out this example:

2 Likes

@jaya_kannan can you not set scene.environment to null and completely change the lighting in the interior?

1 Like

Thanks for your reply @forerunrun. If I don’t set envMap, there is no lighting on the objects, so the object will be dark. couldn’t see that.

Thanks for your reply @marquizzo. I no need to make the object glow, I just want the object needs to be visible without any envMap or any other Directional Lights or Spotlights.

@jaya_kannan setting envmap to null and adding an ambient light will light the scene with no shadows or reflections…

@forerunrun Thanks for your suggestion. But ambient lights not giving light to Mesh Physical materials. That is the problem

@jaya_kannan, use photoshop to bleach a hdr so it’s flat white, use hdr toning to bring it down to a medium grey, load that as interior env map? Hackiest way I can think of aha

1 Like

Nice @forerunrun . I don’t think so whether that is the right way. But that is also a way. Thanks

@jaya_kannan

The example of the Toyota you have given is using hdr envmap and or directional lighting, you can see in the photo here with the reflections on the logo and the shadows on the floor,

I guess they have just modified their hdri so it fits the effect of light they need?

1 Like

Thank you so much for your effort @forerunrun. Yes. that might be the reason. But what about the effects on other parts like dashboard, console seat , steering. Because, their lights effect is being static

1 Like

@jaya_kannan

Zoom into this handle and open the doors…

You can see its not static, it’s not baked lighting, they have set up their materials with a greater index of roughness than metalness so only a few parts are completely reflecting the hdr, as well as probably using an appropriate hdr image as env map that does just enough lighting…

1 Like

Yes @forerunrun. That might be the reason. Thank you so much. I will try that

1 Like