Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Maya baking/camera/light

Patrice Fierrens
Registered User
Join date: 28 Nov 2006
Posts: 75
11-08-2007 12:10
I noticed that baking textures including lights always leaves a lot of black spots and just seems hard to control. I'm trying to bake a texture for shoes, so since that is an attachment it's moving around with the foot I would need to have the texture more or less evenly across the whole shoe, while still having some highlights and basically everything that my shader uses to create realism. The somewhat strange thing is that the baked texture varies a lot from different camera positions. It makes sense in a way but on the other hand I can't really seem to control this. Even if I have lights all around the shoe that would suggest the shoe is lit from all sides, if the camera is focusing on the left side of the shoe, the right side will be darker or totally black.

Has anyone got a good way of baking textures in such a manner that the texture will be lit all around? Dreamy would be to have highlights like my shader is set up, but without all the black spots that seem to result from the camera position rather than the lights in the scene.
DanielFox Abernathy
Registered User
Join date: 20 Oct 2006
Posts: 212
11-08-2007 12:45
This is what "ambient occlusion" does, it calculates lighting based on a hemispherical, even light source (consider it light from an overcast sky).

If you bake ambient occlusion your object will look realistically shadowed from any vantage point - its not perfect as its static, but its the best you can do for SL. You can either try to bake your specular highlights in without the diffuse lighting component to try to avoid shadows on the opposite side, or just fake the specular highlights with your texture map.
Chosen Few
Alpha Channel Slave
Join date: 16 Jan 2004
Posts: 7,496
11-08-2007 13:55
As Daniel said, ambient occlusion is your friend. I'd also suggest you learn about final gather. While ambient occlusion is easier to use, and can be more predictable, final gather can be more realistic. You can read more about both in the Maya help file. Either one will get you out of the situation you're in now.

Also, you might also want to consider using object based lighting either instead of, or in addition to, actual lights. By cranking up the luminosity setting to any number higher than 1 on any object, you cause that object to emit light. Often object based light appears more realistic in renderings than actual light, and it can be more intuitive to control. Most light we're used to seeing in RL can be thought of as being object based, after all, as it comes from light bulbs and other similar sources.

Finally, if you can afford it, I'd highly recommend using the Turtle renderer instead of Mental Ray, and especially instead of the Maya software renderer. Not only does it produce much higher quality results much faster, but Turtle also has a wonderful feature called the skylight, which for baking with final gather, almost completely eliminates the need to light your scene by hand. You can use scene lights if you want to, of course, but you'll find that in most cases you really don't have to. Turtle is the only renderer on the market specifically designed for baking for real time environments like SL.
_____________________
.

Land now available for rent in Indigo. Low rates. Quiet, low-lag mainland sim with good neighbors. IM me in-world if you're interested.
DanielFox Abernathy
Registered User
Join date: 20 Oct 2006
Posts: 212
11-08-2007 14:13
Found a good overview of occlusion methods:

Covers both AO and 'Final Gather' that Chosen mentioned.
http://www.lamrug.org/resources/doc/occlusion_tutorial.pdf

Turtle looks very cool. Its also $1,499. Do you think they take lindens? :)
Patrice Fierrens
Registered User
Join date: 28 Nov 2006
Posts: 75
11-08-2007 15:31
Oh but how would I end up with the final texture that would include my shader material? Isn't ambient occlusion just gonna give me a black and white map and I'd need to combine that with the normally baked texture in photoshop or such? If so wouldn't I not still have the same problem that I can't bake out the normal shader material without tons of black spots? I have a layered shader that needs to be baked out.

I'm already very enlighted but please enlighten me further :D
Patrice Fierrens
Registered User
Join date: 28 Nov 2006
Posts: 75
11-11-2007 08:37
So I've been testdriving Turtle for the past days, and you're right it's amazing. It does exactly what I want. How sad it will expire some day.

Here's 2 issues that I couldn't solve myself yet: I can't seem to get Turtle to render bump maps at all, neither in the normal render nor baked. And similarly I never got any reflections baked in. They, on the other hand, render just fine in the unbaked render. I figured that relfections would need some kind of camera angle to be visible (they are just simulated through a shader, not actual environment), but neither "Bake View Dependant" nor "Orthogonal Relfections" gave any results.

