Game Development Community

How to repeat a texture on a model?

by Adam Zeliasz · in Torque 3D Public · 10/08/2009 (12:18 pm) · 37 replies

Lets say I have a texture that's 512x512 on a polygon square model. If I stretch out that square to make a rectangle in Torque 3D, how can I tell the texture to repeat along the X axis? Can I do that in T3D, or do I need to do all the stretching/texturing in Softimage?

Thanks!

About the author

My name is Adam Zeliasz. I'm a designer testing out Torque 3D for an independent title. I specialize in modeling and animation, and well as web and print design.

Page«First 1 2 Next»
#21
10/21/2009 (4:48 pm)
i am using 3.3 which might have somthing to do with it as well so was going to install the latest one which is what he's using.
#22
10/21/2009 (5:35 pm)
i got a object that looked much like his to work just fine with 4.1 crosswalk. this is also with texture repeat 3. matt might be able to help better then i can to find out what the problem is. i did not test the texture on the object in game though only the object .dae file.

my 30k caracter i working on works fine though with its 1/3 finished texture.
#23
10/21/2009 (6:04 pm)
@Brandon: So you are saying that when you look in the .dae files XML you can see the texture repeat markup, but you did not test the exported .dae file in the engine?
#24
10/21/2009 (9:34 pm)
I was using the latest crosswalk 4.1 and COLLADA 1.4.1
#25
10/21/2009 (11:57 pm)
no i tested the .dae in the engine i just did not get the texture on the object because i did not change the texture to a non stock texture. i can do that now that i am back home just i did not have the time to do it.
#26
10/22/2009 (1:14 am)
No it will not put texture repeat on export. the only way i see that happening is to expand the UV's to go over the basic texture distance.

i went though the DAE file as well to see if i can spot a texture repeat. i cant find anything that might be in there for that or where it world be or what it might look like. it could still be in there i just don't know what i looking for to find it.
#27
10/22/2009 (5:41 pm)
One thing to consider is that if you don't bake the texture supports into fixed UV's you can resize the texture supports in Softimage to create the same effect as increasing the U and V repeats. This would only work well for simple texture projections such as Planar, Cubic, Cylinder, etc.

The texture support in Softimage is an operator that calulates the UVs based off of different projections. When you freeze the operator stack in Softimage texture supports are then baked into fixed UVs. While texture supports are on the operator stack they can be resized and will interactively update the UV data for the object.

When exported to COLLADA or DTS the "result" of the operator or what would end up in the "baked" UVs is what will be exported. This would give you the ability to update the texture repeats interactively in Softimage without needing to manipulate the UV data manually.

It is not quite as simple updating the texture UV repeat values, but it accoplishes the same thing in a way that will work correctly when your object is exported for use with T3D via COLLADA or direct to DTS. You end up creating the texture supports anyway as a result of the UV setup process, all you have to do not bake them.
#28
10/24/2009 (12:44 pm)
Just wondering if you tried using the texture support in Softimage to repeat your texture?
#29
10/27/2009 (11:51 am)
A shader really needs to be implemented in T3D that allows you to repeat a texture in both the U and V independently. I don't want to mess around with the UV's on an object just to get a texture to repeat. That would also mean modifying the texture as well, requiring a new texture sheet.
#30
10/27/2009 (12:20 pm)
Did you actually try scaling the texture support in Softimage? If all you need is to be able to control the texture repeat this option will work well.

Other than sounding more convenient, being able to adjust the texture repeats on the shader isn't going to magically fix UV problems that can occur depending on the complexity of your shape. Sure it would be nice to have but you can do the same thing in Softimage with the tools you already have.

What kind of shape are you trying to repeat your texture on? In your original post you said a "polygon square". You don't need to modify the texture or the texture sheet to tile the texture on a square (or most simple shapes) using the texture support in Softimage.
#31
10/27/2009 (1:39 pm)
www.darkindustries.com/gg/box_w_repeats.jpg

Here is a screen shot showing the resized texture support in Softimage 2010 and the exported DTS shape in ShowTool Pro. The texture is a simple box texture that was not modified in anyway, nor was any direct modification of the UVs done.

