Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Maya Texture Baking Question

Stacy Hansen
Registered User
Join date: 4 Apr 2006
Posts: 31
02-29-2008 10:53
I have been trying very hard lately trying to accomplish some of the things I have seen with shadows cast directly onto the floors of buildings. Let me explain how I am trying to go about it (and not succeeding) and maybe someone has a better idea for me.

First, I am creating a rough approximation of my in-world building in Maya. I am putting a tile texture on the floor and playing with the lights so that I have the floor shadowed and looking just the way I want it within Maya.

After that I am baking the texture and exporting it as a tga file (the largest it will let me make is 1024 x 1024 anything bigger and Maya crashes on me). My first problem is that I now have a texture that is a wrapping of the cube I used as the floor and the only part of it I can use is the part that represents the top. So, I take it into photoshop and I crop it so it's only the part I can use. The resulting texture is now only about 256 x 256 in size.

Then I upload that texture into SL and put it on a prim. It looks great and just how I wanted on a prim whose surface is 1m x 1m but as you can probably expect now that I want to go put it onto my actual in world floor that is 20m by 20m it gets all stretched out and looks horrible.

Any suggestions anyone can give me would be really appreciate it. I'm not sure of any other way to go about it, or for example if you can texture bake only a single surface rather than a whole object.

Also, while I'm at it I thought I would also ask; I know there is a script that lets you export an entire scene from Maya and rebuild it in SL. Is there one that goes the other way? Is there any kind of tool that helps you take a build from SL and put it in Maya?
Chosen Few
Alpha Channel Slave
Join date: 16 Jan 2004
Posts: 7,496
02-29-2008 11:20
From: Stacy Hansen
First, I am creating a rough approximation of my in-world building in Maya. I am putting a tile texture on the floor and playing with the lights so that I have the floor shadowed and looking just the way I want it within Maya.

You're on the right track. You just need a little adjustment to your technique. Read on.

From: Stacy Hansen
After that I am baking the texture and exporting it as a tga file (the largest it will let me make is 1024 x 1024 anything bigger and Maya crashes on me).

The crashing probably means you need more RAM. Don't worry about it though. The largest texture size SL can use is 1024x1024, anyway. This is because some older video cards will crash when confronted with anything larger. For a while, LL upped the limit to 2048x2048, but after enough crash reports rolled in, they chopped it back down to 1024x1024.

That's fine, though. 1024 is huge, way bigger than you'll ever need for almost all situations. The only reason ever to go that big is if a texture needs to have a lot of small text, or other very tiny details that would become unreadable or undefinable on a smaller canvas. Those circumstances are quite rare.

Anyway, let's talk about your specific problem.

From: Stacy Hansen
My first problem is that I now have a texture that is a wrapping of the cube I used as the floor and the only part of it I can use is the part that represents the top. So, I take it into photoshop and I crop it so it's only the part I can use. The resulting texture is now only about 256 x 256 in size.

Then I upload that texture into SL and put it on a prim. It looks great and just how I wanted on a prim whose surface is 1m x 1m but as you can probably expect now that I want to go put it onto my actual in world floor that is 20m by 20m it gets all stretched out and looks horrible.

Any suggestions anyone can give me would be really appreciate it. I'm not sure of any other way to go about it, or for example if you can texture bake only a single surface rather than a whole object.

There are a number of ways you could do this. The simplest is just to use a plane for your floor instead of a cube. You certainly don't need the hidden faces. Bake the plane's texture to 1024x1024, and then apply that to the top face of your floor prim in SL.

You will likely find, though, that you don't need to keep the texture at 1024 in order for it to look good. Often, a texture that was baked at 1024 will look better after having been shrunk to 512, or even to 256, in Photoshop than it would at its original size. It will certainly look better than if it had been baked at the small size from the start.

The larger the texture is initially, the less impact any per-pixel artifacts will have on its appearance. Then when you shrink the texture, many such artifacts will disappear, since there are no longer enough pixels present to support them. You'll find that this can have great effect on the appearance of the edges of shadows. Where parts may have been blocky in the large version, they'll become much more smoothly graded after shrinking.

With better renderers, this sort of thing becomes less important. But if all you've got is Maya Software and Mental Ray, you'll likely find that your shrunk textures look better than your original large ones.

Also, don't be afraid to spend a good amount of time in Photoshop (or whatever your raster editor of choice happens to be) post-processing your baked images. Particularly on bakes with a lot of shadowing, you'll find that a little Gaussian blur can go a long way (a lot of times, I'll bake the shadows alone, and then layer them over an unshadowed version in PS, so I can blur and blend the shadows as much as I want, without affecting other details). Also the clone stamp and healing brush usually can work wonders for cleaning up things like light-bleed. And that's just for starters. For really high quality texturing, consider the bake just the first step. The spit and polish comes from the 2D post process.

From: Stacy Hansen
Also, while I'm at it I thought I would also ask; I know there is a script that lets you export an entire scene from Maya and rebuild it in SL. Is there one that goes the other way? Is there any kind of tool that helps you take a build from SL and put it in Maya?

The script I think you're talking about is for sculpties, not for ordinary prims. The name is misleading, since it's called .primscript, but it is for sculpties. Adrian Linden has had one in the works for prims for a good long time now, but he's never finished it, unfortunately. And of course, there is no solution at all for arbitrary models. If you want to bring something into SL, you must build it with SL in mind. Not just any old scene will work.

Anyway, the answer to your question is no, there is no way to go in reverse, at least no good way. About the closest thing you can do is hack your video card, if you know how, to capture an OBJ from your current field of view in SL. I'm not going to go into details on how to do it, since the potential for thievery is so high (not you, necessarily, but others reading). Hopefully no one else will either.

What I will say is that the method is not practical for texturing purposes. The way it defines what is an individual object has nothing to do with how SL defines a prim. Things end up connected in very strange ways. By the time you sort through it all to make it work, you'll have spent so much time chopping stuff up and remapping it, it would have been much faster just to have built it from scratch.
_____________________
.

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.
Stacy Hansen
Registered User
Join date: 4 Apr 2006
Posts: 31
02-29-2008 12:15
Thank you so much for your reply, you found my problem exactly! Once I started using a plane instead I was able to do what I had been trying to do.

I haven't done the photoshop part of it that you suggested yet but I plan to.

The only part I'm not sure of (and maybe I will find it if I investigate more) is how to bake only the shadows in order to use them as their own layer.

Edit: I found the answer to the shadow only thing.

Thank you again for the help. :)