Jump to content

Creatively harnessing UVs and Materials - an experiment


Maeve Balfour
 Share

You are about to reply to a thread that has been inactive for 4542 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I just thought I'd share something I have been playing around with as a concept, especially since a friend has asked me to explain how I did it as a tutorial.

I have been exploring the potential of materials inworld, especially since they have the same customisation abilities as prim faces - but without the limits of prims themselves. Materials can be spread out all over a mesh surface, and don't necessarily need to be lumped together - a material surface can be spread out across a mesh on completely separate triangles, scattered to the winds if necessary, within the mesh dimensions. Considering that you can have up to eight separate materials within a single mesh object, this offers some seriously powerful ways to be creative.

In this post, I will explain my method of creating a large floor space on a flat surface, but avoiding the often awful problem of texture repetition - the obvious repeating, and the blurriness of the textures when viewed up close. Being fussy by nature, this issue has always annoyed me... but now mesh and materials has given me a way to work around that.

:matte-motes-smitten:

I have developed a general rule of thumb for my own texturing inworld... For surfaces viewed up close to the AV, I tend to prefer a ratio of about 100 pixels per metre (or a 512x512 for a 5m x 5m area). It works nicely, especially for floors and wall surfaces when viewed nearby an AV. (For distant textures like high ceilings and walls not likely to be seen up close, I can generally dispense with this methodology, and just work with textures spread across a larger scale).

As always, it's a matter of balance - texture load times versus visual appeal. I tend to lean towards creative/repetitive use of a limited number of textures, in lieu of dozens of individual textures, making for quicker rezzing in general.

However, for large areas like floor surfaces, which are viewed up close, I have faced the universal SL problem - either an overstretched, blurry and pixelated texture when viewed up close (with no or few repeats)... OR a sharp texture repeated many times across the said area - sometimes the repeats work okay, but often it doesnt - it all depends on the texture in use.

 

So, this is my workaround - harnessing the combined usefulness of UV-maps and materials....

In essence, I use a series of four different mesh tiles, all UV-mapped prior to use, and imported into the main mesh project. In most circumstances (as far as I know), you can import mesh objects which have been UV-mapped beforehand, and they will retain their UVs if their vertices and triangles aren't removed and/or added to. Considering SL meshes can contain up to eight separate material maps, you can import up to eight pre-UVmapped meshes into a single upload file, and providing each of these imported meshes are assigned separate materials, their UVs won't clash with the others.

Okies... on with my workflow for the big floorspace. My goal was to create a floor area of 46m x 54m to fit an interior build I am working on. I wanted to have sharp textures, BUT I didn't want obvious texture repeats. So this is how I went about it:

Floor tutorial 1.png

The two floor texture images are 1024x1024 each. Each resultant texture tile is 512x512 (one quarter of each image). The four mesh tiles are UV-mapped for each quarter of the UV-space, taking in a different tile. Inworld, each of the mesh tiles will be about 4m x 4m, retaining my goal of about 100 pixels per metre for sharpness.

Floor tutorial 2.png

Floor tutorial 3.png

And..... below is the result of the mesh when uploaded inworld, with the two textures applied to the eight material zones. A very slight amount of tweaking was done via repeats/offset in the build menu to get the textures to fit as intended, and to further mix things up, I changed the colours - variations between pure white and a various shades of grey.

Floor tutorial 4.png

Due to the mixing of UV-spaces and materials, the incidence of obvious texture repeats is largely diminished... The repeats are still there, of course, but the dreaded monotonous texture repeating is not so obvious. To break up the floor area a little, I also created a random scattering of solid tiles in a separate mesh (with shadow materials included; visible above)... these used the same textures and UV-mapping principle as the main floor.

Floor tutorial 5.png

And this is the same mesh floor space, viewed up close (with my AV shown for scale). The texture still retains its relative sharpness up close, within my own fussy tolerances, so I am a happy girl! (To the right of the image, you can see a mesh join, hence the hard edge between the textures - but still fully acceptable to my own requirements).

The final mesh floorspace (46m x 54m) came in at 5PE (672 vertices / 336 triangles). The vertice count is probably higher than it should be, due to the overlaps of the imported meshes during construction, but it is within my tolerances in relation to the final PE cost / visual quality. (I have not tested whether welding the duplicate vertices would destroy the pre-made UV-maps or not (time restrictions on my part mostly)). Since this floorspace is intended to be viewed within a confined area, I was able to be savage with the LODs, using a simple 8-triangle mesh (containing 8 materials) for LODs 2,3,4; the LOD switch will not be visible INSIDE the final structure.

 