And finally there's a quirk that doesn't save the baked textures even though I set the folder and all. I have to render them to the render view and then save manually from there.

Do you have any answers here Chosen?
Chosen Few
Alpha Channel Slave
Join date: 16 Jan 2004
Posts: 7,496
11-11-2007 09:48
From: Patrice Fierrens
Do you have any answers here Chosen?

As a matter of fact I do. :)


From: Patrice Fierrens
can't seem to get Turtle to render bump maps at all, neither in the normal render nor baked.


Under the Final Gather options, there's a checkbox for Ignore Bump Maps. Make sure that box is unchecked. I think they may have moved a few things around in the very latest version (I'm half a version behind right now, I think), so if that checkbox isn't there, look around for it. It's in there somewhere.

From: Patrice Fierrens
And similarly I never got any reflections baked in. They, on the other hand, render just fine in the unbaked render. I figured that relfections would need some kind of camera angle to be visible (they are just simulated through a shader, not actual environment), but neither "Bake View Dependant" nor "Orthogonal Relfections" gave any results.

First, make sure you have ray tracing and orthoganal reflections turned on (sounds like you already do). Next, on the Texture Bake tab, make sure you have Full Shading checked if you want to bake everything (including reflections, among other things). Otherwise, uncheck Full Shading, and then manually turn on and off whatever options you do and don't want to include in the bake. You'll see the refelctions checkbox toward the bottom of the list (again, assuming they haven't moved things around too much in the latest version). If you're doing all this already, then I'm not sure what might be going wrong.

Oh, and just so you know, you'll generally do better with Bake View Dependant turned off.

From: Patrice Fierrens
And finally there's a quirk that doesn't save the baked textures even though I set the folder and all. I have to render them to the render view and then save manually from there.

Three things here. You might be doing some of this already, but unless you do it all, it's not gonna work.

First, you need to tell Turtle which surfaces you want baked. Until you do that, it has no way of knowing what you want it to do, so it does nothing.

To tell Turtle which surface to bake, you use a tool called the Bake Layer Editor. You'll find it in the Rendering section of Maya, under Lighting/Shading -> Bake Layer Editor (TURTLE). In the Maya viewer pane, select all surfaces you want to bake, and then in the Bake Layer Editor window, hit Add Selected. You'll see the names of your selected objects appear under Layer Members in the Bake Layer Editor. This indicates that Turtle now knows which surfaces you want baked.

As you can probably see by now, the Bake Layer Editor is really handy. It allows you total freedom over which surfaces to bake, and which ones to leave alone.

Second, be aware that Turtle sets up its own folder system inside your project directory. On the Texture Bake tab in the Render Settings window, expand the section called Output File. By default, under Directory, it will say "turtle/bakedTextures/". This is where your baked texture files are being saved currently. So if you want to know why they're not appearing in your sourceImages folder like Mental Ray bakes would, that's why. Look in your project directory with My Computer, you should see that the Turtle subdirectory is inside it, and that the bakedTextures subdirectory is inside that. Any bakes you've done so far should be there. If you want to change the output directory to something else, go right ahead.

Third, if you're batch rendering from NURBS surfaces, there's a very non-obvious change you have to make to the Output File settings. In the File Name field, it will by defualt say "baked_$p_$s.$e". Change the "$s" to "$t". Otherwise, when the batch runs, each new texture will overwrite the last instead of saving side by side. Don't ask me why. I don't know what those s's and t's actually mean; I just know t is the one to use.
_____________________
.

Land now available for rent in Indigo. Low rates. Quiet, low-lag mainland sim with good neighbors. IM me in-world if you're interested.
Patrice Fierrens
Registered User
Join date: 28 Nov 2006
Posts: 75
11-11-2007 10:52
Ah yup the $t thing works, great thanks :)

The other things I have tried already though. And yes I'm baking view independant, that's exactly what I needed. Using skylight and then setting up some lights in the scene to create some highlights on the model exacty where I need them. It's wonderful!

Just the bump map and relfection thing now that doesnt work. "Ignore Bump maps" is unchecked but didn't change anything. Confusing is the fact that it doesn't even render into the unbaked render when both maya and mental ray do it just fine. I attached a pic, you can see the bottom of the sole looks totally flat like plastic but I actually got a bump on that. Either way the result is certainly satisfying so far :)