Tag Archive for 'texture'

SL Viewer Bug that affects baking [VWR-9013]

4
Sep
2008

If you’ve tried to use Prim Composer to bake a texture across multiple prims, you might have noticed some seams when you import into SL or OpenSim.

Seam Bug
seams on baked prims

At first, I thought this was a bug in Prim Composer, but now it looks more like it is a bug in the SL viewer.

You can verify it yourself with a simple experiment using only the SL viewer.

  1. Upload a texture that is half red and half white (red_white.png).
  2. Create two cubes and place them so that they are exactly side by side.
  3. Apply the red_white texture and rotate the textures so that the white part is in the middle of the two prims.
Red Seam Test
red seam in middle

When I do this, I see a red seam going down the middle of what should be solid white. It looks as though the texture has been very slightly offset from where it should be. As a result, a very small part of the red side is wrapping around to the white side.

VWR-9013

I’m fairly certain that this is a bug in the Official SL Viewer and have reported it in JIRA as [VWR-9013]: “Texture Seam Bug: UV mapping of prims is slightly offset”.

Update - Texture Bleeding

After talking to a couple of people and doing some reading, looks like this is a case of texture bleeding which is a well known problem in 3d graphics and games. I tried in vain to find a good technical reference link on the web that would describe the causes of it. Instead, I found lots of people saying: “My texture’s not right.” And other people replying that you need to compensate by extending the texture a little bit outside the UV map. If anyone has a link to a detailed technical explanation about why it happens, I’d love to see it.

Anyway, I’ll be fixing this in the next release of Prim Composer which will probably be around Sept 19th. I’m on vacation next week.

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.

Prim Composer Beta 4 - UV Maps

8
Aug
2008
UV Maps!
UV Maps!

UV Maps for Regular Prims!

Today, I’ll be releasing Beta 4 of Prim Composer 1.0. Time for an update and a hint of things to come! The future’s so bright, I’ve got to wear shades.

Important!

One quick note before I begin. If you haven’t done it, please turn off True Color dithering in 3ds Max. This is essential if you want to work with sculpted prims. I’ve added a note about this in the Prim Composer Installation Notes.

Bugfixes

1.0 Beta 4 (1B4) has a couple of bugfixes and one major new feature: UV Maps for Regular Prims. First, the bugfixes:

BUGFIX: Sculptie Position

The most important bugfix is a change in the way that sculties are exported. Previous versions assumed that the position of a sculpted prim was its center and exported accordingly. In some cases, this caused sculpts to be imported at an incorrect position in SL. 1B4 fixes this by exporting the true center of the prim rather than its position.

Circle around Pivot
Circle around Pivot

Move the Pivot

One pleasant side-effect of the previous bugfix is that it is now possible to move the pivot point of both sculpts and regular prims without affecting the export. One useful application of this is to copy a prim while rotating it to create a perfect circle of prims.

For example, create a sculpt or regular prim. Move its pivot point away from the object. Now, rotate the object 45 degrees and hold down the shift key when you finish the rotation. A dialog will pop up. Set the number of copies to 7 and it will create 7 copies of the prim so that the 8 prims form a circle. Don’t forget to turn on angle snap to make it easy to get a precise 45 degree rotation!

Pivot and Sculptie Center

One important note: in this thread, I talked about using the pivot to change the center of a sculpt. I haven’t done that yet, so if you’re waiting for that, this isn’t it. I want to do something like that and I will soon.

In case you’re wondering what I’m talking about, the idea is to have a way to create something like a sculptie door. A door needs to rotate on its edge, so it makes things easier to script if the center of the sculpt is on its edge. Anyway, it’s coming…

BUGFIX: Prism and Hollow

1b4 also fixes a couple of problems in the shape and sizing of Prisms and hollows. Prisms in previous versions did not match the shape in SL and some of the hollow sizes were incorrect. Both of these have been fixed.

BUGFIX: Export All Ignores Hidden Prims

Export -> All now ignores hidden prims. Previously, it would export them to SL.

New Features

