-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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.offset/repeat vs. Material.offset/repeat #3549
Comments
I was the one who asked the stackoverflow question. Thanks for posting the issue in this tracker. Illustration of separate cubelets with the same image, but that need separate offsets: Another possibility I wondered about was to have multiple texture objects that share the same image. That would allow us to have two different meshes using the same image in their material's texture, but at different offsets, |
Yep. I agree that offset and repeat should be per texture. |
Did you mean to say "material" -- or did you mean to say "disagree"?
As I pointed out in my (edited) answer to your stackoverflow post, this is doable already via texture cloning. |
Per "texture"+"material", sorry :) |
OK, closing. |
The thing is... for the currently API design, the only solution would be doing this: material.map
material.mapOffset
material.mapRepeat
material.env
material.envOffset
material.envRepeat
... And that's quite messy. With var texture = new THREE.Texture( 'image.png' );
var material = new THREE.MeshMaterial(
[
new THREE.TextureMap( texture, offset, repeat, blending ),
new THREE.EnvironmentMap( texture, offset, repeat, blending ),
new THREE.BumpMap( texture, offset, repeat, blending ),
...
]
); |
I'm also looking for a solution. If I understand correctly, I now have to duplicate a texture for each individual material for which I want to have different offset / repeat values. This results in unnecessary memory usage. My use case is that I have a bitmap font sprite sheet with digits 0 - 9 laid out vertically, and 10 objects for a score counter so that I can smoothly tween individual numbers to display a new score by changing their individual offsets (the effect is something like a flip counter). Is there a way to share only one texture and use different offset / repeat values for each of the 10 objects' materials? |
As stated in the guidelines, help requests should be directed to stackoverflow. This board is for bugs and feature requests.
|
Thanks for your tip and sorry to disrupt this board. |
I've just submitted a PR that should address this issue, PR #8278 |
As pointed out in this stackoverflow question,
.offset
and.repeat
are properties of a texture, not a material.Suppose, for example, a user wants to share a spritesheet across multiple materials. Currently that is not possible, since
offset
is a property of the texture, and can only be set once.Also, making
offset
a property of a material would avoid the "uv repeat and offset setting priorities" inWebGLRenderer
.This code logic forces all the texture offsets/repeats to be the same, anyway.
Should
.offset
and.repeat
be properties of a material instead?The text was updated successfully, but these errors were encountered: