x


How to make a particle system with different particles for each emit?

Hello,

I have texture atlas in which there are several frames of animation. I'd like to make a particle emitter that for each emitted particle would pick one frame from this atlas and use that as the particle texture. I do NOT want the particle to animate its appearance over its lifetime (like it would if I used the UV animation properties on the Particle Renderer component), just have a different frame on each emitted particle.

I tried attaching a script and modifying the material texture offset on each call to Update() but this of course changes the appearance of all emitted particles, which again is not what I want.

I guess what I'd really want is a way to access the texture offsets of an already emitted particle (so I could just change them on the "newest" particle every frame). I know I can access all the particles that the emitter has emitted via the particles array in the ParticleEmitter class, but the Particle class does not seem to provide a way to access the texture offsets.

Any ideas how I could accomplish this with the standard particle components? I'd really prefer not to write an ad hoc particle emitter just for this.

I'm doing this for the IPhone, so performance is premium.

Thanks in advance.

more ▼

asked May 13 '10 at 10:41 AM

Soiha gravatar image

Soiha
17 1 1 1

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

All the particles in a system will read from the same material. You've probably noticed that objects that share a material will all be affected by the material's properties, including offset. Therefore, you will most likely need to have separate emitters with different materials attached to each one.

more ▼

answered Jun 16 '10 at 09:58 PM

JonManatee gravatar image

JonManatee
251 7 8 18

A common technique is for each particle to randomly pick a tile in the atlas. In order to achieve this we need to be able to set the uv coordinates of each particle to a random index in the texture atlas. We don't need to assign a new material for each particle and we don't need to modify the material assigned to the particle system either. Unfortunately I can't find a way to access the uv index of the particle through the particle class either. This would be good. Alternatively just having a 'pick random start frame' checkbox in the particle renderer would be even easier

Feb 04 '12 at 09:38 AM ivanp
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x5093
x2001
x642

asked: May 13 '10 at 10:41 AM

Seen: 2057 times

Last Updated: Feb 04 '12 at 09:38 AM