Gaming Your Way

May contain nuts.

Unity Plasma effect

Hey my beauties. Sorry I've been ignoring you all, I've just been pretty ill the past week or so ( I was going to say I've been sick, but I used that joke up last post ). It's me not you, honestly.

Just a short post to go with a small experiment. I've done the plasma effect to death in Flash but it's a nice little effect to play with when trying out a new language so I thought I'd see how straight forward it would be to port to Unity.

The answer is... fairly. If nothing else I've discovered that for...in is nasty slow in Unity ( All these new coding caveats to learn, joy ).

Anyway I still feel like crap, so I'm going to cut this short. The effect is hiding behind this link and it's really nothing special, I just wanted to show something after being away for a week or so. If anyone would like the source just ask in the comments.

Squize.

PS. I'm so sorry to everyone I owe an email too, I will catch up, and let's be honest you should know how crap I am by now.

Comments (4) -

  • Jeff Fulton

    4/7/2009 3:25:08 PM |

    That 3D effect is a pretty nice piece of Zarjaz. I hope you are feeling better (and giving yourself time to play with Unity will probably help).

  • Squize

    4/7/2009 7:36:34 PM |

    Thanks mate. I'm slowly getting back up to speed, so hopefully I can stop being Mr. Shit-Friend and catch up with everyone ( I mean I even missed the chance to gloat about my boys beating spurs the w/end )

  • Aras Pranckevicius

    4/29/2009 6:53:11 PM |

    Not sure how you did it, but some random ideas: setting a whole array of pixels (SetPixels) is way faster than setting each individually. If you don't need mipmaps, create a texture without them. The rest for plasma is just common math optimizations: move everything that can be moved out of loops; maybe it makes sense to replace any trig with lookup tables; etc.

    ...or, heck, do a plasma in a pixel shader :)

  • Squize

    4/29/2009 7:27:34 PM |

    Thanks for the tips mate. It's pretty much a brute force ported version from the actionscript code, so there's nothing really Unity specific ( Such as SetPixels, which I did try but gave up on after around 10 mins of having no joy. I don't mind admitting I'm a U3D lamer ).

    It's interesting that look-up tables are quicker, for some unknown reason the Maths classes in Flash are always quicker than using a look-up, so it's not something I've thought about since coding on the Amiga ( All these new optimisations to get my head around again :) ).
    I did notice that for...in was surprisingly slow, although I did just tear through porting it just to get something up and running so I could have been doing something dumb.

    As to shaders... I've got more than enough to get my head around ;)

Comments are closed