Jump to content

Map single texture around a prim


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

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

Recommended Posts

I want to make a simple six-sided prim box and use a single texture image mapped in SL so that each face appears to be different (not six identical faces) but just using one PNG "net" texture rather than six separate ones.

Preamble / Conditions

  • I don't really want to go down the Blender -> Mesh route + making a UV map because a simple prim is only 1LI and so there is no optimisation benefit of replacing it with mesh (plus I don't know how to do UV Mapping in Blender)
  • I know how to use the Build tools in SL and the texturing panel - and I know how to apply a different texture to each face. And I can see there are mapping options (default or planar) with scaling, offsets and rotation etc, which can of course be applied globally or per-face.
  • And I know how to make a texture in Photoshop, measure out areas accurately and so on (been using Photoshop since about 1992)

Question

Is there a simple or "standard" way to arrange my box texture image in Photoshop (e.g. a 512x512 square) and then map this in SL so that the different faces of my box show the correct part of the texture, each offset and rotated as required?

Presumably I could get there eventually with painstaking adjusting by eye of offset and rotation for each face but I wondered if there was a tried and tested way, or a template that people often use or similar (that comes with, say, a text file of how to offset each face)

Also – I don't fully understand the offset units or whether to use Planar or Default mapping


p.s.

If the answer is "use Blender" then yes I’ve already lost WEEKS battling against its insane learning curve, and following YouTube videos that no longer help because they keep changing it. I just want to put a texture on a prim.

Edited by lostware
Link to comment
Share on other sites

others might come along and show how they do it maybe in a more efficient way, but I show how I do this with a box prim

make the texture in the paint program with an aspect ratio of 1:2.  I typically go with the upload sizes Like: 32x64, 64x128, 128x256, etc

the texture looks like this:

1811652583_0to5.png.943f2f02035f084ff5499ccbad017ec0.png

 

2 columns and 4 rows. Where we only use the the top 3 rows. 6 cells numbered for each face. The reason is so that the same number of pixels is displayed on each face on both the X and Y

then drop this script into the prim Contents and run it, which will set up the repeats and offsets

default
{
    state_entry()
    {
       llSetPrimitiveParams(
       [ // PRIM_TEXTURE, integer face, string texture, vector repeats, vector offsets, float rotation_in_radians
            PRIM_TEXTURE, 0, "", <0.5, 0.25, 0.0>, <0.75, 0.375, 0.0>, 0.0,
            PRIM_TEXTURE, 1, "", <0.5, 0.25, 0.0>, <0.25, 0.375, 0.0>, 0.0,  
            PRIM_TEXTURE, 2, "", <0.5, 0.25, 0.0>, <0.75, 0.125, 0.0>, 0.0,  
            PRIM_TEXTURE, 3, "", <0.5, 0.25, 0.0>, <0.25, 0.125, 0.0>, 0.0,  
            PRIM_TEXTURE, 4, "", <0.5, 0.25, 0.0>, <0.75, 0.875, 0.0>, 0.0,  
            PRIM_TEXTURE, 5, "", <0.5, 0.25, 0.0>, <0.25, 0.875, 0.0>, 0.0    
       ]);   
    }
}

It is ok for the script texture name to be ''" for this purpose. It will change the faces of the prim to gray, but will set up the repeats and offsets parameters, which are a property of the prim. Parameters which once set by the script will stick to the prim

once we have run the script to do this then we can delete the script from Contents as it is no longer needed.  Then drop our texture on the prim with the Edit tool and done

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1476 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...