These are chat archives for pixijs/pixi.js

21st
Feb 2016
Micheal Winger
@mordof
Feb 21 2016 20:49
@ivanpopelyshev am i right in my guess that mesh objects, even if there's many added to the same container - that they won't be optimized using the same texture and batched all in one shader pass?
Ivan Popelyshev
@ivanpopelyshev
Feb 21 2016 21:31
mesh costs one operation
Chad Engler
@englercj
Feb 21 2016 21:32
each mesh is its own draw path, we do not auto batch them
Micheal Winger
@mordof
Feb 21 2016 21:32
figured. ok
Micheal Winger
@mordof
Feb 21 2016 21:37
is there any way i can debug why my uvs aren't working properly? http://cl.ly/1p2a2w1J2w0w i've got a square green image with dark green border - and i'm trying to make each of the 4 tiles have that image mapped to it..
my uv array is [0,0, 1,0, 1,1, 0,1, (repeat for the other 3 tiles)].
Ivan Popelyshev
@ivanpopelyshev
Feb 21 2016 22:11
can you give me part of the code?
just to look at it
Micheal Winger
@mordof
Feb 21 2016 22:11
yep, sec
@ivanpopelyshev https://gist.github.com/mordof/f8870a1a3286126ebc1c and a visualization of where the vertices are: http://cl.ly/0t2x0O0r423M
@ivanpopelyshev it's rather messy at the moment
ooh, hmmm
Micheal Winger
@mordof
Feb 21 2016 22:16
i think i might know what it is
i create it from the top down, left to right.. so the indices specify the correct vertices, until it gets to the last (top,right,bottom,left)
so the very left tile's left vertex ... the next one in the indices array points to the far right tile, top vertex
no idea how to fix that yet though, lol
Ivan Popelyshev
@ivanpopelyshev
Feb 21 2016 22:19
show me something anyway
ok
i see it
indices are the problem
mordof @mordof nods
Ivan Popelyshev
@ivanpopelyshev
Feb 21 2016 22:21
indices.push(index)
indices.push(index+1)
indices.push(index+2)
indices.push(index+2)
indices.push(index+3)
indices.push(index)
index+=4;
two triangles
Micheal Winger
@mordof
Feb 21 2016 22:22
do i then need to change the draw mode of the mesh?
Ivan Popelyshev
@ivanpopelyshev
Feb 21 2016 22:22
is it default?
Micheal Winger
@mordof
Feb 21 2016 22:22
mhmm
Ivan Popelyshev
@ivanpopelyshev
Feb 21 2016 22:22
then no, you dont have to
one quad = 4 vertices + 6 indices
Micheal Winger
@mordof
Feb 21 2016 22:23
oooh.. that almost entirely worked.. lol
Ivan Popelyshev
@ivanpopelyshev
Feb 21 2016 22:23
whats wrong?
that is probably uvs now
Ivan Popelyshev
@ivanpopelyshev
Feb 21 2016 22:24
ugh why are there extra triangles?
Micheal Winger
@mordof
Feb 21 2016 22:24
i've gotten that lots when i specified the uvs improperly and it doesn't like it... the edges are white
Ivan Popelyshev
@ivanpopelyshev
Feb 21 2016 22:25
uvs are correct
Micheal Winger
@mordof
Feb 21 2016 22:25
hmm
Ivan Popelyshev
@ivanpopelyshev
Feb 21 2016 22:27
ugh
is your texture a square?
What's that light part? I think its in the other piece of code :)
Micheal Winger
@mordof
Feb 21 2016 22:28
http://cl.ly/2z2p3V1u121a inverting the second triangle in the indices gave me that
and yeah, it's a square
the only stuff being rendered on the screen is from the function i pasted. nothing else adds to the rendering at this point
Micheal Winger
@mordof
Feb 21 2016 22:41
@ivanpopelyshev http://cl.ly/2z3f1b000Z0u i separated each tile some so it's a bit easier to see what's going on.. not sure if that helps
Ivan Popelyshev
@ivanpopelyshev
Feb 21 2016 22:41
so this white stuff is the edges, right?
Micheal Winger
@mordof
Feb 21 2016 22:41
yep
i changed the border color in the texture, and the white stuff changed to match. so it's the borders being stretched
Ivan Popelyshev
@ivanpopelyshev
Feb 21 2016 22:43
you know that you could do that in one graphics object, right?
not related to mesh issue
indices.push(index)
indices.push(index+1)
indices.push(index+2)
indices.push(index+3)
indices.push(index+2)
indices.push(index)
index+=4;
that's how you did it, right?
Micheal Winger
@mordof
Feb 21 2016 22:45
one graphics object can handle each tile having a different tile from a spritemap? or atlast or w/e
Ivan Popelyshev
@ivanpopelyshev
Feb 21 2016 22:45
you didnt change it except reverting third triangle?
graphics doesnt care about sprite maps
you're doing circles with it
Micheal Winger
@mordof
Feb 21 2016 22:46
oh that
yeah w/e
that's just for this
they're being removed once it's figured out
Ivan Popelyshev
@ivanpopelyshev
Feb 21 2016 22:46
show me the code, again
i'm using your original triangle index order
changing it up caused other issues that seemed worse
ah
yeah, i needed to change the draw mode
works perfect once i put it at TRIANGLES only
TRIANGLES_MESH does something with attaching the triangles together.. probably a poor explanation of it, but they weren't independent of each other
Micheal Winger
@mordof
Feb 21 2016 22:56
seems interactivity on a container with a mesh in it is extremely costly though...
Ivan Popelyshev
@ivanpopelyshev
Feb 21 2016 23:04
yeah, that's a problem
it traverses through all mesh
all triangles
Micheal Winger
@mordof
Feb 21 2016 23:05
when it's a container of a ton of sprites - it doesn't have to do that?
Ivan Popelyshev
@ivanpopelyshev
Feb 21 2016 23:05
that's why you have to separate mesh to chunks, like 10x10 or 8x8 tiles and check their bounds first
so you wont have to traverse through 100x100 map
Micheal Winger
@mordof
Feb 21 2016 23:06
hmm
i may just use a mesh to pre-generate all of the tile textures and go back to using sprites
300x300 sprites doesn't even break a sweat
but 30x30 mesh drops the FPS in half
Ivan Popelyshev
@ivanpopelyshev
Feb 21 2016 23:42
oh
did you use culling with sprites?
Micheal Winger
@mordof
Feb 21 2016 23:43
i'm wrong about that - i switched from windows to linux, and it seems the overhead of my index search is just a bit much on here
no i didn't
Ivan Popelyshev
@ivanpopelyshev
Feb 21 2016 23:43
heh
performance must be almost the same, except the part of uploading buffer every frame
Micheal Winger
@mordof
Feb 21 2016 23:43
but i'm not interacting with the children of the container at all, so really i shouldn't be doing that anyway
yeah - it's just about the same
the only thing i'm benefiting from by putting interactive on the container, and using those events, is the event.data.getLocalPosition call..
Ivan Popelyshev
@ivanpopelyshev
Feb 21 2016 23:57
i go sleep, i'll help you tomorrow
i'll help you with interaction on mesh , dont worry ;)