PDA

View Full Version : Baking occlusion.. how?



gareee
07-22-2006, 01:42 PM
Ok, I've gotten to the pont where I want to bak occlusion on a uv map, so I can take that into photoshop, and use it as a base.

From what I've read, you clear all surfaces, add the occlusion node, and plug that into the luminosity, right?

Then you just use the baking camera?

I'm getting some odd large artifacts when I do that though.

Also, do you need to setup a light set for this to work properly?

If there a "standard" light set anyone's used that always seems to work well?

I've been seeing Max users do this, and want to run with the big dogs.. LOL!

jameswillmott
07-22-2006, 09:55 PM
In the Node Editor, just plug Occlusion into the Diffuse Shading input. That way you completely ignore the effects of all lights in the scene including Ambient, Radiosity and Caustics. No light setup required.

Make sure your Baking Camera has a large enough resolution to work with, and give it a border of a few pixels to avoid those nasty seams...

Karmacop
07-22-2006, 10:27 PM
In the Node Editor, just plug Occlusion into the Diffuse Shading input. That way you completely ignore the effects of all lights in the scene including Ambient, Radiosity and Caustics. No light setup required.
I think shadows are still included because they aren't anything to do with shading, so you will have to turn off shadow maps and raytraced shadows.

jameswillmott
07-22-2006, 10:44 PM
No, the Occlusion shader doesn't calculate shadows from lights, it's purely the accessibility of the spot.

Karmacop
07-23-2006, 02:28 AM
So shadows are actually part of the shader? I thought shadows would be separate and not part of the diffuse shading. I guess it makes sense though :)

gareee
07-23-2006, 06:25 AM
Cool. I'll try that and see if it's more what I'm looking for. I'll report results.

gareee
07-23-2006, 06:34 AM
Ok, it seemed to work "as advertised", but I'm getting some very bad rendering abnormalities. Maybe someone knows what's causing this?

jameswillmott
07-23-2006, 06:46 AM
You'll have to post your scene/mesh for us to see what's going on...

gareee
07-23-2006, 10:44 AM
The mesh is very basic. I'm going to try subdividing the pillow and mat and see if that helps at all.

gareee
07-23-2006, 11:17 AM
Ok, I tried another test.

Here's exactly what I did:

Load the default layout

load the object
select and set the baking camera for the uv template bake
add the occlusion node, and then copy and paste that to all surfaces
bake.

and this is what I get!

I'm wondering if there's a basic setting I'm missing somewhere?

