azerion / phaser-spine

A plugin for Phaser 2 that adds Spine support
MIT License
121 stars 58 forks source link

Mesh Deformation Supported? #62

Closed shibekin69 closed 7 years ago

shibekin69 commented 7 years ago

Yeah, I've been wondering about this. Does Phaser-Spine (even the non Spine-TS version) with WebGL support this? I tried to get it to work before, but without much luck.

AleBles commented 7 years ago

Nope, sorry :( It's the reason why I wanted to switch to spine-ts, because the original spine-js also had no meshes (due to canvas rendering)

shibekin69 commented 7 years ago

Ah ok, as I thought. Thanks for confirming!

pzlewinski commented 7 years ago

Im using the last released version and Im having errors using meshes with canvas rendering, before that I was using Phaser 2.6.2 and Phaser Spine 2.2 and it worked fine using canvas, but I started to update both Phaser and Spine and isnt working. Is something Im doing wrong or it has to do with Phaser removed Pixi features? Is there a solution? Thanks

shibekin69 commented 7 years ago

Are you trying out the master branch of the spine-ts one?

pzlewinski commented 7 years ago

yeah I tried, it doesnt throw me errors but the spine with meshes is not rendering completely just some parts of the spine (with meshes though), also it gives me a lot of problems with positioning and scales. With Phaser-Spine 2.2 and Phaser 2.6.2 it works perfectly in Canvas (and with similar bugs in WebGl).

shibekin69 commented 7 years ago

So using the master branch with spine 3.4.02 export, and the spine-ts with spine 3.6+ export still gave you problems?

pzlewinski commented 7 years ago

My test were using both master branch and spine-ts with spine 3.2.01. I will try with 3.6 to see if I still have problems.

pzlewinski commented 7 years ago

I tested with both spine-ts with 3.6+ and master branch with spine 3.4.02 using canvas, the good news is that it doesn't throw me errors this time in both cases, but the meshes are still not rendering, I see the spine running but without images that have meshes.

shibekin69 commented 7 years ago

Hmmm.. I thought the spine-ts branch with 3.6 was ok displaying WebGL stuff already... did you turn on triangle rendering?

pzlewinski commented 7 years ago

with triangle rendering in the ts-branch with both WebGL and canvas works, there is a way that can work without using the triangle rendering? Also scaling the spines doesn't work properly, also in WebGL positioning doesn't work.

Update: in webgl the meshes works without triangle rendering, I check the code and the triangle rendering is just for Canvas set, I used this time Spine 3.4.02 for the ts branch. The bad thing of triangle rendering is that there are little transparent lines strokes in each triangle.

Alej-P commented 6 years ago

I found an ugly hack to get rid of those "little transparent lines strokes in each triangle", draw twice with a slight Y offset. After this.drawTriangle(renderSession, texture, x0 / res, y0 / res, u0, v0, x1 / res, y1 / res, u1, v1, x2 / res, y2 / res, u2, v2); add this to draw again this.drawTriangle(renderSession, texture, x0 / res, (y0 / res)+.1, u0, v0, x1 / res, (y1 / res)+.1, u1, v1, x2 / res, (y2 / res)+.1, u2, v2);