Prim Composer - Baking and Texture Upload



Prim Composer - Baking and Texture Upload

29
Aug
2008

1.0 Beta 5: Baking and Automatic Uploading of Textures for both Prims and Sculpts to Second Life and OpenSim

Today, I’ll be releasing Beta 5 of Prim Composer 1.0 (1B5). The previous release gave us the ability to texture prims and sculpties in 3dsMax. 1B5 takes it to the next level by automatically generating baked textures and uploading them effortlessly to Second Life and OpenSim. The final 1.0 release is around the corner and demonstration/tutorial videos are on the way.

Got OpenSim?

If you haven’t gotten a copy of OpenSim, you’ll want to get working on that. Uploading baked textures gets expensive on the main grid.

Overview

In my previous post, I described Prim Composer’s support for UV mapping and materials. If you missed that, you’ll want to read that first. 1B5 adds automatic texture exporting and baking to 3ds Max as well as automatic importing of textures to Second Life and OpenSim via maxport. Both sculpts and regular prims are supported.

Materials and Light
Materials and Light

Prim Composer 1B5 can generate and upload either baked or unbaked textures. If you apply a material to a prim with a plywood bitmap and upload the texture unbaked, then the texture in SL/OpenSim will look exactly like your plywood bitmap. If you add lights to the 3ds Max scene and upload the baked texture, then the texture in SL/OpenSim will also have lighting and shadows.

Baking increases the number of textures in your build

Be careful with texture baking! It looks cool but comes at a big price. Without baking, Prim Composer can often upload a single texture for a prim. When baking is turned on, it must generate a different texture for each face of the prim. For a box that is cut and hollowed, this means that baking requires 9 different textures to be generated and uploaded. This will hit your pocketbook immediately in the form of upload charges to Second Life and it will increase lag for the people who are viewing your build.

Duplicate textures are possible

Also, you should be aware of the fact that each time Prim Composer uploads a texture, it is a new texture that must be downloaded by the people viewing your build. Just because two textures look the same doesn’t mean that they are. It is possible with Prim Composer to create a build that has a much greater number of textures than it would if you created it directly in the SL viewer, even if you aren’t using baking.

Prim Composer attempts to minimize the number of new textures in a particular scene, but you must be aware of the issue. Consider a table and chairs with a mahogany wood texture. If you create them in a single 3ds Max scene and import the whole scene with unbaked textures, then there’s a good chance that Prim Composer will only upload one texture. But suppose that you import the table first and then later you import the chairs. In this case, one mahogany texture will be uploaded when the table is imported and a different mahogany texture will be uploaded with the chairs. The two mahogany textures look exactly the same, but now people who look at your table set in SL/OpenSim will have to download two textures instead of one. This is a simple example to illustrate the problem, but it can get much worse than this if you aren’t careful, especially with baked textures.

Baked Shadows
Baked Shadows

Inventory Integration will mitigate these problems

Inventory integration is a planned feature for Prim Composer to help combat texture overload. This will allow it to know which textures already exist in your inventory and thus do not need to be uploaded.

Targa (TGA) Image Problems

One final word of caution. The version of libsecondlife that 1B5 uses has a problem uploading TGA images. When a 24-bit TGA image is uploaded, it gets converted into a 32-bit image with an alpha channel. The image looks the same, but is treated differently by the SL viewer because of the alpha channel. When applied to a prim, it will fight with other alpha textures to be on top.

If you’re looking for a lossless texture format, my recommendation is to use the PNG image format instead. It is a widely-supported, lossless format that has some compression and it works well with 1B5.

For sculptmaps, it doesn’t matter. 3ds Max reads TGA fine and 1B5 now uses PNG as its output format for sculptmaps and baked textures, so you’re covered.

Be careful, but have fun

Well, enough of the doom and gloom. It’s important to understand the dangers, but that shouldn’t stop us from having fun, right? The remainder of the post describes the new features of Prim Composer that support texture baking and texture uploading.

Material Rollout

In 1B5, materials get a new rollout when they are assigned to a prim called “Second Life - Texture Parameters”. The rollout allows you to change texture-related values that have no direct representation in 3ds Max: color, fullbright, transparency, glow, shininess, and bumpiness. When these values are changed, they are applied to all faces of a prim. They have no visual representation in 3ds Max, so if you change the glow or shininess, you won’t be able to see how it looks until you import the prim into SL or OpenSim. Also, these parameters are applied after any baking in 3ds Max. If you have transparency in your baked material and you also turn on transparency in the SL - Texture Parameters rollout, then the resulting prim in SL or OpenSim will have double transparency.