DonS
07-23-2006, 11:45 AM
Wow, I have no idea what's causing that. When making a base texture, I've always used Surface Baker (haven't tried the baking camera) and unchecked the "Bake Illumination" box. Doing that will give you a bake without any lighting effects added...basically, imagine turning off all scene lights and setting ambient intensity to 100%. I've baked out a bunch of base textures this way and it always works for me.

Also, when I've used occlusion, it's always been in the Diffusion channel.

Hope this helps!

D.

gareee
07-23-2006, 12:42 PM
I found out the problem.. you need to plug it into diffuse shading, NOT the diffuse channel!


Many thanks to DUKE for the solve!

gareee
07-23-2006, 12:50 PM
I spoke too soon.. that didn;t help the porblme, but I DO think the occlision baking looks better.

Sub ds wer not used at all, and the object was exported in wavefront format, and then imported into layout.

gareee
07-23-2006, 01:41 PM
I just tried another bake, and had the same issue.

I created a sphere, smooth shifted a part of it, and uv mapped it.

Took that into modeler, switched to the baking camera, added the occlusion node plugged into diffuse shading, and got the same weird issues.

Is the baking camera broken, or is there a baking issue with occlusion?

kfinla
07-23-2006, 04:11 PM
was the sphere also exported as .obj and imported into Layout.. im just wondering if its your mesh.. im assuming u have, but have u tried baking with a native .lwo model?

gareee
07-23-2006, 05:52 PM
Yep. It seems that I cannot bake an exported obj file, but I can bake a sud d saved lwo file of the same object.

Is there some wavefront export bug that effects baking?

Or something in a lwo sub d file that lw9 needs for baking?

Also, when I bake a sub-d file, I still get lighting effects baked, but baking just occlusion plugged into the duffuse shader mode shouldn;t do that, should it?

jameswillmott
07-23-2006, 06:22 PM
No, the Occlusion shader doesn't consider lighting so shadows shouldn't be baked.

gareee
07-23-2006, 07:17 PM
But they are, if I'm useing the right one. I use the occlusion node plugged into the diffusion shader, right?

jameswillmott
07-23-2006, 07:36 PM
Just like this.

Diffuse Shading works like this. LW traces a ray to a spot. It queries the spot and says "Got anything plugged into Diffuse Shading?" If no, it uses it's built in shader to calculate shadows, colour etc. and returns that.

If yes, all shading is overidden, and LW uses the colour returned through the Diffuse Shader part of the nodegraph. If the nodegraph calculates shadows, then shadows show up on the surface.

For example, if you feed a Scalar node, value 1 into diffuse shading, your surface will become pure white, no shading, no shadows, nothing but white, regardless of how many lights are in the scene or whether shadows are on or off. Why? Because the Scalar node doesn't calculate them. It's the same with the Occlusion shader, it just calculates occlusion of the spot and returns a value between 0 and 1, so your surface becomes a mixture of white ( not occluded ) to black ( fully occluded ) no shadows considered.

If shadows are still showing up, something must not be set up correctly...

So, if Diffuse Shading is empty, use standard shading model, otherwise, traverse the node graph to find out what colour to make the spot.

Hope this helps?

gareee
07-23-2006, 07:56 PM
That's what I used after a reply from Duke, but after baking shadows were still present from the single default light in the scene.

I'd attach a pic, but it appears broken right now.

gareee
07-23-2006, 10:21 PM
Ok, here's a simple test scene.. maybe someone can figure out what's set wrong?

The obj is an exported uv mapped wavefront obj from modeler.

If I turn sub d on it, in modeler, and save it as a lwo format, it'll render without the flaws.

Two issues I'd like to correct: remove the flaws, and bake the occ without the shadows from the light baking on it.

Any ideas what I'm doing wrong?

http://webpages.charter.net/gareee/OCC_bake_scene.zip

Karmacop
07-23-2006, 11:11 PM
Any ideas what I'm doing wrong?

You have a lot of non-planar polygons, and since they aren't flat the ray can sometimes start below part of the polygon. Either start the ray further back (in the camera properties increase the offset from surface) or triple your polygons.

gareee
07-24-2006, 08:07 AM
That solves one issue, but why do you think the shadows are getting baked in there? My understanding is having occlusion pluged into the diffuse shader node should totally ignore area lights completly, but obviously it's not.

jameswillmott
07-24-2006, 08:56 AM
I just tried it using your scene and object, and there were no shadows baked.

As Karma said, you'll have to triple your polygons since raytracing cameras don't like nonplanar polygons at all.

Other than that, it baked perfectly here.

gareee
07-24-2006, 09:11 AM
Can you post a pic? I literally just did it again, with shadows rendered.

Here's what I get:
http://webpages.charter.net/gareee/occ_test.jpg

And you can see the shadows baked on. Inceasing the bake camera distance from 100 um to 100 mm solves the bake abnormality issue, but does not resolve the shadow bake issue.

One down, one to go!

My steps to add the cclusion node are to open the surface panel, select the surface, add the shaders/diffuse/occlusion node, plug that into the diffuse shader hookup, and exit the node editor. is that right?

(I get no bake difference between having occlusion plugged into the diffuse node, or the diffuse shader node)

Pomfried
07-24-2006, 09:31 AM
Might be a silly question, but: Did you enable nodes (is there a tick next to the nodes button)? :D

gareee
07-24-2006, 09:39 AM
THAT WAS IT! I added the node, but didn;t realize that when you add a node that the surface properties panel doesn;t automatically turn it on!

YAY! Thanks MUCH!! ;)

Pomfried
07-24-2006, 09:42 AM
Hehe :D no problem

gareee
07-24-2006, 10:03 AM
Another quickie.. I remember a uv setting somewhere to increase the baked uv mapping on the template to help eliminate seams.. where's that setting at?

Pomfried
07-24-2006, 12:13 PM
Should be the UV Border in the baking camera properties

gareee
07-24-2006, 09:46 PM
Yep, seems to work fine as well. Has anyone found what the setting correlates to? Percent, number of pixels, ect? Seems kind of like a crapshoot right now.

jameswillmott
07-24-2006, 10:02 PM
Pixels, I think.

Karmacop
07-25-2006, 09:24 AM
UV border is measured in pixels.

gareee
07-25-2006, 10:06 AM
Karma cop: so it I'm doing a 2000x2000 map, I'll probably want a setting of like 10 or so, and if I'm doing a 500x500 map, I might want only a setting of 2 or so?

Reason I ask, is the default setting I saw in lw 9 was like .0003 or so, and wouldn't that create the map smaller then it should be? Seems like an od default setting for NT to adopt.

Thanks for this assistance, as well. It's more work now, but will speed work for me down the road. (I'm baking the ship, and 35 separte props for it, front instruments to fire extingushers, and the maps will get me a long way ahead of the game textureing them.)

After seeing some of Stonemason's recent stuff, I want to raise the bar on th equality of my work.

Karmacop
07-25-2006, 10:30 AM
The UV border option says how many pixels past the border do you want to render. So a value of 0.0 (which is my default) will render up to the border but not past it. The only way to make a map smaller than it should be would be to use a negative number, although I haven't tried that.

Generally the UV border size will depend on the size of your texture, but if you're going to be close to the texture then you may only need to go over by a few pixels.

gareee
07-25-2006, 05:40 PM
Cool. Since I'm just playing with it for the first time, it's nice to find someone who's already done some of the legwork.

There is almost nothing at all mentioned in the manuals about it though.. vry surprising.