Mittwoch, 23. Januar 2013

Open glass box (GlassBox tutorial, part 6)

There is a special glass box mesh that needs a special geometry, the d100 one. When the inner depth is smaller or larger than the outer, than the outer front and back faces go over the faces of the inner box, or through the inner box, thus we could close them without any graphic problems.

But if we made the d100 mesh in the way we did the d25 one (section 4.6), than the front faces of the inner and outer box fall together, SL may have a problem to decide what one to display. The same happens for the back side. To avoid those problems, we have to make holes in the outer front and back sides, even if this causes more complex mesh geometry.


6.1. Geometry

We open the mesh we did in blender and look at it again, from the front-right-top corner. 3D View should be again in edit mode, wireframe shading and face selection. Now we select the front outer face and then perform these three steps:

  1. First we press the [E] key (extrude operation). The face is glued to the mouse pointer leaving new connected vertices at the old position. Not necessary but useful to press the [Y] so the face is extruded towards the Y axis only.
  2. After we moved the face far enough, we click with the left mouse button to place the face at reached position.
  3. Final turn: the still selected front face (select it if not) will be the hole, so we simply delete it using t the [DEL] key, than [Face] menu button. 


Now we have four faces to make them the holed front face. We do that simply by merging vertices.
  1. We switch the 3DView editor to the vertex selection mode, than we select the left-top vertex on the outer faces before we select the one on the inner faces.
  2.  Now we pres the [W] key and hit the menu [merge/at Last], this merges both vertices to one and moves it to the position of the last selected vertex.
  3. We repeat the same operations to other three vertices and wrap so the four faces towards the inner box.
 

They do not build a face yet, which we change now. We remember, we need the d100 mesh, so we must move the inner front face to the Y position of 0.5:


 Now the four outer faces build together with the inner front face visually a single front face. We have to repeat this with the back faces: Select the outer back face, extrude it, remove it, wrap the four faces  to the inner back face and move it to position of Y= -0.5:


The geometry is ready now. Please ensure that the seams are set in the displayed way. If not, please switch the editor to edge selection mode, and correct seams – that is important for the next step of the tutorial.

6.2. UV Map

When we switch the 3DView editor to the texture shading (and eventually reassign the test picture to the UVMap) we would notice that the new faces do not display the test picture properly, as we have not explained the mesh yet how to.


The front and back outer faces were changed by the action, so we have to unwrap them again. This is why the seams must be like in the last picture of the previous step.

When the seams are ok, we switch eventually to the face selection and select the four faces. Be aware not to select the inner box but select the every four polygons for the outer front and back faces. You can also select everything via [A] key and deselect than the wrong faces. When done, please unwrap them:


The UVMap editor displays the four faces, two of them holed. But they all take only a small part of the picture while we need them to take the full UVMap area. To correct this we can scale up the UVMap, but for some reason blender did not scale it properly for me, so I suggest now to move each vertex manually to the right place.

At this point, it seems also a good idea to switch the 3DView editor to texture shading, so we can see immediately the changes made in the UVMap editor and can see if somewhere is a problem. As we can see now, the mapping seems to be correct, when also not take the whole area:


First part: All five lowest vertices must have the Y position of 0 and the five upper vertices have the Y position of 256, their X values are from left to right 0, 64, 128, 192, 256:


Now we start with the two holes and thus the inner vertices in the front and back face. We need some math here. The package is q60c20, i.e. the glass layer is 20% thick.  Each face takes 256 pixels on the UVMap vertically and 64 pixels horizontally. 20% of them would be 51.2 vertically and 12.8 horizontally, we round the numbers to 51 and 13 respectively.

Now the four lower vertices will have the Y value of 51, ant the four upper vertices the Y value of 205 (256-51 = 205.) Horizontally they must have a distance of 13 pixels from the nearest face border, i.e. from left to right: 77, 115, 205, 243 (64+13, 128-13, 192+13, 256-13 respectively.)


As we can see, the inner front face doesn’t show the whole UVMap texture – due merging points the UVmapping of the inner faces changed. We have to correct that now. To see the inner faces, we must hide the outers.

Info: The key [H] hides selected faces, edges and vertices. The keys [Alt+H] reveal all hidden elements. Hidden elements remain selected, but blender doesn’t change them when we work on other elements in the 3DView editor.

First, we select everything (press [A] until all goes orange) and then deselect all UVMap – again [A] key in UVMap editor until nothing is orange. This ensures that when we hide the outer faces, their UVMap is deselected and is not affected while working on inner faces:


Now, we select the outer top, right, bottom and left faces, and then press the [H] key. We could hide also the front and back outer faces but that is not necessary. Now we have a good view and access to the inner faces; as we can see their UV mapping is damaged:


To correct this, we simply select a wrong mapped face (only that one), unwrap it and then maximize and rotate the UVMap when needs.  The 3DView editor shows f we do it good or not. After we checked every inner face we can reveal the hidden outers by pressing [Alt+H] keys. Now we can see if their UVMap is still correct:


The UVMap is now ready. When we later create a d100 mesh for another package, say q80c10 or q90c05, than we cannot simply copy the mesh and rescale the inner box, because the UVMap will scale badly. But we also must not repeat this step from beginning. All we have to do than is just rearranging the inner vertices of the front and back faces.

6.3. Face order

When we switch the 3DView to the solid shading, we can see our operation broke the material assignment:


We have to correct this now. We switch the 3DView back to the wireframe shading, than deselect everything by [A] key. Now we select material by material and check via Select and Deselect buttons, they are assigned properly. The only problem make the last two materials, meant for the outer faces. To correct this we simply reassign them:


That’s all. As we could see, we can rename the mesh as ‘q60c20d100’ and export it to the ‘q60c20d100.dae’ collada file, so we can upload it to SL named distinctly.

6.4. Inworld test

In the main grid or beta grid (better in any case) we can look at the result after uploading. If we simply rezz it, we see it has the holes in the outer front and back faces filed by inner faces:


We can attach a transparent texture to the outer faces and use the texture repeater to attach some textures to the inner box:




That’s all about the glass boxes by now. Thank you for reading this tutorial.

Waving
Jenna

Keine Kommentare:

Kommentar veröffentlichen

Moving out and deadline strategy

Hello everyone! It is pretty a while that I posted something last time, but now there are changes about stores and JFS at all (my company...