Same model, different UV maps?

I have textured models, like ramps, and want to be able to just rotate them at 90 degrees or mirror them so I don’t have to use new models for every angle…

The problem is, I want their textures to remain right-side up, so the ramps still fit in with their surroundings, and their textures aren’t reversed etc…

Do I need to export a model for every texture orientation, or a texture for each model orientation, or could I manipulate UV coords on the fly, ? What does one do?

How about rotating/flipping the texture coordinates in a custom shader?

Is that really worth the effort of coding and the constant shader computations at runtime, vs just exporting the models 4 times … I don’t even know… Unless I could just run the shader ONCE upon object placement, and then just leave the results permanently. Do you know what the case is there? Can I use a shader to alter texture coordinates once and for all, and not have to loop through doing that EACH frame?

Still… I’m getting tired of all these considerations on my one man little project. yawn.

If it’s really just for one model, a custom shader is probably overkill. The runtime performance is not an issue here though, as flipping texture coordinates is nothing.

A shader to rotate texture coordinates. Can I just rotate them around an orbit point like any vector? Feed the new coords in, that sort of thing? … So the way I have done shaders so far, has been by issuing shaders (in one file) to my model at load, if this is the case here as well, can I just keep loading ever increasing shaders (features like this rotation) onto my models, and that’s just fine? My shader file will grow, is this fine?

Yeah, you can use a matrix to rotate by arbitrary angles around any center point you want. If it’s just flips and 90 degree rotations, you don’t necessarily need a matrix, you can just swap and negate x and y coordinates.

Not sure I understand the question. You render your model using a custom shader instead of the default shader. If you want to add additonal features, you add them in the shader code.

But again, for a single model you’re probably better of just creating 4 versions, like you suggested.

What I mean is, and this is an offshoot topic, but my shader file… Size wise… How many features, such as texture rotation, can I throw at it? … Performance wise…

If the feature goes into the vertex shader, like in this case, it will depend on your vertex count. With modern GPU’s you can have pretty complex vertex shaders while rendering millions of vertices.

1 Like