Page 1 of 1

AO/Lightmap baking

PostPosted: Mon Apr 15, 2013 4:18 am
by Sirius
Hi everyone,

This is a question about lightmap/ambient occlusion baking (obviously).
No matter how I do things, the result is always crap.
I've tried studying the Relativity blender file, unfortunately I already know how to create these maps and apply them to an object so they can be seen in Uru.
I'm missing something in the lighting/baking parameters, since it occurs in Blender 2.49 AND 2.66. I couldn't find answers in Relativity.

Here is a shadow map, from a gazebo lit only by a "sun" object:
blender-pixel-shadow.jpg (44.03 KiB) Viewed 3383 times

Question 1: how the heck do you apply antialiasing to those damn shadows ?
Question 2: how do you make soft shadows, instead of sharp ones ? Generally, shadows are sharp near the casting object, and soft far from it. I think this is related to settings in the sun objects.

And an AO map from the same object, with nearby object hidden after baking (I didn't bother with a lot of render passes).
blender-pixel-seams-ao.jpg (55.35 KiB) Viewed 3383 times

Question 3: is there a way to apply antialiasing to AO maps too ?
Question 4: why are there seams in my map ? My texture should be big enough, I think it's related to the unwrap method (I'm using "Lightmap UV pack").

Thank you for any help you can provide.

Re: AO/Lightmap baking

PostPosted: Mon Apr 15, 2013 5:22 am
by dendwaler
Hi Sirius,
you are not alone!
I do not succeed to make good lightmaps either.
I still get those aliasing issues you also encounter.

Ao maps is less difficult.
I do seldom use the lightmap UV pack for the same reason you described.

But there is another way which is not to difficult.
First i have to assume you are able to unwrap yourobjects without overlapping faces in the 2D Uv area.

Before you start unwrapping always start with a ctrl " a" command.
Because of the scaling to 1 all will now unwrap to the correct proportions.
When the unwrapping of the texture layer is done make a second uv layer while you are in object mode!
this will duplicate your already made unwrapped first uv layer.
(When you make a new uv layer while in edit mode, it will be a resetted layer.)
While the second layer is actived and you are back into edit mode in the 3d window goto the uv/image editor window.

Now do there a select all ( a )
next a average island scale (ctrl a)
and finally pack the islands (ctrl p)
all is now properly packed into 1 uv layer square.

Use this for baking,.
Because transparency is nost necessary for ao assuming you multiply it with the first layer, i save the result as a jpeg.
of 1024*1024 with a quality of 70 %

With an external program i scale it most of the time down to 256*256
Use that as a ao texture.when it to small you still have the big one.
The result is a 17kb picture.

Oh i nearky forgot: Always use the edge split modifier on each object and set you object to smooth rendering before you start to bake!

Re: AO/Lightmap baking

PostPosted: Tue Apr 16, 2013 3:08 am
by Sirius
Thank you DenDwaler, that got rid of the seams.
I think it's because the "lightmap" unwrap method splits every face. When baking, the pixels on the edges of one face won't match pixels on the edges of another... which results in ugly seams.

I managed to get a good result by unwrapping the mesh, then ctrl-a and ctrl-p. Applying an edge split modifier makes the unwrap method more efficient, and the seams only appeared on sharp edges, which is less annoying.
It seems using "Unwrap - smart projections" and setting an island margin works fine as well: this way you don't even need to apply an edge split modifier.

Re: AO/Lightmap baking

PostPosted: Tue Apr 16, 2013 3:27 am
by dendwaler
Glad this was helpfull.
i am still thinking about making a few tutorials on the unwrapping methods.
When i observe others i have the impression that most are to much focused on trying to unwrap an object in one command.

I never do that. I will try t make some very simple examples which will clear up a lot , because it is not difficult once you use the right method.

Re: AO/Lightmap baking

PostPosted: Tue Apr 16, 2013 5:45 am
by Sirius
I usually don't have problems with unwrapping. Unless I have a very complex mesh, I can handle it by making seams, using different unwrapping methods, and if needed edit the UV mapping by hand. But I didn't think Blender needed linked faces in the UV mapping in order to bake correctly a map.

Speaking about tutorials, I learned a lot of UV mapping, lightmap baking, etc reading Andy's tutorials, which are a great resource when you want to improve the visual quality of your Age. But it doesn't mention shortcuts as ctrl-a and ctrl-p.

Well, now I need to figure out how to avoid sharp shadows. Tach managed it in Relativity, so it should be possible. Maybe it will make this aliasing issue less noticeable.

Re: AO/Lightmap baking

PostPosted: Tue Apr 16, 2013 7:25 am
by Calena
Sirius wrote:
Well, now I need to figure out how to avoid sharp shadows. Tach managed it in Relativity, so it should be possible. Maybe it will make this aliasing issue less noticeable.

Have to post fast - Increase the "Shadow Softness" factor. See here: Sun Lamp Settings

Also set the sampling type to "Constant QMC" for better results.

Re: AO/Lightmap baking

PostPosted: Tue Apr 16, 2013 7:32 am
by Sirius
Ahhhh ! I was too slow ! I just figured it out...

It turns out when testing I didn't modify the "sample" and "soft size" parameters at the same time. Or when I did, I didn't put a high enough sample value, which means I couldn't tell the difference.

The best part is, when setting a high enough soft size, the transition between the shadowed and light areas is much smoother, which means there are less aliasing problems.
If I scale the output down, it should look even better.

Anyway, thanks for the link !