So yah, this is my experimental workflow with mesh, UVs and materials to reduce the incidence of obvious texture repeats across large areas. The result is encouraging so far, and will help greatly with my future projects. I am hoping that by sharing this technique, it will help fellow mesh creators unlock ways to harness the power of creative texturing. Materials can be your best friend, especially when used in conjunction with UV-mapping. Just think outside of the square, so to speak. Have fun!

:matte-motes-smile:

  • Like 9
Link to comment
Share on other sites


Maeve Balfour wrote:

 

The final mesh floorspace (46m x 54m) came in at 5PE (672 vertices / 336 triangles).
The vertice count is probably higher than it should be, due to the overlaps of the imported meshes during construction, but it is within my tolerances in relation to the final PE cost / visual quality. (I have not tested whether welding the duplicate vertices would destroy the pre-made UV-maps or not (time restrictions on my part mostly)).

 

First of all nice tut, i'm sure many people will find this useful. Welding the vertices shouldn't destroy your UV maps, but it would be pointless since the uploader will pull them apart again. Every UV island has its own vertices on the edges so the only way to save on them would be making a square of 4 duplicate quads (or more) as far as I can think of, that would seriously destroy your initial goal of getting rid of the tiling effect. And that would save you a whopping 4 verts (like the ones in the far corners of your mesh.) Also the verts don't count for display cost I think and I bet that's the one that's determining your landimpact.

oh..edit:) not four (which would save six verts), but two duplicates to save on two verts, but that doesn't change what I said...

  • Like 1
Link to comment
Share on other sites

Excellent tip. :matte-motes-smile:

This is one of the great advantages of being able to control the UV mapping. In Blender (2.49), you can do this very easily by making the first tile, UV mapping it, and then duplicating it with two applications of the array modifier (it should have no edge faces!). That will leave them all with separate maps in the same orientation. Then in the UV editor, move them* into four piles at random and apply the four different rotations (-90, 0, 90, 180) to each pile. Then apply clip to map and move them all back into a corner so that they overlap exactly. (To ensure precision, you can do "S0" on each vertex stack and "G,drag" to move them right to the corners.)

You can apply "remove doubles" to the array to reduce the vertex count in Blender and applying set smooth. The changed rotations will not be destroyed by this. At first thought, you might expect this to reduce the LI substantially by reducing the vertex count, as all the normals are the same, but most joins will now involve vertices with different UV coordinates, which has the same vertex-replicating effect, in the uploader, as sharp edges. So only a small LI reduction will result.

*some may be stuck together, in which case select them by face (getting the top) and use Select->Unlink to separate them.

This is all for Blender 2.49. Later Blenders should be similar.

 

  • Like 2
Link to comment
Share on other sites

"Also the verts don't count for display cost"

You would expect that from the wiki description, but I think the display weight uses the same estimated triangle count as the download cost.

From reading the source code, you would indeed think that doesn't count vertices, as it uses an estimated triangle count, not vertex count, in the calculation. However, the triangle count is estimated from the size of the data for each mesh, and that does depend on the vertex count. In fact each vertex is 16 bytes while each triangle is 6. So in reality, the vertex count dominates, including multiplication when normals and/or UV coordinates differ. This is why sharp edges and unwelded UV points cause LI to increase although they do not change the triangle count.

I just rechecked this with a test sphere, sharp and smooth edged. Triangle counts identical at all LODs. Same physics shape. Vertex counts in uploader <6144, 2108, 560, 284> and <1660, 435, 126, 70>;  Download weights 14.1 and 5.4; Display weights 1434 and 709.

Link to comment
Share on other sites

Fot tiles with nice identical grouting, this is all fine. When you try the same thing for landscape textures, you have to make all four edges tileable in all 10 posssible edge combinations of one texture and for all possible meeting of two textures. This means that the edges of the textures must be the same and symetrical under 90 degree rotations (like the tile grouting). It would be interesting to see how well this can be done, perhaps with sets of 4 or more textures, without introducing obvious repetition. Anyone?

Link to comment
Share on other sites

Thanks for the feedback, everyone - I'm glad that my concept is useful! :matte-motes-smile:

