JannisX11 / blockbench

Blockbench - A low poly 3D model editor
https://www.blockbench.net
GNU General Public License v3.0
3.37k stars 291 forks source link

[suggestion] support repeating textures #1391

Open chriscamacho opened 2 years ago

chriscamacho commented 2 years ago

please consider supporting GL_REPEAT, not just GL_CLAMP

use case :

16x16 textures cube 8x8x0.5 uv size 128x128x8

you can do this by hacking the save file the scale is right so the texture looks like it should on a 1x1x1 block with uv 16x16, but the texture is clamped not repeated

chriscamacho commented 2 years ago

around line 50 of textures.js add this

        img.tex.magFilter = THREE.NearestFilter
        img.tex.minFilter = THREE.NearestFilter
        img.tex.wrapS = THREE.RepeatWrapping;
        img.tex.wrapT = THREE.RepeatWrapping;

and it works super! of course you'd want to allow the GUI to let you have UV values higher than the texture size so you didn't need to "hack" the save file...

I'd make a PR but I'm not a great fan of JS and wouldn't want to inadvertently break something and leave you holding both pieces....

chriscamacho commented 2 years ago

Its been a few weeks since this has been added to the overview, I'd like to use this tool for a specific project, roughly how long might this feature take before its added ?

I can have a go a hacking it in and making a PR but as I said JS isn't my native language...

JannisX11 commented 2 years ago

I have no plans to add this currently, so I can't give you a timeline. It's a pretty small change, so you could create a fork and just change the lines.