I simply selected the texture support and scaled it uniformly by 50% (0.5 scale) in order to repeat the texture 2 times and adjusted its transform offset to align the texture to the edge. Took about less than 10 seconds to do this.
#32
10/27/2009 (2:53 pm)
With your example that would work fine. But in this example:
umgdemo.umgecomm.net/adamz/temp/TextureRepeat.jpgWhat do I do if I have a texture that I would like to repeat up up the cylinder? Say I have some stone that tiles seamlessly?

Or say I have a square sheet of metal that has a seamless texture in the X direction. If I bring that into T3D and I want to stretch the model out, the texture will stretch as well. I want to be able to repeat that, either in the Material Editor in either T3D or Softimage.
#33
10/27/2009 (4:34 pm)
Here is the same technique working with a cylinder

www.darkindustries.com/gg/cylinder_w_repeats.jpg
It works the same with a cylinder as with a cube, you would just use a cylindrical texture projection instead of a cubic one.

In the case where you only want the texture to repeat in the X direction you can simply only scale the texture support in the X direction.

But yes, if you resize the object in T3d the texture will stretch because in the end, using this option the final UVs are baked. It is not a prefect solution but it will work well in most cases.

Based on my testing when you adjust the UV repeats on the material in Softimage and export to COLLADA the UV repeat values set on the material are not exported to the COLLADA file.

I have been looking in the Material code, the TS shape code as well as the COLLADA loader code and nothing that I have been able to find in there does anything with user specified UV repeats. The only code that I have seen so far that does anything with UV repeats is for the Maya COLLADA extensions in the COLLADA loader.

So unless someone else knows where in the code this would be located I am going to go out on a limb and say that repeating the texture in Softimage using the texture support is one of the best options that you have available.

Writing a custom shader is also an option, (and I really don't think it would be that bad to write one) but till then this technique at least gives you something you can use now.
#34
10/27/2009 (4:49 pm)
Well I appreciate your help with this. And thanks so much for the examples! :)

What about if you're not using texture support, just a UV that I unfolded? Lets say I have a rock wall, and a texture that tiles seamlessly. How do I get that to repeat a certain number of times so it "fits" within the scale of the world?
#35
10/28/2009 (1:47 am)
If you had something that was already UV mapped and wanted to adjust the repeat of the texture, a good option is to adjust the UV scaling on the Texture Projection. The Texture Projection is where baked UV data is stored in the Softimage scene.

www.darkindustries.com/gg/uv_scale_location.jpg

There are half a dozen or so ways to open the property panel for the Texture Projection. With your object selected, from the render toolbar or from the render menu go to modify->projection->Inspect Current UV.

On the right side of the Texture Projection property panel are the UVW scale settings. Reducing these values will cause the texture to repeat across the entire object. If you change the values here the texture repeat will update in the view port but if you were to export the shape either to COLLADA or direct to DTS the exported shape will not have the new texture repeat settings.

There are two buttons below the UVW transformations "Reset" and "Freeze". If you click the "freeze" button any adjustments you made to the texture repeat will be baked into fixed UVs. If you export the shape now the texture repeat will be visible in the exported shape.

Keep in mind that once you bake the UV repeats its a bit harder to remove the repeats than it was to add them. You can go back in and increase the UV scale or you could save a version of the scene before you bake the UVs.
#36
10/28/2009 (12:22 pm)
Matt, thanks! That worked out perfectly.
#37
10/28/2009 (5:26 pm)
It is also worth mentioning that by default when you add a texture projection to your object the texture support is parented to the object. This means that if you resize the mesh object the texture support is resized as well.

If you expand the object hierarchy in the scene explorer and drag the texture support from the mesh object to the scene root, resizing the object will no longer resize the texture support as well. Instead the as you scale or translate the mesh object the texture will start to repeat based off of the location of the texture support in the scene co-ordinate system.

This gives you a similar texture behavior to what you would have using Constructor or Hammer to build DIF objects for previous versions of Torque. The texture scale and position is anchored by the texture supports position in the scene co-ordinate space and the texture position on the mesh is controlled by the mesh objects position relative to the texture support in the scene.

This behavior varies slightly depending on the type of texture projection you choose, but it can give you some additional control and flexibility when texturing with repeating textures in Softimage. This technique will not work with baked UVs because it requires a texture support and once you bake the UVs the texture support is removed.

Glad to hear that it worked out for you. I am testing a bunch of other things related to texturing, if I run into anything else that might be helpful I will let you know.
Page«First 1 2 Next»