Web Toolbar by Wibiya

Material: tiling a texture based on mesh size


A place to ask questions or discuss issues relating to implementing applications with Axiom. If you are unsure of where to post, post here.

Passer-by

Posts: 3

Joined: Sat Nov 29, 2014 7:57 pm

Post Sun Jan 04, 2015 4:34 pm

Material: tiling a texture based on mesh size

I want to apply a "brick wall" material to a bunch of walls. These walls can be of arbitrary length, though they're all the same height.

I'm not sure how to accomplish this in a reasonable manner. I can make a texture that's the right height, since all my walls are the same height, but the texture is stretched. I can tell a texture to repeat, but it repeats a fixed number of times across the submesh, whether it's 1.5 units wide or 100 units wide.

At present, I only see three ways of doing this:

1. I can create fixed-size wall segments. This means that I am restricted in how long my walls can be -- I can have a wall that's, say, 5 units long, but not 5.5 units. It also means I'm creating a ton of submeshes.
2. I can create a new Material for each wall. This means I'm making a few thousand Materials per level when it seems like I should only need a couple dozen.
3. I can hack the internals of Axiom so I can specify a natural size for a texture. Then the ScaleU/ScaleV values will be calculated each time the material's applied to a mesh. This means I don't have to precalculate the values for each wall and allocate new Materials for each.

I understand that saying a texture has a fixed natural size is troublesome in the general case in a world where you can distort mesh sizes, but I'm not going to be doing that.

Any suggestions? Obvious things I'm overlooking?
User avatar

Team Member
Team Member

Posts: 1615

Joined: Thu Mar 02, 2006 11:29 pm

Location: Boston, MA, USA

Post Mon Mar 09, 2015 7:12 am

Re: Material: tiling a texture based on mesh size

ou should be able to repeat a texture in one direction without specifying a number of times to repeat. Check the OGRE 1.2 documentation on materials, it should help figure it out. I'll also see if I can whip up a sample to illustrate it.
Borrillis
The Steward of Axiom

Return to General Q & A

Who is online

Users browsing this forum: No registered users and 1 guest

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.