PDA

View Full Version : XSI Texturing Question


mediumRare
11-18-2003, 06:13 PM
Hi,
Im a longtime Maya user, learning XSI and trying to figure out something in the texture editor.
Say I have a grid, 10 by 10, and I want to put a tileable texture on it.
Whats the easiest way to put this texture on but have it be mapped onto each face, not on the whole grid.
Basically I want each face to have UV's in the one to one space.
I can get the result I am looking for by clicking on each face and hitting BEST FIT, over and over again until I get all of them.
In maya terms, I want to unitize each face.
There must be an easier way.


Thanks in advance for any help

Zastrozzi
11-18-2003, 07:10 PM
custom script?

tachy0n
11-18-2003, 10:28 PM
AFAIK there isn't any similar tool in XSI. Couldn't you just up the tile value for the texture instead ? If you really must do it by modifying the UVs, then i could whip up a script for you...

mediumRare
11-18-2003, 11:58 PM
Well you could do it by tiling but heres an example of what I wanna do and why tiling is not so good for me.

Say I have a huge mesh that has subdivisions and I want to cover the whole thing with a tileable grass texture.
If I just scale the UVs and turn the Material setting to repeat, I can get the whole mesh covered but the repeating will be very obvious due to patterns in the grass texture.

If I can unitize all the faces, I can grab faces by random and rotate UVs so that I have some randomeness in the direction of the texture, resulting in a less "tiled" overall look.

I have used Maya in a game world building role and this was a pretty common way to make things look less tiled with a minimum set of textures. I find it strange that I cant do this easily in XSI...

Thanks

tachy0n
11-19-2003, 01:01 AM
OK, i see what you mean.. So here you go (VBScript):


dim a

dim a1,a2,a3,a4

Set sel = selection(0)

set msh = sel.parent.parent.parent.parent

a1 = msh & ".sample["
a2 = msh & ".sample["
a3 = msh & ".sample["
a4 = msh & ".sample["


set facs = msh.activeprimitive.geometry.facets

for x = 0 to facs.count-2

a = facs(x).samples.subcomponent.elementarray

a1 = a1 & a(0) & ","
a2 = a2 & a(1) & ","
a3 = a3 & a(2) & ","
a4 = a4 & a(3) & ","

next

a = facs(x).samples.subcomponent.elementarray

a1 = a1 & a(0) & "]"
a2 = a2 & a(1) & "]"
a3 = a3 & a(2) & "]"
a4 = a4 & a(3) & "]"

TranslateUVW a4, sel, 1, 0, 0, siAbsolute, siUVW, True
TranslateUVW a3, sel, 0, 0, 0, siAbsolute, siUVW, True
TranslateUVW a2, sel, 0, 1, 0, siAbsolute, siUVW, True
TranslateUVW a1, sel, 1, 1, 0, siAbsolute, siUVW, True



For performance, it does no error checking whatsoever, so use with caution. Only works on quads and needs a texture projection already applied to work on.

To use create a temp UV map on your mesh (any all quad mesh will work) The Unique UV projection works nicely for this. Then navigate to your mesh in the explorer, select the newly created projection (the one with the grey cylinder icon, not the blue cube one), and run this script.

Any comments or crits most welcome..

mediumRare
11-19-2003, 01:48 AM
Hey tachy0n,
You just made my day! Works like a charm.
It does exactly what I wanted it to do!

Thankyou very very much.

wurp
11-20-2003, 05:36 AM
If I understand the question correctly, Property->Texture projection->Unique UVs should do the job.

tachy0n
11-20-2003, 07:43 AM
AFAIK no it won't. In fact it does exactly opposite of what the unitize tool in Maya does.

What unitize does is take a face of the mesh and uv map it so it fills the entire UV space (ie from 0 to 1 in both directions) Then it repeats this for every other face in the mesh. So essentially the whole mesh is mapped into the same overlapping set of 'squares'

The unique UV tool instead takes the mesh and makes it fit into the UV space as a whole, not for each individual face.

alona
02-27-2005, 10:57 AM
I've leeched onto this old thread since what I'm after is almost, but not quite, solved by previous posts here.

Basically, what I'm trying to achieve is this:

http://alonaxsi.50megs.com/Knot2.png

The object is imported (OBJ), so it's impossible to texture it before modeling. What I'd like to have is a texture projection that treats the polymesh edges as if they are UV isolines, so that the V coordinate will be wrapping around the wire and the U coordinate will be moving along the length of the wire (by "wire" I mean the object itself, think of it as knotted piece of wire).

