Author Topic: NGUI as a particle engine?  (Read 9195 times)

ENAY

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 248
    • View Profile
NGUI as a particle engine?
« on: May 14, 2012, 11:30:20 PM »
NGUI, as the name suggest is a Unity plugin that allows the user to quickly and easily make menus.

But is it suitable (for example) spawning particles and doing things with sprites that has no connection with menus?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 307
  • -Receive: 1144
  • Posts: 21,985
  • Toronto, Canada
    • View Profile
Re: NGUI as a particle engine?
« Reply #1 on: May 15, 2012, 01:14:07 PM »
You could, theoretically, set up a copy material that will use only a part of the atlas texture (the sprite), and use that material for a particle system... but right now you'll need to specify the UV offset on the material yourself. It's certainly doable though.

Drexster

  • Guest
Re: NGUI as a particle engine?
« Reply #2 on: May 15, 2012, 03:30:23 PM »
Enay,

I'm currently using NGUI to do draw all my particles and effects in my game and it works very well.
It's great because I could literally fill the screen with thousands of particles and it would still only cost 1 draw call!

An issues to consider is depth sorting. You'll need multiple panels depending on if you want you particles to appear in front of or behind objects. My scene is fairly static (arcade board game) so I got away with only using 3 panels, 1 for front, 1 back, and 1 for UI. The other is the number of atlases you may end up needing to use, based on your material type requirements.

ENAY

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 248
    • View Profile
Re: NGUI as a particle engine?
« Reply #3 on: May 15, 2012, 11:40:18 PM »
Right now our game is using another library tk2d for the certain particle effects within the game. Just wondered if the author himself considered his engine to be particle worthy. Right now I think it will be a mix and match, but due to the awesomeness of NGUI we will certainly look into using NGUI for everything particle/sprite/menu etc related.

As you Drexster have already achieved something, that is certainly reassuring and also promising too. :)

getluky

  • Guest
Re: NGUI as a particle engine?
« Reply #4 on: May 17, 2012, 06:05:13 PM »
The only thing I've had to do to make NGUI work with in-game sprites is modify it slightly to make a timeScale-conforming version of ActiveAnimation to make sure it doesn't keep playing when the game is paused. Other than that, it's been perfect for full-frame damage overlays, etc.

Zophiel

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 54
    • View Profile
Re: NGUI as a particle engine?
« Reply #5 on: August 05, 2012, 09:35:21 AM »
Any chance you lads could explain a bit more in depth how to setup particle systems with NGUI? I'd like to reduce my draw calls further.

Zophiel

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 54
    • View Profile
Re: NGUI as a particle engine?
« Reply #6 on: August 08, 2012, 04:36:32 PM »
Bump

ENAY

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 248
    • View Profile
Re: NGUI as a particle engine?
« Reply #7 on: August 09, 2012, 03:47:08 AM »
That is an incredible wide question as there are many ways to make particles. The Unity particle system requires a drawcall per particle but remember those are contained within the scene's 3D space.
Making one in NGUI would just put a particle system that goes over the top of your game and I would make one by writing all the code and then just grabbing the particular particle's image from an atlas and keeping track of your world coordinates manually within the same class (in 2D)

If you have no idea what I am talking about then you are probably better off just using Unity's particle system since it is a lot easier to do.

Unless anyone else has any other better ideas. But from your post you said "setup particle systems" and not "write" so I presume you are looking for a NGUI particle system solution which as far as I know, there isn't one.

Zophiel

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 54
    • View Profile
Re: NGUI as a particle engine?
« Reply #8 on: August 09, 2012, 05:55:22 AM »
I was secretly hoping to be able to use prefabs/geometry as particles. I used SpriteManager sprites prior. Since NGUI seems to be all the rage and i've since ported my UI over, i wanted to do the same and just use 1 system for what I need, reducing drawcalls even further.

Right now i'm thinking of taking the UISprite as a base and writing a 3DSprite that's simply rendered in 3D space with all the draw methods and animation controls from NGUI. Drexster suggested to just render the entire particle animation ( think a bunch of coins flying about ) to a sprite and spawning it where i want it.