Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Texture repeat: natural dimensions #156

Open
dhasenan opened this issue Nov 20, 2014 · 2 comments
Open

Texture repeat: natural dimensions #156

dhasenan opened this issue Nov 20, 2014 · 2 comments

Comments

@dhasenan
Copy link
Contributor

If I have a tiling texture, it's probably a texture I want to tile an appropriate number of times for whatever length of mesh I assign it to. For instance, I want a brick texture that I can tile across various walls. These walls will vary in height and width, but the texture should be applied at the same scale for all of them.

The API allows me to specify that a particular texture should repeat a specific number of times. Using that, I will create a material and a texture, tell it to repeat X times on the X axis, and apply it to wall 1. It works! Then I apply it to wall 2, which is half the length...and now the texture is horribly squished.

So now I have to look at the geometry of the object I'm working with, usually a cube, and create a new texture and new material for each face, calculating the number of times the texture needs to be repeated for each. This is, needless to say, quite vexatious, not to mention inefficient.

It also doesn't mesh (sic) with the naive notion of a material, which is something you should be able to reuse for many different meshes. As is, you can only reuse a material when rendering identical faces of different meshes, faces that are the same size by happy accident. Unless you want horribly distorted textures.

@johsin18
Copy link
Contributor

Generally, three.dart is a port of three.js to Dart. Would three.js support your use case? I'm not sure we want to diverge from three.js in terms of API, though every improvement is welcome.

Anyway, I support your opinion that materials should be reusable on multiple objects.

@DanielJoyce
Copy link
Contributor

Given that repeats are specified in opengl on a per-texture level, I don't think there is any way around not creating a new texture everytime you want a different repeat.

I guess you could write a custom shader to handle texture repeats perhaps in this manner, so you don't have to bind a texture for every custom repeat.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants