Rework texture generating code, add texture grouping