The image above was created using a workaround: I used tachyon's wonderful script posted in this thread to turn each quad into an individual UV space, and then put an image texture where the image is just black with a thin white rim. This is fine for creating a grid, but it's not what I'm really looking for; I'd like to use more elaborate textures that change along U or V and not just repeat themselves at each quad.

I tried using "Unique UVs", and fiddled around with the parameters of the resulting PolyPackUV operator. I couldn't make it work, and in fact most of what I got didn't make much sense. I tried using a simple torus just to figure out what this projection is doing, but again I admit the results just didn't make sense. The noicon_pic image is sheared and splattered all over the place, quite with disregard to the structure of the polys.

I'm sure this can be done by breaking the object into segments and using the texture editor to adjust cylindrical projections for each segment, but this is way too messy: I need to do this automatically for many objects like this one. I'm just hoping XSI can be coaxed into transforming those polymesh edges into UV lines...

I hope this makes sense, please let me know if it's not clear. And thanks for any ideas.

AA

j3st3r
02-27-2005, 11:16 AM
The texture projection has a Fit Subcomponents to Image button on it`s property page. Press this, then, underneath this button there is Freeze button

Practically it fits the selected points into the image (0-1 UV space) with a transform on the UV projection, then you freeze this transform.

The manual describe this, and check out the property pages also when you`ve got problems.

moreover, I made a custom toolset, especially for long time maya users, including the fitting tools, the move and sew tool, and aligning functions working just like in maya. If my employers allow that I`ll publish it.

alona
02-28-2005, 02:52 AM
The texture projection has a Fit Subcomponents to Image button on it`s property page. Press this, then, underneath this button there is Freeze button

Practically it fits the selected points into the image (0-1 UV space) with a transform on the UV projection, then you freeze this transform.

The manual describe this, and check out the property pages also when you`ve got problems.


I'll go back to the manual, I remember this operation as something that just helps fix the proportions or do a bit of morphing. You're probably right and this is useful for me, but so far I couldn't see how :shrug:. Did you mean that I can use this *once* to fix the mapping for my knotted object? Which subcomponents should I select?

moreover, I made a custom toolset, especially for long time maya users, including the fitting tools, the move and sew tool, and aligning functions working just like in maya. If my employers allow that I`ll publish it.


This will surely be very useful! I'll be very glad if you can post it.

Thanks for the help, anyway!

AA

j3st3r
02-28-2005, 05:17 AM
Fit Subcomponents uses the selected UV sample points. So when you press the key, it will ask you to select all the samples you gonna fit. There are few tricks, depending how you want to fit, because originally this bottom fits all direction. But, as you may see on the PPG (property page), there are transform values under this button. If you set U back to 1 after fitting will result, that your UV is fitted only in V, if you set V to 1, then only the U direction will be fitted.

Since this values used for texture animation also, it`s good to have a textured, or textured decal mode on the viewports.

Since UV Editor is not for animation, youor changes won`t be visible, until you press Freeze on the Texture Projection PPG.

Today I`ll ask the employer about the UV tool I made.

Fluckrat
02-28-2005, 09:45 AM
Hi Alona, look up "ContourStretch Subprojection" in the docs. This will do exactly what you want.....

....you can find it under the tools menu in the TE.

alona
02-28-2005, 11:01 AM
Cool! This is a big step in the right direction. My only problem now is that the operator insists on working on a selection of polys that has a rectangular contour. It makes sense given what it is trying to do, but when I need to texture something like a torus, it's still a bit of a problem (I was able to leave thin slits out, and I will now try to cover them in another subprojection).

In the meantime I've discovered that NURBS surfaces are much more well behaved in that respect. They can easily be textured the way I need, so I'll either use them for that type of objects or keep battling with the polys (converting the NURBS to mesh loses the projection, of course :sad:), we'll see.

Thanks again for the tip!

AA

alona
02-28-2005, 11:22 AM
OK, problem solved. Ablefish explains it here:

http://www.xsibase.com/forum/index.php?board=12;action=display;threadid=14627

I actually cut *two* orthogonal edge loops to unwrap the torus, and also used the "Interior smooth" parameter to get everything aligne. Sorry for wasting your time... and thanks again.

AA

CGTalk Moderation
02-28-2006, 12:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.