Smoothing Groups and Seams
Smoothing Groups and Seams

All of the new features in 1b4 relate in some way to the texturing of regular prims. Here are the major ones:

  • Mesh seams in regular prims removed. This eliminates lines in the mesh when it hasn’t been cut or hollowed.
  • Smoothing groups implemented for mesh faces. In previous versions, some faces in the mesh appeared to pop out unnaturally. Their shading didn’t match the faces around them and some of the corners looked shadowy. Fixed with smoothing groups. Take a look at the “before” and “after” pictures on the right.
  • Material IDs implemented for mesh faces. In SL, we can apply different textures to different parts of a prim: top, bottom, sides, etc. In Prim Composer, this is now implemented using MaterialIDs. More on this later.
  • UV Maps for regular prims. Previously, only sculpts had UV maps. Now, all prims in Prim Composer have UV Maps. You can apply materials to prims and they render flawlessly. You can’t export materials yet, but that’s coming in Beta 5.

UV Maps and Materials

The exciting new feature in 1b4 is the ability to apply materials to regular prims and render them. This is a major step toward true offline building. As mentioned previously, 1b4 cannot export materials, so you won’t be able to see textures in SL, but that is coming in the next release.

SL: Select Texture
SL: Select Texture

If you haven’t worked with materials in 3ds Max, then you will need to do some homework. I recommend 3dBuzz, 3D-Palace, and CG Academy for video tutorials. Also, I will be producing some videos of my own in the near future.

As described here in the LSL Wiki, each prim in SL can have up to 9 faces, each of which can be textured. These faces represent major parts of the prim such as the top, bottom, hollow, and end cuts. In SL, you can select individual faces using “Select Texture” in the edit dialog. In Prim Composer, this is done using Material IDs and the Multi Sub-Object Material.

Multi Sub-Object Material

1b4 defines a standard set of material IDs that are used for all regular prims. These material IDs range from 1 to 14.

Below is a picture of a Multi Sub-Object Material that has been applied to a sphere prim. Notice that only a subset of the 14 material IDs are actually used. For the sphere I have used IDs 8, 10, 11, 12, 13, and 14, representing the outside, path cut begin, path cut end, profile cut begin, profile cut end, and hollow, respectively.

The complete list of material IDs:

Multi Sub-Object Material
Multi Sub-Object Material
  1. Default
  2. Top
  3. Bottom
  4. X Plus
  5. X Minus
  6. Y Plus
  7. Y Minus
  8. Outside
  9. Inside
  10. Path Cut Begin
  11. Path Cut End
  12. Profile Cut Begin
  13. Profile Cut End
  14. Hollow

These names were derived from the LSL Wiki page on faces. Please look there for additional insight. There is no material ID for dimples. Use the profile cut material IDs, instead. If a prim doesn’t have a particular feature, then the corresponding material ID is unused. For example, spheres don’t have a top and bottom, so material IDs 2 and 3 are unused for spheres.

You can enter the names “Top”, “Bottom”, etc. into the Multi Sub-Object material to help you remember which is which. You can also change the color of each of the sub-materials, so that it is obvious on the prim. This is what I did in the sphere example above.

Obviously, you have to know how to use materials and the Multi Sub-Object Material, in particular. I can’t teach you that here, but once you understand materials, this should allow you to put just about any material that you want on a prim: procedural materials, bump maps, specular maps, transparency maps, reflection, ray tracing, …

Future

I’m energized about what’s to come. The next release will support automatically importing textures into SL and OpenSim. Once that’s done, it’s time to produce some demonstration and tutorial videos. Somewhere in the middle of that the final 1.0 release will occur.

But this is just the beginning. Some of the things that I’m planning (in no particular order):

  • integrating opensource LSL tools into 3dsMax to create mega domes and similar things.
  • inventory integration — Move textures and objects from your inventory to 3ds Max and back.
  • Automated packaging — Extend maxport to package the things that it imports. On a large scale, this would be something like a sim in a box.

And that’s just the beginning, too! I’m also looking forward to hearing your ideas. The future awaits! Let’s go!






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