Jump to content

Animation for normal map in C2 going out of sync


CMJon

Recommended Posts

Hi,

 

I am using 2 Spriter animations for dynamic lighting in Construct 2.

 

These Spriter animations are exactly the same, except one is made of normal maps (purple and blue textures).

In C2 they are set up to have the same animation triggers and the normal map is on a layer above the regular character

 

I am able to get the dynamic lighting working well by syncing the normal map  (normalmap) onto the regular animation (character) in C2, both the following work:

 

*Every tick = normalmap - set current time in Animation to character.timeRatio

 

*Every tick = normalmap - set current time in Animation to character.time millisecond

 

But sometimes, randomly when changing animations, both these ways to syncing the animations fail and the normalmap is visable over the character for a few frames before it re-syncs

 

It is almost totally random when this happens, most of the time it syncs and works perfectly, maybe one in ten or twenty times when switching animations the sync fails.

Is there anyway to lock these two Spriter animations together in a perfect sync?

 

Another way to look at this is that I need 2 Spriter animations to run perfectly ontop of each other, switching between animations, never losing syncronisation.

They need to be seperate Spriter files, as one needs to be on a different layer for the normal map shader effect.

 

I would really appriciate any help.

Thank you!

Link to comment
Share on other sites

Why are you creating two animations, when the only difference is the normal map?

 

There are various ways to achieve dynamic lighting with Spriter.

 

Instead of creating a new animation with normal maps, why you do not use character maps, and render the animation once with the sprites and once with the normal maps? You could calculate the animation render the sprites, switch the character map and render it again. This way you save CPU time, since you only need to calculate one animation.

 

I really don't know how C2's rendering pipeline and your dynamic lighting works in detail, but another way would be to pass the normal map for each rendered sprite to the shader and do the dynamic lighting. Is your lighting based on deferred rendering? If so, you could simply go with the way I described before.

 

- Trixt0r

Link to comment
Share on other sites

Hi Trixt0r,

 

Thanks for the suggestions, I'm using this plugin for C2  dynamic lighting.

The shader effect is set up on the layer with the (normalmap) animation on, (character) on a regular layer below.

 

The way I've set up works most the time without a problem and memory useage isn't an issue (PC game with low memory overheads anyway), it's almost perfect for what I need.

 

I just need a way to sync up 2 Spriter animations without there ever being any delay, or someway to totally lock the timings together.

Link to comment
Share on other sites

Hi CMJon,

 

I'd have to see the capx to know for sure, but the event "*Every tick = normalmap - set current time in Animation to character.timeRatio" seems strange to me...

 

The current time of the normal map object should be set to always equal the characters current time... so, you should only need one event, having nothing to do with the characters time ratio.

 

It should read "*Every tick = normalmap - set current time in Animation to character.time milliseconds"

 

I could be wrong. Feel free to email me the capx and I can take a look. (mike@brashmonkey.com)

Link to comment
Share on other sites

@BrashAdmin,

 

Thank you, I found a bug caused by how I was transitioning between animations. "*Every tick = normalmap - set current time in Animation to character.time milliseconds"

did the job perfectly and now it's all working well.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...