Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - mrkake

Pages: [1]
1
Support / Fade out during tk2dSpriteAnimation ?
« on: November 16, 2015, 02:02:44 am »
I can't figure out how to do this easily.

I read a few other threads, and it seems fairly straight forward to get a sprite to fade out, lets just say set the alpha to 50% to be simple:

just on the tk2dsprite:
Color color = sprite.color;
color.a = newAlpha; // calculated elsewhere
sprite.color = color;

This actually works fine, the problem is, that during tk2dSpriteAnimation, every time the frame changes, the material is reset. Additionally the material is somewhere cached and every instance of the animation fades out at the same rate.

Even if I just run the fade out code on a single animation, every instance of that animation which is playing starts to fade out.

Is it possible to get a method to do a fadeout? Basically, I want to specific the start % and end % of the fadeout.  i.e.  start fading out 80% of the way through the animation and finish fading out 100% of the way through the animation.

I know that I can get my code working if I created a new material for every frame (and for every instance) of the animation and reset the material whenever SpriteChanged event fires. However, this is a LOT of materials when we are talking about the types of effects I want to fade out.

The other argument could be that the fade should be in the animation itself. This is the next step if its really not possible in the code. However, Currently, I have one really big animation, for example a giant explosion. What I would really love to be able to do is have small and large explosions all using the same sprite sequence. Then, what I can say is "play from this frame to that frame" with a fade starting at a certain percentage... if this worked, I could use a single actual animation (sprite sheet) , and create many many many different animations.

Anyway, I don't think it's currently possible in 2d toolkit. But please let me know if it is or any thoughts?

Thanks!

2
Hi,

I am hoping to find some ideas how to approach the following problem.
We are working on a game which takes place on the water.

For example a boat, and when in the water, about 1/3rd of the bottom of the sprite has a transparent blue color over it to make it appear the boat is in water.
Currently, we drew this in the sprite itself, but its quite tedious as there are multiple rotations for each sprite and there are many other sprites which can be in water.

Ideally, I would like to somehow apply automatically the "blue" over the sprite depending if the item is in water or not, and additionally, would like to create a bopping effect for idle animation, which means the blue percentage shift up and down a few pixels each 1/2 second or something like this.

At first I thought this could be solved by just creating a square blue , putting on the layer above the sprite and setting the alpha channel to make it slightly transparent but the problem is that the area of water surrounding also obviously gets this rectangle of blueness on it. Ideally, I can somehow disable the pixels in the blue square when there is not a target sprite below the pixel. Is there some way to achieve this effect?  Or a different approach entirely.

Thanks

3
Support / Which shaders are NOT vertex lit / fixed function?
« on: February 25, 2015, 04:45:06 am »
Sorry if this is an amateur question, but I really don't understand the names and differences between the shaders terminology at all.

I am trying to run a game I created with 2d toolkit on the wii u, and its crashing, when i checked the error log and for help on the official forums, the reason is because vertex lit and fixed function shaders are not supported currently with unity games.

I can see the 2d toolkit had a lot of different shaders in the tk2d menu, and that unity itself also comes with a lot of shaders. But, I don't particularly want to brute force try them all (though i can if it comes to this) since I will have to change the shader on every texture/sprite.

I am wondering, which textures are NOT vertex lit and NOT fixed function? Also GLSL shaders are not supported, whatever that means. So I need a shader which is not one of these three. Is one already in unity or tk2d? Or any ideas how I could obtain one? And is there any way I could have known this without asking? And if its not too in depth to give a high level overview, what does "fixed function" even mean in terms of a shader? (vertex lit i kind of understand)

thanks so much


edit:  also i'm using tilemap, and regular 2d toolkit sprite renderers on prefabs combined.  i'm wondering if the tilemap is respecting the shader on the material attached to its sprite collection?  no matter what i pick i am getting errors running on the console about unsupported vertex shaders. i have picked "diffuse" "transparent\diffuse",  neither of these work but i feel they should.  tk2d\blend2vertexshader definitely does not work. sprites\diffuse also definetely does not work. any ideas greatly appreciated

Pages: [1]