Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Spine/Spriter Animation with normalmapping included

Author
Message
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 15th May 2019 15:56 Edited at: 15th May 2019 15:57
Quick question for Spine or Spriter users:
Is there a way to include a normalmap to the Animation ? I think i saw some examples for Spine in another engine that could handle normalmapping. But does it work with AppGameKit ?
The shader isn't the problem here just if these programs can export two texture layer which AppGameKit can handle/switch between or something.
Bengismo
7
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 15th May 2019 19:12
Not in teir 1... Normal mapping isnt possible with skeletons as there is no way to acces the sprites used within the skeleton or a way to set the shader used on it.

In teir 2 you could iterate through each each of the sprites and assign a second image to stage 1 and a normal mapping shader which would work in theory. The standard loading functions only load a single image to be used on each bone. Normal mapping is not supported by default in agk sprites or skeletons without an additional shader as far as i know.
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 16th May 2019 09:22
Ok Im thinking about using a 2D deferred shader and just switching the whole animation between diffuse and normal rendering then.
Would be nice to get proper support through.
Bengismo
7
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 17th May 2019 12:08
As far as I know spriter doesnt support normal maps in its file format. Not sure about spine.

I used animated characters as 2d planes in 3d then you can load the model in AppGameKit and play the animations in agk and just set a normal map texture and it just works without needing anything complicated or even a special shader as 3d normal mapping IS supported. You can render the object to an image then display it on a sprite if wanted really easily and you have a fully normal mapped and skeleton animated sprite!

I'd agree that inbuilt 2d normal mapping might be nice but it is easy to do it with a shader.

I was playing with a 2d lighting system in agk that works nicely that can do point,directional and spot lights with varying falloffs and optional shadowing with an occlusion map etc and its really cool what effects you can get




janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 18th May 2019 15:50
Quote: "I'd agree that inbuilt 2D Normalmapping might be nice"

I was talking about proper layer/texture stage support for spriter or spine so we could access them with the texture sample in a shader, just like SetSpriteAdditionalImage.
It's not about whats easiest for ME to achive Normalmapping. I want it to work with Sprites ...with everything sprites offer to you in AppGameKit, including spine and spriter animations.
I have 3D Normalmapping, 2D Normalmapping (forward rendering), 2D normalmapping (deferred rendering) running years ago, I'm just researching whats the best way to go now.
And think I can get Spriter/Spine animations working with deferred rendering, now I need to find an easy way to switch the "texture stages".
Bengismo
7
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 18th May 2019 16:58 Edited at: 18th May 2019 17:01
Quote: "I was talking about proper layer/texture stage support for spriter or spine so we could access them with the texture sample in a shader, just like SetSpriteAdditionalImage."


As I said above there is no way to specifically set the image at any other texture stages on a skeleton in teir 1 in AGK. There's no way to set the shader used for drawing a skeleton either in teir 1.

Quote: "
I want it to work with Sprites ...with everything sprites offer to you in AppGameKit, including spine and spriter animations."


Unfortunately, Spine and spriter skeletons are not sprites in agk. They are "skeletons" and only accessible via the skeleton commands meaning no custom shaders and no setting of additional images. This is all possible in teir 2 as the internal sprites that make up the skeleton can be accessed directly so custom shaders and additional textures in other texture stages can be set.

Making the normal mapping shader is the easy bit.... actually applying it to a "skeleton" or setting additional images IS the hard bit as the commands are not there to do it on a skeleton in teir 1.

Maybe paul will add more commands but I dont see it being likely.

Like I said above, its possible to animate a character on 2d planes in 3d and then you have the commands to set shaders for object meshes well as setting additional images (normal maps) and shader constants in agk etc... So you can have a perfectly animated character with a normal map ....and lighting on your 2d character inside of agk in teir one. You can play animations too. You can render the 3d skeleton to a texture and apply that to sprite. I did that for a simple character and it worked but it was painful and having commands such as SetSkeletonShader() and SetSkeletonAdditionalImage() etc would be much much nicer.
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 19th May 2019 11:56 Edited at: 19th May 2019 11:58
Yeah alright
Thanks Bengismo.
Ill make it all work with spine/spriter skeletons in AppGameKit Tier 1 using deferred rendering.
I post my results here after i get home from Hospital
Wilf
Valued Member
18
Years of Service
User Offline
Joined: 1st Jun 2006
Location: Gone to Unity.
Posted: 19th May 2019 15:46
Ahem

BMW Spine Sprite Animation API: https://forum.thegamecreators.com/thread/221085

Adding the normal mapping to the sprites is indeed not the problem, it's replacing the internal AppGameKit spine images with sprites.
Bengismo
7
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 19th May 2019 18:23 Edited at: 19th May 2019 18:25
Great work! Aligning user controlled sprites over the top of an (invisible) skeleton is a nice workaround.

Its a shame to have to go to that much work and trouble (thats a fair bit of code!) just to be able to set shaders and custom images on a skeleton when a couple of extra commands in AppGameKit would fix it. Never the less, thats a neat solution
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 21st May 2019 08:08
@Wilf: Is your method faster, Performance wise, than just swapping the whole skeleton ?
I would need to make some tests to see if redundant skeletons or sprites are better/faster.
Thanks
Wilf
Valued Member
18
Years of Service
User Offline
Joined: 1st Jun 2006
Location: Gone to Unity.
Posted: 21st May 2019 15:52
Not sure what you mean by swapping the whole skeleton? I have functions that recreate AGKs bone and rotation commands but switch them off and use the internals for speed; never saw much of a difference anyway.

Before this I used a second skeleton with white images to flash op top briefly for hits etc. Doubling everything up was slow of course, which triggered this stuff

This API does use less memory as AGKs spine implementation loads the atlas image every time a spine file is loaded - there's no clone animation command. I load it into an image cache and re-use it when populating sprite skeletons that have the same animation file path.
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 21st May 2019 18:28
Yeah I took a look at it, and saw you guys created a whole new skeleton system basically.
I now just added a SetSkeleton2DShader() to AGK's source code and wanted to ask Rick/Paul if they can use it in the next update or something.
maybe they also take the SetTextShader() command I made some time ago...but I was to stupid to push it to github properly

I'm trying to expand the area where I can play with shaders in AGK.

Login to post a reply

Server time is: 2024-11-23 08:16:52
Your offset time is: 2024-11-23 08:16:52