pixijs / tilemap

Rectangular tilemap implementation for PixiJS
https://pixijs.io/tilemap/docs/
MIT License
288 stars 55 forks source link

texture size limitation #70

Open SET001 opened 4 years ago

SET001 commented 4 years ago

is it possible to somehow hack the 1024x1024 texture limitation? I'm currently using 2048x3040 and the tiles outside 1024x1024 is just ignored.

ivanpopelyshev commented 4 years ago

default mode in current (v5) implementation doesnt depend on that limitation.

As soon as you specify

PIXI.tilemap.Constant.boundCountPerBuffer = 4;

RMMV behaviour kicks in and starts combining 4 textures into one big.

There are other constants. Please look at them. In v4x its by default, but you can easily switch it off.

ivanpopelyshev commented 4 years ago

But then, of course, you need to raise number of used texture units.

SET001 commented 4 years ago

well, what I'm trying is to change in atlas frame coordinates to out of 1024x1024 range:

  "collon7": {
    "frame": {"x":1728,"y":384,"w":32,"h":32},
    "rotated": false,
    "trimmed": false,
    "spriteSourceSize": {"x":0,"y":0,"w":32,"h":32},
    "sourceSize": {"w":32,"h":32},
    "pivot": {"x":0.5,"y":0.5}
  }

If I do so, this frames just does not show up. Also, I put boundCountPerBuffer =4 in the very beginning of index file

import * as PIXI from 'pixi.js'
(window as any).PIXI = PIXI
PIXI.tilemap.Constant.boundCountPerBuffer = 4;

versions used:

    "pixi-tilemap": "^2.0.0",
    "pixi.js": "^5.1.5",
SET001 commented 4 years ago

with

  "collon7": {
    "frame": {"x":992,"y":384,"w":32,"h":32},
    "rotated": false,
    "trimmed": false,
    "spriteSourceSize": {"x":0,"y":0,"w":32,"h":32},
    "sourceSize": {"w":32,"h":32},
    "pivot": {"x":0.5,"y":0.5}
  }

sssssssssssaaasd

and with:

  "collon7": {
    "frame": {"x":1024,"y":384,"w":32,"h":32},
    "rotated": false,
    "trimmed": false,
    "spriteSourceSize": {"x":0,"y":0,"w":32,"h":32},
    "sourceSize": {"w":32,"h":32},
    "pivot": {"x":0.5,"y":0.5}
  }

sssssssssssaaasd2

SET001 commented 4 years ago

this is the tilemap I'm using ProjectUtumno_full

ivanpopelyshev commented 4 years ago

boundCountPerBuffer =4

Default mode in v5 should work, you dont need that line.

Please make a small demo for me, I'll debug it.

ivanpopelyshev commented 4 years ago

This is the line that makes pixi-tilemap work with any textures: https://github.com/pixijs/pixi-tilemap/blob/master/src/Constant.ts#L7

ivanpopelyshev commented 4 years ago

And here is it in build: https://github.com/pixijs/pixi-tilemap/blob/master/dist/pixi-tilemap.js#L206

    pixi_tilemap.Constant = {
        maxTextures: 4,
        bufferSize: 2048,
        boundSize: 1024,
        boundCountPerBuffer: 4,
        use32bitIndex: false,
        SCALE_MODE: PIXI.SCALE_MODES.LINEAR,
        DO_CLEAR: true
    };

Well, it seems that I forgot to publish the build :)

ivanpopelyshev commented 4 years ago

OK, I re-published it in dist folder, please take a "new" one. I dont know how did that happen.

published 2.0.1 in npm.

SET001 commented 4 years ago

I have updated to 2.0.1 and it was finally solved when I added

PIXI.tilemap.Constant.boundCountPerBuffer = 1

If I change it to 4 then tiles that are out of 1024x1024 range would again be not visible

jjhesk commented 2 years ago

I have changed to 1 too. I render texture render amount to be 40876 and it breaks in the middle around 1xxxx in the webgl.

image
ivanpopelyshev commented 2 years ago

@jjhesk look in readme, it has special setting for uint32 stuff

jjhesk commented 2 years ago

thanks. i got it resolved @ivanpopelyshev