Kwakkelde & Drongle: Thanks for the info regarding the vertices. I had considered going back and welding them all, but for all the time it would have taken, it sounds like it would have made next to no difference to the PE... so in other words, it saves me time so I can concentrate on being creative! (that's the excuse I'll use, anyways LOL).

Kwakkelde: Mirroring the UV.. hmm... actually, you can flip the axis of the textures within SL in the build menu, so this probably duplicates the effect you are referring to (if I am reading you correctly there, that is) - Still, its always handy to have multiple methods of achieving something.

Drongle: Hmm.. that's quite a challenge there, regarding landscape texturing. I'll give it a try when time allows for sure.
A rough idea in my head, regarding the texture creation... would be to create a basic, bland base texture, which would be tileable on all edges. This I would use as a base texture in a bottom layer of Photoshop. From there I would create various detail layers to sit above this, and save out combinations of these as separate tiles.
The main trick would be to try and disguise where the seams are - regardless of how perfect the joins are, a visible gridwork where the textures meet would probably be noticeable when they tile out, since organic landscapes dont have straight lines etc. I would probably make the texture overlays with as much variation as possible in regards to how close/far they fall in relation to the tile borders, hopefully making it difficult to easily discern the edges. (In other words, I would specifically AVOID having any kind of uniform margins - lots of randomness instead).
Another combination could be using a random mix of different sized material tiles in the mesh as well, say in variations of the quarter theme (quarter / half / three-quarter / full), and having a mix of textures to suit. Obviously this makes the concept somewhat more complicated, but could be workable to hide the seamwork. Balancing the texture cost as well would have to be considered, in order to keep the download time.

Sounds like a fun project! Plus it would be interesting to see how this works for an undulating surface instead of a flat one - I would assume a bit of texture stretching could become an issue here, if I simply tried reshaping the existing mesh.

......

When I get a chance, I'll type up a post showing how I use this technique in conjunction with a faked ambient occlusion overlay. Most reading this will probably be able to guess what I do by now, but I'll post it anyways for posterity - chances are that it will spur others on to be creative and explore the idea further.

:matte-motes-smile:

Link to comment
Share on other sites


Maeve Balfour wrote:

 

Kwakkelde
: Mirroring the UV.. hmm... actually, you can flip the axis of the textures within SL in the build menu, so this probably duplicates the effect you are referring to (if I am reading you correctly there, that is) - Still, its always handy to have multiple methods of achieving something.


Not quite... If you do it in SL, you will limit yourself to 4 unique textures (times 2) because you can only mirror the entire "SL face". You can rotate and mirror some UV islands within the same map, so every unique texture has 4 (rotation) times 2 (mirror) is 16 different uses. 16x8 gives you 128 different "tiles".

I said mirror half the UV, maybe I wasn't clear..I ment mirror half the islands on every UV map.

  • Like 1
Link to comment
Share on other sites

A great idea Maeve.

One comment about the randomization. if you always choose a rectangular pattern of images and it is possible to choose as many different images are there are divisions along one of the sides, then the optimum randomization can be generated by using a "Latin Square" in which no image is repeated on any row or column of the area.

Hope that that helps.

  • Like 2
Link to comment
Share on other sites

SUDOKU!  Now all we need is a plugin script for all 3D applications so we don't have to move around the squares by hand:)

You don't really need the latin square ofcourse since with 8 different SL faces you can almost fill Meaves entire 13x13 (169) grid with unique squares (128). I think that will give a more randomized look than 13 tiles spread randomly. But all ways lead to Rome (No pun intended..well maybe) On the other hand with the latin square setup you only need two SL faces and don't even use all their rotations and mirrors.

Link to comment
Share on other sites

Gregory: Hmm... more interesting ideas. The Latin square concept would be interesting to see in use, though as Kwakkelde says, for my grid area the randomisation options are sufficient for the required effect. Still, I really like your suggestion tho, and would love to see it used (I could even try it myself sometime, if I can get my head around the permutations involved (maths isn't one of my strong points LOL!) - I can definitely see the potential you refer to tho.

:matte-motes-smile:

Kwakkelde: Yah, I get your point now, about the flipped UVs. I hadn't thought of that originally, but I can definitely see how your concept would work... Mayhaps utilising eight UV-tiles instead of the four, with half of them with flipped UVs. So many ways to get the randomisation to work! Thanks for the tip!

:matte-motes-smile:

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4542 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...