PDA

View Full Version : Need Surface Baking Camera Tutorial



Getting Board
01-18-2011, 09:59 AM
Trying to wrap my head around (no pun intended) how to use the Surface Baking Camera. I'm trying to "create" the maps for use but Layout is asking me to specify the UV Map before it's created.

Is there a good, detailed tutorial on the process of utilizing the Surface Baking Camera?

warmiak
01-18-2011, 10:11 AM
You have it backwards :-) ..You need to have your UV maps already precreated -the surface baking camera can render to images/textures but it needs to have a guide where to put specific pixels and UV maps is what it is using.

You can simply create an atlas uv map in modeler.

Riff_Masteroff
01-19-2011, 02:44 AM
Kelly 'Kat' Meyers authored an extensive surface baking tutorial. Email him at [email protected]

Getting Board
01-19-2011, 06:24 AM
Thanks, Riff.

I've emailed Kat to get the info.

In the meantime, have any of you used the surface baking camera? If so, and most importantly, have you seen a dramatic improvement in render times?

djlithium
01-19-2011, 07:49 AM
Kelly 'Kat' Meyers authored an extensive surface baking tutorial. Email him at [email protected]

Hi. Kat here! I got your email Lance. I replied.

Kelly "Kat" Myers :)

Svenart
01-19-2011, 10:17 AM
Surface baking camera in in my opinion very slow, but good working. PBbaker is much faster if you dont need to bake with shadows.

djlithium
01-19-2011, 11:32 AM
Slow?
Really? I don't think so. What's your definition of slow?
you know you can use Fprime with the surface baking camera as well right?

If you have a network you can use those machines for surface baking as well. I have done this before on very large video game levels. I was able to crank out an entire level bake in minutes using that approach. It's the set up that takes time, but with fprime it certainly helps because you can see what your bake is doing to look like pretty much instantly.

Greenlaw
01-19-2011, 11:47 AM
I've been using Surface Baking Camera quite a bit this week to prepare assets for an 'out-of-house' artist (I think he's using Max.) Basically, I needed to 'bake down' some procedural fractal textures over the image textures because the same results would not be available in other programs. Using the tool is easy if you have a prepared UV map and, unless you're going to do more painting on the textures in Photoshop, you can usually get away with a 'quick and dirty' Atlas UV map. If you've never done this, making an Atlas map is simple one-click operation in Modeler.

BTW, how you use the camera depends on what you want to use it for. Do you want to flatten textures like I'm doing for other 3D apps? Are you trying to create an environment map? Are you trying to speed up rendering in Lightwave? It's a fairly versatile tool but set up will be slightly different in each case.

G.

Svenart
01-19-2011, 12:26 PM
@ djlithium: If you dont need to bake shadows, pbbaker is often much faster than suface baking camera ( my opinion)... but otherwise, I never tried it with fprime.... nice tip thanks :)

Greenlaw
01-19-2011, 01:21 PM
Is there a link for PB Baker? I'd like to try it out. Thanks!

G.

Edit 1: Found it: http://www.blytools.com/baker.html

Edit 2: Thanks for the tip Svenart. Based on the description I think PB Baker might have been more useful than the Surface Baking Camera to me this past week. Will check have to check it out later this week.

wyattharris
01-19-2011, 01:28 PM
I've got a surface baking problem. Here's the scenario which may be the problem. I'm creating TF2 assets to contribute to Valve for the game. By default the in game models are ~100x bigger than normal scale. ie. A 6' character imported to LW ends up being 100' tall. (I forget the exact numbers)

First problem I encountered trying to bake out ambient occlusion maps was really weird artifacts or shadows that are just wrong. For that the default map scale of 100um was too small. I bumped it up to 100mm and it rendered out correctly.

The problem now is the maps produced never match the UVs exactly right. There's always a slight amount of black outline at every seam. Could this be a symptom of working so big or something else?

Svenart
01-19-2011, 01:46 PM
The problem now is the maps produced never match the UVs exactly right. There's always a slight amount of black outline at every seam. Could this be a symptom of working so big or something else?

I have not experienced this problem, pbbaker works nice in much cases. Maybe borderpixel option can help?

DiscoBurgess
02-08-2011, 04:30 AM
The problem now is the maps produced never match the UVs exactly right. There's always a slight amount of black outline at every seam. Could this be a symptom of working so big or something else?

I have this exact problem too, always have with surface baker. Increasing the UV border option pulls in the background, which doesn't help when I've got a bright white background for baking in ambient occlusion.

I've never once had a useful result out of surface baker. Grrr.

Skonk
02-08-2011, 04:35 AM
I've used the surface baking camera quite a lot and get pretty good results out of it.

Just make sure you use the UV Border option to prevent seems (it causes LW to over-render beyond the boundy of the UV's so there is a little overlap to prevent visible joins between the edges of the UV's).

I don;t know why the above poster has issues with UV Border because it seems to do exactly what it says on the tin for me.

Skonk
02-08-2011, 04:53 AM
Knocked up a quick example of a simple procedural bake.

As you can see, with Border set to 0 we have a seam, with it set to 1 to get a few pixels worth of over-render, the seam is gone.

DiscoBurgess
02-08-2011, 05:35 AM
Knocked up a quick example of a simple procedural bake.

