-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WebGL support #67
Comments
Nice! Do the shearing / x-only and y-only scale transforms work perfectly, or are they wonky? See this for example of what I mean: |
Hi ! Just tried your debug asset (scaling arrows), and it might be the morning but they look fine to me. Certainly nothing like the gif you sent on the other thread ! I noticed a (unrelated) bug with 2.7.3 in WebGL though, where the whole asset-texture is drawn in addition to the animated mesh. Looks like Phaser is still rendering the inherited Sprite with it's texture-pack (which obviously shouldn't be rendered as such). |
I think @shibekin69 is talking about the official release that runs on the old spine runtime. As for the changes, I can accept them and add them (would be nice) but I'm not sure how fast these changes will propagate to a new release. I'd still love to PR/Add you're changes so more people may start working on the spine-ts implementation |
Oh right, indeed this would fix the issue :D ! As for the contribution, how can I send ? I create a fork repo from which you'll be able to pick or is there an easier way I don't know of (never did this yet) ? |
Yeah, those were exported from an older version of Spine (Essential, 3.4.02) and made to run with the current phaser-spine plugin (not the spine-ts one) |
Okay, then it's settled, with spine-ts this is a non-issue and works just fine. May I ask you what's missing in spine-ts implementation for you to do the switch over yet ? As for the texture binding issue I mentioned, I just fixed it. Though I'm not sure it will stay in release, as it is highly Phaser 2.7 specific issue (bug?) which is fixed in later versions. |
Okay, I did some changes to lean towards spine-ts use only and polished a little. PR linked. |
Hey, I just noticed another bug with webgl. I used sprite position but not taking eventual camera movement into account. I'm on it. |
@opulisDynamics Oh were you asking me about this? If you were, well, I'm doing my animations using the Essential version of Spine. So going Pro and these lingering bugs is like a chicken-and-egg thing - there was no justification in upgrading and on features that can't be used. And I couldn't test out Spine-TS either because my animations are from an older version, and my implementations were done for the current phaser-spine. When I tried using the test build several months earlier, it wouldn't work for me. So if you guys can get this to finally work, I can try it out (at least with the Essential version features). |
Okay it should be good now. I kinda laughed at myself when I finally got it, well, you know the feeling. And resolution is handled in both cases, though I might have not taken the right choice considering rendering position against SpriteBounds... I had trouble with debug bodies not taking resolution into account on another project, so I still wonder how it should really work. And of course if you have time, please try this and let me know if any issue comes to mind. Cheers |
Awesome! How do I use this btw? Is it similar to the the current phaser-spine? |
@shibekin69 Well, I didn't use the old version so I'm not sure yet about eventual missing functionalities between the two, but as of instanciation and display I believe it should be the same. All I know is there are some quirks between the README and actual code, eg ::setAnimationByName() not existing in favour to ::setAnimation(), but I believe it's mostly syntax related. I'll do have a look though, and wouldn't mind having more than a pair of eyes ! |
Maybe I'll try it out the new one later. The new Spine-TS should be able to support the newer features (which I haven't been able to try myself), so I don't think you're missing out on any goodies. As for speed, I've yet to compare the two. The older phaser-spine is workable enough, it just needs to have that x-only and y-only transform bug ironed out, but I don't know if that's possible. |
@shibekin69 My original Idea was too use most of spine-ts original code and have this lib just be a simple wrapper to wrap the renderer's supplied by spine-ts itself, a situation like that allows me to put very little effort into keeping this library updated. Looking to the changes from @opulisDynamics this still is very much true. I also think I stripped out most of the original API in order to start working from scratch, my idea, however, was to make spine-ts a minor release so I'll be readding all those API calls and some other stuff and hopefull today (otherwise next week) I'll start prepping for release (come to think of it, for supporting the older version it'd be nicer to make spine-ts a major release, then we can easily still update/patch the old logics) any toughts on this? |
Hmm.. keeping the old one separate might be a good idea, just in case spine-ts just won't work for some users. Like right now, I just tried the phaser-spine.js from the spine-ts/build directory, and the error I'm getting is immediate:
This is upon trying to add the plugin into my preloader's preload() section:
This works with the old version, and now the new one still won't work with me :(. I'm on Phaser 2.8.1. |
I'll start setting up stuff for seperate branches and spine-ts for a major release then. |
@shibekin69 You're right, spine-ts itself does provide the full bundle, but I was more thinking about eventual API changes (from phaser-spine perspective), missing helpers and so on. @AleBles Oh nice, as I was mentioning you, you answered ! |
@shibekin69 Damn undefineds. SpinePlugin currently thinks it will have option set upon initialisation, hence the error.
EDIT :
|
@AleBles Awesome ! Let me know if I can be of any help. |
Oh are the APIs not in yet? Like for example, I tried modifying the plugin adder part: this.Spine = this.game.add.plugin(PhaserSpine.SpinePlugin({debugRendering: false, triangleRendering: false})); Fair enough, it passes through. But when I have it load a spine animation, it gives me an error:
|
@opulisDynamics Thanks for that! Let me try this out... UPDATE: Still the same error :(. I don't know why, but this works:
|
@shibekin69 In fact, from example and our own use, it's:
|
It just won't work :(. I'm on regular JS btw, not TS. If this matters lol. |
@shibekin69 No it shouldn't, I use it in js for now too. Does the given example work for you anyhow ? |
Ok, if I hard set
on phaser-spine.js line 7637 and 7638 It loads up. But passing that object is still giving me debugRendering being undefined. |
That is strange, maybe it has to do with Phaser not propagating arguments to potential init function (which seems to be called nonetheless). But like @AleBles said, there are a still fews itches here and there waiting to be scratched out. |
Ok, well, I'll leave those static for now and see what other problems come up... When I load my spine object (current implementation uses APIs from the current phaser-spine), here are things that aren't working for me (says they are not functions):
And well, the resulting bundle of graphics is just a mess lol. So I really don't know what's up yet. |
@shibekin69 Yep, I'll be adding all of those :) @opulisDynamics I tried to update spine-ts to the latest version, but the webgl renderer is throwing me some issue, would you mind having a look over at spine-ts-update branch? |
@shibekin69 Nice ! That's what I meant by missing goodies :) Now here's a start of list, thank you. Actually most of those things are in .state now, but I believe this kind of wiring is what @AleBles meant, I am right ? |
@AleBles - Oh no wonder lol. |
@opulisDynamics - Oh I mean it just loads without errors.
Yeah I think so. I really haven't been able to try this out yet because of these odd problems, but I think I remember stumbling on these before so I stopped trying to make it work with my stuff since I couldn't understand what the problem was. |
Found it, was using the incorrect spine shader :P |
Hey bros, I'm trying out the build now. Which Spine version do I need to export with to make this work? The "Latest" Spine is v3.7.01-beta. Note: The current 3.4.02 exports don't work. I mean I can see transforms happening and stuff, but slot indexes can't be found (must be a different format or something), and the artwork is still jumbled.) I'm going to try re-exporting my animations and see if this works. |
Ok, I exported with 3.7.01-beta and it looks garbled right now. I see the general positioning of image parts is there, but it looks like textures are not mapped correctly. Remember that multipage atlas bug we fixed from before? It might be present here again, considering it wasn't fixed out of the box before. |
Ok, I resized my animation down to use only 1 atlas page. It looks like it worked at least. It looks like that's the culprit - broken multipage atlas support is back. EDIT 1:
I'm getting an array of [TextureAtlasPage, TextureAtlasPage], and it seems to recognize and get the different atlas pages. Now I need to see why it doesn't load them up onto the bone... EDIT 2:
I'm getting an array of regions that define the image, and the page. In the page object, it seems to know what texture atlas file to get from since the filename of the texture atlas where the image part is located is specified here.... PS: I'm using Canvas, not WebGL. Tested with WebGL and problem appears in both modes. EDIT 3: From my observations, despite knowing and referencing the other page atlases, it looks like it's still using the same atlas file. If I go to around line 9219:
and 9224:
It seems to load only the first image file associated with the atlas. I'll try but I don't know how to load up the other images defined in the atlas file... EDIT 4:
I looked at the TextureAtlasPage objects in the array, and into the texture object, and found that all their currentSrc property points to the first image! The textureAtlasPage.name is correct. EDIT 5: inside this function:
The problem appears to be it returns only the first image. |
Back to WebGL, there's a problem when using PNGs with translucent areas. Instead of blending in with the other image parts, they appear like fading to black. So if we have parts like the arm that we used a soft eraser on to meld with the body for example, instead of a smooth transition, we'd see a bruise of sort. |
Btw, which Spine version is this plugin supposed to handle? 3.7.01-beta or 3.5.01-beta? |
http://esotericsoftware.com/forum/Phaser-Spine-Making-Progress-In-Supporting-Spine-TS-9182 badlogic asking if maintainer can hit them up on contact -at- esotericsoftware.com Maybe they can assist in some of these bugs. |
So a couple of things:
|
1.) Ok, I'll try playing with this later. I tried exporting with and without premultipliedAlpha. Since I usually work with Canvas, I export with this disabled. |
I just went here: https://github.com/EsotericSoftware/spine-runtimes |
I'm posting some features in the WebGL version that I found not working or needs testing: [Spine TS] Rotation - Seems to work like the canvas version (rotates the root bone), needs to be checked. [Spine TS] Positioning - Proposed fix for canvas version. Need to be double checked. [Spine TS] x and y properties don't move the Spine Object - Canvas version ok. WebGL version broken. [Spine-TS] Scale property doesn't work - Canvas version ok. WebGL version broken. |
Are you guys experiencing these problems or is it just me? |
Nope same here, I was just on a holiday ;) |
ah no wonder. wb lol |
Hi there !
First things first, thank you so much for your work, this plugin is bananas.
Now, we needed WebGL support in one of our little Phaser games using Spine, and as we discovered this plugin doesn't handle it well so far: Scale and position weren't set and the whole rendering was flawed and invalidating regular Phaser object's rendering as well.
Putting a little work into the effort, I managed to make it :
The whole code changes aren't so heavy, but bit to much to post it here cleanly.
Would you still rather like a copy/paste or can I send a PR ?
And btw, I don't know how to PR a repo I'm not registered on, could you tell me how if you decide to go that way ?
EDIT: This is about the Spine-TS version on corresponding branch. So far I tested it with Phaser 2.8.3, and Spine 3.6.38.
Bye folks
The text was updated successfully, but these errors were encountered: