Home Technical Talk

Animating fading out objects for game engines

greentooth
Offline / Send Message
MrNinjutsu greentooth
Hi, i'm animating a mole, he's sleeping. The zeds coming from his mouth following a spline path constraint to above his head. The problem being is that well they don't fade out in Unity. I was wondering if anybody had any tips and the know-how on this subject. Any help will be greatly appreciated!

In advance sorry if the quality of the video is bad. The issue seen (albeit not greatly due to the video) is the dragging of the z's after reaching the top :S

[ame="http://www.youtube.com/watch?v=Q0TRJp8z7MY"]Sleeping Mole Animation Test Unity3D - YouTube[/ame]

edit: thanks monster for the embed tip :)

Also I'm using 3ds max for the animation.

Replies

  • monster
    Options
    Offline / Send Message
    monster polycounter
    To embed the video from YouTube you just need to paste the long link, and not the short link.
    Short Link:
    http://youtu.be/Q0TRJp8z7MY
    
    Long Link:
    http://www.youtube.com/watch?v=Q0TRJp8z7MY
    
    

    [ame="http://www.youtube.com/watch?v=Q0TRJp8z7MY"]Sleeping Mole Animation Test Unity3D - YouTube[/ame]
  • MrNinjutsu
    Options
    Offline / Send Message
    MrNinjutsu greentooth
    Thanks for that monster! Didn't think it would be that easy to embed.
  • Brendan
    Options
    Offline / Send Message
    Brendan polycounter lvl 8
    That looks like Unity!

    Here are some options:

    EDIT - It was material.color.a
    material.color.a (or similar) can be scripted. Attach a script to the emitter or something, and fade it.
    So:
    instantiate (Z prefab, which is a plane - NOT the Unity plane with 200 tris - with texture and shader with transparency)
    ....time.deltatime (delaying code, etc etc etc)
    ........material.color.a (fade to 0).
    ............if shader.fuckup = true
    ...................destroy (Z prefab)
    ............else
    ...................destroy it anyway (after the time)


    Or, you could do it the right way, and use particle emitters and since it's a simple movement, try this:

    (you will need a:
    Particle Emitter (ellipsoid/mesh)
    Particle animator (otherwise they don't do squat)
    Particle Renderer)

    particle emitter (ellipsoid)
    particle size (initial size you want)
    emissions (3 or 4)
    Energy (1-2 or something)
    simulate in worldspace (no)
    world velocity
    x 2
    y 3
    z 0
    force
    x -2
    y 1
    z 0
    (the x velocity will make it go left at the start, then the x force will make it bend right after a bit - play with these. The y velocity and force will make it go up and increase in speed just enough so they separate when they expand)
    size grow (0.1)
    animate colours (yes)
    colour
    white 100%a
    white 100%a
    white 100%a
    white 100%a
    black 0%a

    Particle sorting (billboard (shouldn't need to be sorted, they don't overlap and additive usually plays ball)
    Max particle size (2) - this lets the particles get bigger as you get close, but not too big they look bad

    Material
    Particle: Additive
    (tint - leave white)
    (texture)
  • MrNinjutsu
    Options
    Offline / Send Message
    MrNinjutsu greentooth
    Brendan wrote: »
    That looks like Unity!

    Here are some options:

    EDIT - It was material.color.a
    material.color.a (or similar) can be scripted. Attach a script to the emitter or something, and fade it.
    So:
    instantiate (Z prefab, which is a plane - NOT the Unity plane with 200 tris - with texture and shader with transparency)
    ....time.deltatime (delaying code, etc etc etc)
    ........material.color.a (fade to 0).
    ............if shader.fuckup = true
    ...................destroy (Z prefab)
    ............else
    ...................destroy it anyway (after the time)


    Or, you could do it the right way, and use particle emitters and since it's a simple movement, try this:

    (you will need a:
    Particle Emitter (ellipsoid/mesh)
    Particle animator (otherwise they don't do squat)
    Particle Renderer)

    particle emitter (ellipsoid)
    particle size (initial size you want)
    emissions (3 or 4)
    Energy (1-2 or something)
    simulate in worldspace (no)
    world velocity
    x 2
    y 3
    z 0
    force
    x -2
    y 1
    z 0
    (the x velocity will make it go left at the start, then the x force will make it bend right after a bit - play with these. The y velocity and force will make it go up and increase in speed just enough so they separate when they expand)
    size grow (0.1)
    animate colours (yes)
    colour
    white 100%a
    white 100%a
    white 100%a
    white 100%a
    black 0%a

    Particle sorting (billboard (shouldn't need to be sorted, they don't overlap and additive usually plays ball)
    Max particle size (2) - this lets the particles get bigger as you get close, but not too big they look bad

    Material
    Particle: Additive
    (tint - leave white)
    (texture)

    Thank you so much for the help! I'll definitely try this out. At the moment i have to animate the mole parachuting in paratrooper style! :D So i'll update and try that out when i'm finished with this animation. Once again thanks bud! :thumbup:
  • Brendan
    Options
    Offline / Send Message
    Brendan polycounter lvl 8
    Dude, Unity is the only physX-related thing that doesn't suck and/or suck the life from your CPU.

    Just apply a rigidbody and a collider to the mole, and push it out of a plane.

    Then make a parachute, apply another rigidbody and collider, and crank the drag way up. It might stay right-side up, who knows.
  • MrNinjutsu
    Options
    Offline / Send Message
    MrNinjutsu greentooth
    Thanks for the help, here's the progress so far...

    [ame="http://www.youtube.com/watch?v=s0OiL_h0P3A"]Unity3D sleep particle effect & paratrooper mole - YouTube[/ame]

    I think if i tweak this some more it will look better. The paratrooper isn't finished as i havent finished the animation and texture, for the texture, i've used a modified Toonshader to allow alpha transparency and backfacing, although the culling is a bit dodgy. Not too sure why.
  • Brendan
    Options
    Offline / Send Message
    Brendan polycounter lvl 8
    Personally, I'd up the min and max particle sizes., decrease the y velocity (maybe half?), and increase both the x velocity and x force (again, by half).

    Then I think maybe make the ellipsiod range smaller (the bottom part of the ellipsoid emitter bit, there is a range thing, should default to 1/1/1 and min range 0. Try .2/.2/.2, min .1


    Backfacing with Unity's toon shader can be a bit dodgy. It has hard edges when it should have soft edges, and has a continuous outline where it should have a break. I's basically the Paul Walker of the shader world. Just copy the faces and flip normals in your 3d program, at least then you can pretend to be a Vin Diesel.

    EDIT: if you need a toon-like appearance and don't need the outline, but want some alpha blending, try Transparent > Cutout > Soft Edge Unlit. Mess with the slider, it should be easy to figure out what it does. It's also got backfacing, too/
Sign In or Register to comment.