As you can see, with Border set to 0 we have a seam, with it set to 1 to get a few pixels worth of over-render, the seam is gone.

Thank you, this is exactly what I expect to happen. However, I am seeing the background colour appearing over the edges of my polygons on anything over zero for the UV border. In the attached, I have used a red background colour to illustrate. I've tried all sorts of anti-aliasing options, and in this attempt I turned off all the radiosity to make sure that wasn't the problem. All the lights are off, luminosity on the surface is at 100%.

Obviously, I'm doing something wrong, but I have no idea what. I've tried all sorts of spacing on the UV map, for 0% to 200%, just don't get it.

(Also some white is creeping in, but I can sort that through tweaking the distance setting)

Skonk
02-08-2011, 05:43 AM
Hmm strange; my first thought was overlapping polygons in the UV map but at first glance I dont see anything obviously wrong with the UV image.

Before I think too much about what could be wrong, could you try this for me...

Tripple the polygons on the model, set the Diffuse to 0% and Luminosity to 100%, set all lights to 0 brightness (including ambient) and re-render it.

I have notice that non-planar polygons cause a lot of issues with baking.

EDIT: make sure you save the file with a different name after you tripple it though.

djlithium
02-08-2011, 06:04 AM
@ djlithium: If you dont need to bake shadows, pbbaker is often much faster than suface baking camera ( my opinion)... but otherwise, I never tried it with fprime.... nice tip thanks :)

Drop me an email at [email protected] liberty3d.com and maybe I can feature PBBaker in my tutorial which I am working on. I would like to also cover microwave to be fair, but I can't get a hold of anyone at the company that makes it unfortunately.

djlithium
02-08-2011, 06:11 AM
Thank you, this is exactly what I expect to happen. However, I am seeing the background colour appearing over the edges of my polygons on anything over zero for the UV border. In the attached, I have used a red background colour to illustrate. I've tried all sorts of anti-aliasing options, and in this attempt I turned off all the radiosity to make sure that wasn't the problem. All the lights are off, luminosity on the surface is at 100%.

Obviously, I'm doing something wrong, but I have no idea what. I've tried all sorts of spacing on the UV map, for 0% to 200%, just don't get it.

(Also some white is creeping in, but I can sort that through tweaking the distance setting)

The artifact you are seeing is a result of the camera height and potentially non-planar polys. The surface baking camera only seems to be able to "trace" and render from one side of a polygon, but if there is a poly in the way, it will punch through to show nothing on the other side. Thus you start seeing red (and probably in reality as well as its frustrating.

If you can get away with it, try scaling both of your objects "up" and leave your camera height the same and if you have fprime, check it to see if the problem goes away in real-time.
I generally lock the scale of both my source and target objects to a null for this reason and scale them instead of mucking too much with the camera height. Scaling the objects up will obviously create less of a change of a polygon being "gapless" with respect to another polygon that maybe be in the way of the camera ray.

Baking at multiple heights also works but this gets more complex later.

DiscoBurgess
02-08-2011, 07:34 AM
Thanks for the suggestions, guys. Unfortunately, no dice :(

@Skonk, I did as you asked, and the problem remained, which surprised me, because I thought tripling would do the trick, and was wishing I had thought of it in the first place!

@kat What you said makes total sense, unfortunately, LW disagrees. I scaled the model up 100x, and the effect was slightly worse. On a whim I tried 1000x, some polygons even started to be tinted red. Just to note, when you refer to "both" my objects, I'm just doing basic surface baking, not normal mapping, so I've just got the one object. I think your advice still applies, but thought I'd better mention it.

I've got my source object, UV'd up with a texture map, then I'm trying to render out that surface with background radiosity to get ambient occlusion on it. And that's the stage that this problem is happening. However, the example I supplied is with radiosity turned off, just to ensure that wasn't the problem. Basically, the background is showing through in any circumstances involving UV border >0.

Clearly, something is indeed causing the camera to see through the model, but I don't see what. Argh.

Thanks again for your suggestions, guys.

Skonk
02-08-2011, 08:08 AM
I know this may sound obvious but could you also double check that you dont have any over lapping polygons/points in your object:

In modeler do a merge points (m)
Then do shift + i to remove duplicated polygons
Then check the polygon statistics panel (w) and check that you have no 1 or 2 point polygons (if you do, select and delete them).

Again, this could be nothing to do with it but these types of things can also cause strange baking behaviour.

If you can upload your object/scene btw that would be useful so we could take a look at it.

DiscoBurgess
02-08-2011, 08:16 AM
I know this may sound obvious but could you also double check that you dont have any over lapping polygons/points in your object:

In modeler do a merge points (m)
Then do shift + i to remove duplicated polygons
Then check the polygon statistics panel (w) and check that you have no 1 or 2 point polygons (if you do, select and delete them).

Again, this could be nothing to do with it but these types of things can also cause strange baking behaviour.

If you can upload your object/scene btw that would be useful so we could take a look at it.

I had the same idea, it does sort of look like duplicate polys, but no, there aren't any.

I changed the background to red to clearly illustrate the issue. It was white, for the background radiosity, so I changed it to red just to be sure it was indeed coming from the background.

Scene files are attached. This is the part where you discover I am doing something unbearably stupid to cause this problem!