Material Rollout
Material Rollout

Since the SL texture parameters in the material apply to all faces of a prim, it is not currently possible to have different faces with different values. For example, you cannot add glow or shininess to a particular part of a prim. If you turn on these parameters, they apply to the prim as a whole. If you really need finer-grained control, please let me know. It is definitely possible, but not yet implemented.

In addition to the texture parameters, there is a button called “Refresh”. If you press this button and the material is a Multi/Sub-Object Material, it will fill in descriptive names next to sub-materials in the material: top, bottom, x+, x-, outside, hollow, etc. These labels are also automatically generated when you assign the material to a prim. Refresh is provided in case you add additional sub-materials after the material has been assigned and you would like the labels to be generated again.

Prim Rollout: Bake Textures

There is also a new rollout on prims called “Bake Textures”. This rollout allows you to set the resolution of bitmaps that will be baked from that prim and to disable baking for specific material IDs. All of the possible material IDs are listed, but unused material IDs are disabled. This gives you a handy place to see which material IDs are being used by a particular prim.

Prim Rollout
Prim Rollout

Why would you want to disable baking for a material ID?

As described in the overview, baking is expensive. Each face of a prim in SL/OpenSim (top, bottom, etc.) corresponds to a material ID in 3ds Max. If a prim has 9 faces in SL, then 9 textures will be baked by Prim Composer. But suppose that only 2 of those faces are visible in your build. Why waste resources by baking all of them when only 2 are visible?

Example: a floor

Imagine that you are using a box as the floor of a house and you want to bake some shadows onto it. Chances are that only the top of the box is visible, but an uncut box has 6 faces in SL. There is no reason to bake all 6 faces, so you can use the box’s “Bake Textures” rollout to disable baking on everything except the top.

Delete or disable sub-materials that are not visible

In fact, you might want to take it farther than this. If you disable baking on a face, Prim Composer will still generate a texture for that face. It just won’t bake the texture. If you want to really improve things, you could disable or delete the unneeded sub-materials in the Multi/Sub-object Material associated with the prim. If you disabled all of the sub-materials except for “top” (material ID 2), then the floor prim would only upload a single texture, the one that is visible.

Export Dialog: Textures and Bake

New Export Dialog
New Export Dialog

Finally, there are two new options under “Bitmaps to Export” in the export dialog: a “textures” checkbox and under it a “bake” checkbox. When both of these are unchecked (the default), Prim Composer behaves as before. No textures are exported from 3ds Max and none will be imported into SL or OpenSim.

If you check “textures”, then Prim Composer will export the diffuse bitmaps for the prim. This is equivalent to the way that texturing works in the SL viewer.

If you also check “bake”, then Prim Composer will bake light, shadows, opacity maps, specular maps, and whatever else your material has. If you are using a procedural texture, then you must bake if you want it to show up in SL.

New errors indicator and button

There is also a new colored box at the bottom of the export summary dialog that turns green if the export was successful and red if there was a problem. If there was a problem, the “Show Errors” button will be enabled. Press it to see what the errors were.

Next Steps

The two big things on the horizon are the 1.0 final release and video tutorials. The complexity of Prim Composer has risen to a level that demands better documentation and video tutorials are probably the most time-efficient method to deliver that. It is also time to come out of Beta. There are a few small things that I want to push into 1.0 such as hooking up the physics, phantom, temp on rez, checkboxes, but additional features will be pushed into 1.1.

1.1 will include basic exporting from SL/OpenSim to 3ds Max and some sculptie improvements. There’s a lot left to do beyond that and I’ll get there as fast as I can. By the end of the year, there will be another major release. I’ll make some more status posts between now and then.

In the meantime, please let me know about any problems or suggestions that you have in the Prim Composer Support Forums.

RSS feed | Trackback URI

1 Comment jump to bottom

 
Comment by Amis
#
2008-08-30 08:38:56

Amazing !!! Thank you very much for this, u saved us alot of time. Again , THANK YOU :)

 
Submit Comment



Bad Behavior has blocked 400 access attempts in the last 7 days.