{"action":"created","issue":{"url":"https://api.github.com/repos/mrdoob/three.js/issues/5876","labels_url":"https://api.github.com/repos/mrdoob/three.js/issues/5876/labels{/name}","comments_url":"https://api.github.com/repos/mrdoob/three.js/issues/5876/comments","events_url":"https://api.github.com/repos/mrdoob/three.js/issues/5876/events","html_url":"https://github.com/mrdoob/three.js/issues/5876","id":53969989,"number":5876,"title":"UV offset / repeat should be part of materials rather than textures","user":{"login":"QuaziKb","id":9892122,"avatar_url":"https://avatars.githubusercontent.com/u/9892122?v=3","gravatar_id":"","url":"https://api.github.com/users/QuaziKb","html_url":"https://github.com/QuaziKb","followers_url":"https://api.github.com/users/QuaziKb/followers","following_url":"https://api.github.com/users/QuaziKb/following{/other_user}","gists_url":"https://api.github.com/users/QuaziKb/gists{/gist_id}","starred_url":"https://api.github.com/users/QuaziKb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/QuaziKb/subscriptions","organizations_url":"https://api.github.com/users/QuaziKb/orgs","repos_url":"https://api.github.com/users/QuaziKb/repos","events_url":"https://api.github.com/users/QuaziKb/events{/privacy}","received_events_url":"https://api.github.com/users/QuaziKb/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mrdoob/three.js/labels/Suggestion","name":"Suggestion","color":"ffffcf"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":40,"created_at":"2015-01-10T20:19:36Z","updated_at":"2015-05-09T10:15:40Z","closed_at":null,"body":"UV offset and repeat (and probably some of the other texture properties) are uniforms which are strangely passed from the texture into the material, which leads to issues where you have to clone textures per material (wasting a ton of memory) if you want per-material offsets/repeats, or roll your own custom shader. It's very inefficient to force people to do this, the best case being if someone wants to tile a texture across a surface based on the size of the object it's applied to, or use a texture as a spritesheet for animations. I can only see the current system as a hindrance with no real advantages, since the likelihood of needing shared UV offsets/Repeats on a \"shared\" texture is low, and would normally be better served by sharing a material. In anycase updating the uniforms off the texture is weird, since it really has no business being part of the texture, and ends up being confusing to the end user. For example, changing the offset/repeat when more than one map is applied to the material, example diffuse+normalmap, only uses the offset/repeat of the diffuse map, so the value of the normalmaps offset/repeat is completely useless in that context, when it really suggests it should affect the normal map offset/repeat. It's all around confusing.\r\n\r\nI'm pretty sure the change is required in the \"refreshUniformsCommon\" function, but there's probably more to it. There's some changes required in the sprite plugin aswell. This would probably break a lot of peoples projects but it's a pretty big inconsistency in the texture/material API. It might be a better idea to make it an override that's normally null for materials, and when set ignores the values in the textures, just so it doesn't break everyones stuff."},"comment":{"url":"https://api.github.com/repos/mrdoob/three.js/issues/comments/100459301","html_url":"https://github.com/mrdoob/three.js/issues/5876#issuecomment-100459301","issue_url":"https://api.github.com/repos/mrdoob/three.js/issues/5876","id":100459301,"user":{"login":"benaadams","id":1142958,"avatar_url":"https://avatars.githubusercontent.com/u/1142958?v=3","gravatar_id":"","url":"https://api.github.com/users/benaadams","html_url":"https://github.com/benaadams","followers_url":"https://api.github.com/users/benaadams/followers","following_url":"https://api.github.com/users/benaadams/following{/other_user}","gists_url":"https://api.github.com/users/benaadams/gists{/gist_id}","starred_url":"https://api.github.com/users/benaadams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benaadams/subscriptions","organizations_url":"https://api.github.com/users/benaadams/orgs","repos_url":"https://api.github.com/users/benaadams/repos","events_url":"https://api.github.com/users/benaadams/events{/privacy}","received_events_url":"https://api.github.com/users/benaadams/received_events","type":"User","site_admin":false},"created_at":"2015-05-09T10:15:40Z","updated_at":"2015-05-09T10:15:40Z","body":"I think having the values on the Material rather than the texture makes sense for the common use case where all you textures would be matched.\r\n\r\n> Completely agree here. Not having this functionality is extremely limiting. There are fantastic effects that could be provided here that just aren't because every offset is locked together.\r\n> \r\n> But how can this functionality be made available without choking on clones?\r\n\r\n```THREE.ShaderMaterial``` or ```THREE.RawShaderMaterial``` would give you this ability, and given it doesn't work currently with regular materials this this the route you'd have to be using anyway.\r\n\r\nIf you are doing something more funky, it will probably be more funky than just adjusting maps repeats and offsets independently, so you would probably lean this way anyway."}}