I am building up an outdoor environment with buildings in my scene and would like the end result to look like the image below. From what I have found on google it seems like it is ambient occlusion that I am looking for. However, I read here in this forum that it is not optimal, and that another way to do this is with lightmaps.
Can I achive a similar result as in the picture with lightmaps or do I need ambient occlusion as well? What is a lightmap and how do I add it to my scene?
The effect you see in this effect are mostly from shadows and indirect lighting. AO won’t be able to generate these kinds of results. AO will equally shade all edges and corners, for this kind you’ll need a full fledged GI solution. Since those are pretty slow for realtime, it’s possible to bake the complete effect in lightmaps during modelling. Lightmaps are just like diffuse maps but contain how much light is arriving at any point on the scene. You can bake lightmaps in most 3d softwares like blender. Just google and you will find a lot of tutorials.
Once you bake the lightmaps you can export them with the 3d model in GLTF and threejs should automatically load them.
Thank you so much!
We load models into the scene in real time (the users do this) so I’m not sure I can bake the lightmap in advance. is there any way I can do this realtime?
You can generate a shadow map progressively in the scene, but it would be quite slow for a model this big. Threejs has an example for this: three.js examples
This doesn’t sound quite right to me — are you referring to screenspace AO? Baked AO can give results just as good as GI (at least in terms of the soft shadows) I think, as long as you have a nice UV unwrapping and spend the time baking AO offline.
Once you bake the lightmaps you can export them with the 3d model in GLTF and threejs should automatically load them.
Unfortunately not – glTF files can contained baked AO but not lightmaps. But you could attach the lightmap to the emissive slot in glTF, and then just swap it to .lightMap after loading in three.js easily enough.
is there any example for how this works? i have never seen a youtube tutorial for blender that deals with lightmaps. is this the same as baking into textures?
I’ve only baked diffuse or AO maps in Blender, I’m not as familiar with lightmap baking there, but I think people do… at least in three.js the lightmap is just a texture, not an irradiance volume or anything like that.
Right, sorry for not being clear earlier.
I was referring to SSAO not being able to generate that kind of images. Although it can if you ray trace the color buffer and have enough rays. it’s called SSRTGI.
And was referring to baked AO maps and using them with gltf and blender. Baking the whole lightmap doesn’t seem needed for this kind of rendering.
That is wrong. Searching what’s the meaning of AO. It is Ambient.
AO can’t give the same effect of lightmap whatever how well you unwrap you model. Lightmap include all highlight and shadow information and it is pre-rended . So it can store the shadow a model cast on another one. AO doesn’t have that information. Checking the reference image again, see how every shadow is formed. Also, AO need to use with lighting information, it is a modifier for lighting reflection.
Second, gITF can contain material and maps, check the . Lightmap is a diffuse map.
You can’t get exact same result as your photo without ray tracing. The easiest way is light baking. There are many book and articles talk about how real-time shadow problem can be solved in different games.
That is wrong. Searching what’s the meaning of AO. It is Ambient.
I’m not sure which claims you’re saying is wrong, but I do understand the definition of an ambient occlusion map. I was too broad in saying “Baked AO can give results just as good as GI” though, yes, since AO does only one thing (occlusion of ambient light on a surface). But the results of that one thing can be a very big improvement for much less work than ray-tracing.
The glTF specification has no official support for light maps – assigning a floating-point lightmap to the diffuse (“baseColorTexture” in glTF terminology) slot of a material is not going to do the right thing, unless you mean baking all lighting information to an unlit/shadeless material, which would also be fine. For better or worse there are a few competing definitions of light maps, I think that’s the main reason it isn’t available in glTF. But certainly you can bake a light map and then load it separately into three.js and assign it to the model afterward.
AO doesn’t generate light or shadow. It works just like normal map or roughness map, a modifier number. I know sometimes people use it to get a soft shadow effect. It doesn’t means it is a magic way in all condition. Especially, in the example above. No you can’t achieve that with AO. You have to bake light to get something similar.
Sorry, I have to clarify this old post, because many newbies will ask the same question and look for answer in this posts. And your reply is really misleading. I don’t want them to spend hours to google what’s AO or how to twist it. The first post already say the most straightforward path. He is correct.
About, lightmap, yeah it can mean many things I agree.The first answer just try to say: Baking the light, put the texture in the diffuse. That’s it. if you try to correct how people mean the lightmap, welcome to do it. But, what do you mean like “official support for light maps”, do you expect a specific slot like normal map? or roughness map?
In blender you can also bake the lighting directly into the textures, but you need to have unique textures/no repeats.
Baked AO also can go a loong way toward providing realism. It’s not the same as a full raytraced lightmap, but for scenes with a lot of ambient light.. and no light sources, i.e. daytime scenes, it works quite well.
A technique I’ve used before is to bake AO into separate maps, and then use a dynamic directional, shadowcasting light for sun.
If you want to use real lightmaps, then you usually have to create a second set of UV coordinates, since the main textures will use repeats, and lightmaps need to have unique mapping. (unless your doing something NPR in which case you use a baked diffuse+lightmap in a single texture.)