Hey Was playing around with the sparks effects from the jig explosion, and a i realized they're not "true" sparks. So i wanted to create a shotgun weapon, which I already know how to do, but the way I want the strings to interact is (afaik) not used anywhere in PA, to make them look like lighting bolts. I saw the flipBook parameter, it looks to me like that cycles through different bolts randomly which gives the perception of lightning or sparks, so i came to a conclusion that this would not be able to help me create a string particle with random motions that act like a lightning bolt for a shotgun. Take these from Ratchet and Clank (if you ever are looking for inspiration for this kind of stuff, check this out) as examples any ideas?
This question is actually really similar to something I wanted to ask. It sounds to me like we need some way to control an individual particle's offset or velocity over time. For this particular case though I can think of a way to implement this in a bit of a hack way. If the projectile is a straight line projectile, then you can have a multiple particle emitters like so (this is psuedo code because I am not home right now xD): Code: [ { "spec" : { "name" : "particle_transparent", "shape" : "string", "blue" : 10, "red" : 1, "green" : 1, "ramp stuff" : "goes here" }, "this stuff will be the same in all emitters, not repeated" : "because lazy lol", "offsetRangeX" : 10, "offsetRangeZ" : 10, "emitterRate" : 20, "emitterLifetime" : 2, "lifetime" : 0.2, "useGlobalSpace" : "or what ever it's called", "this stuff" : "does change though", "delay" : 0 }, { "offsetY" : "- speed of projectile * delay;", "delay" : 0.2 }, { "offsetY" : "- speed of projectile * delay;", "delay" : 0.4 }, { "offsetY" : "- speed of projectile * delay;", "delay" : 0.6 }, { "offsetY" : "- speed of projectile * delay;", "delay" : 0.8 }, { "offsetY" : "- speed of projectile * delay;", "delay" : 1 }, { "offsetY" : "- speed of projectile * delay;", "delay" : 1.2 }, { "offsetY" : "- speed of projectile * delay;", "delay" : 1.4 }, { "offsetY" : "- speed of projectile * delay;", "delay" : 1.6 }, { "offsetY" : "- speed of projectile * delay;", "delay" : 1.8 }, ] EDIT: Just wanted to note that this is just an idea, lol. I may be wrong. To clarify though, the idea is that you have a series of emitters which are delayed but then produce particles which are displaced back from the projectile's current location.
Spitting Hydra, upgraded to Tempest on Qwark's hideout in the Thran Asteroid Belt. Can you tell I really like Ratchet & Clank?
I just used the keys array, this was the final code block for the string emitter Code: { "emitters": [ { "spec": { "shader": "particle_transparent", "shape": "string", "size": { "keys": [ [ 0, 1 ], [ 0.06, 0.5 ], [ 0.2, 0.25 ], [ 0.8, 0.2 ], [ 1, 0 ] ], "stepped": false }, "alpha": 1, "baseTexture": "/pa/effects/textures/particles/flat.papa", "rampTexture": "/pa/effects/textures/particles/uncompressed/no_ramp.papa", "dataChannelFormat": "PositionAndColor" }, "offsetX": { "keys": [ [ 0, 1 ], [ 0.75, 0.5 ], [ 1.25, 0.25 ], [ 2, 2 ] ], "stepped":true }, "offsetY": { "keys": [ [ 0, 0.5 ], [ 0.75, 1 ], [ 1.25, 0.675231 ], [ 2, 0.542176 ] ], "stepped":true }, "offsetZ": { "keys": [ [ 0, 0.321 ], [ 0.75, 0.74832 ], [ 1.25, 2 ], [ 2, 1 ] ], "stepped":true }, "alpha": { "keys": [ [ 0, 0 ], [ 0.2, 1 ] ], "stepped": false }, "red": 1, "green": 1, "blue": 5, "offsetRangeX": 2, "offsetRangeY": 2, "offsetRangeZ": 2, "velocityRangeX": 1, "velocityRangeY": 1, "velocityRangeZ": 1, "velocity": 0.25, "velocityRange": 0.2, "sizeX": 2, "rampV": 0.01, "emissionRate": 60, "lifetime": 2, "emitterLifetime": 2, "maxParticles": 120, "useWorldSpace": true, "endDistance": 2000 } ] } AND IT WORKS MUHAUHAUHAUHAUAHAA I AM ZEUS and the emperor
The ROF is 1, it shoots every second I think. If your wondering how the string is so random, that is controlled by the X Y and Z range. I'm actually not sure why it cuts like that so many times though.
incompatible types - found .jpg but expected .gif I require an understanding of how this works, I never understood "keys" in the effect files, simple explanation for drunk burntcustard plz?
I understand those parameters, and I used them myself previously, but what I want to know is if each bolt's particles change position over time.... i.e. Code: Frame 1: ___ _ __/ \/ Frame 2: __ ___ \_/\/\/ Where both of these bolts are from the same projectile. By the looks of it, you produce randomly offset particles as the projectile moves and then each particle also gets a random velocity, but they do not actually flicker over to another position.
I don't know exactly why this happens but @bgolus should know. It must have something to do with the velocity range.
I know how the random velocity works. What I wanted to implement with my initial post is what looks like an arc of electricity rapidly changing from one configuration to another. In other words, each corner of the bolt will not move, but teleport to another nearby random location, and then teleport to another. Kinda how the sparks of the above image jump around, they don't just appear in one configuration and then slowly deform.
Oh That's because the key frames choose the time for the string to move. In real lightning, if you were to get a time lapse, the first part of the bolt would move out of the cloude for a few nanoseconds, this is basically the first parameter in a key array. The second parameter in a key array controls the offset, which is also randomized to the maximum degree of 2. Then, the next array inside the keys array is another time frame and location frame for the next bolt. It's like a bullet moving in the shape of lightning leaving a trail behind. I hope that's what you're talking about.
Heh, not quite xD. Okay, when you have a key array inside the "spec" part, those parameters animate the properties of each emitted particle. So if you had Code: { "spec" : { "red" : [[0,1], [1,0] }, "blue" : [[0,1], [0.5, 0], [1,1]] } Because the keyed values for red is inside spec, each particle will go from being colored full red to having no red. The blue values will behave differently though. Those values are applied to the emitter itself, so the moment it generates a particle it will get the color from that array at what ever time in the emitters life time we are currently at. So at time zero a particle will get full blue color (but unlike the red property, it will stay that way for the entire lifetime of that particle). Subsequent particles will get less blue, until we are halfway through, then get more blue later. Does this make sense so far? Anyhow, this may seem irrelevant, but I bring it up because at the moment I have not been able to animate the offset or velocity of a particle in the same way you can like the color red (other than using velocity, drag and gravity). What is happening with your effect though is that you are spawning 60 particles each second. The moment the particle is emitted it gets given an initial X, Y and Z offset (based on the current time), then the parameters "offsetRangeX,Y,Z" : 2 add some random amount to that offset (i.e. it is a uniform distribution to randomise that parameter by about 2). And of course each particle gets a random velocity as well.
I managed to get a bit of a sparkly effect going: http://gfycat.com/ElegantCrazyAlpaca Still, not exactly what I wanted to make :/ Oh, and here is the code I used to generate the effects: Code: import json base = json.loads( '''{ "spec": { "shader": "particle_transparent", "shape": "string", "size": [[0, 1 ], [0.06, 0.5], [0.2, 0.25], [0.8, 0.2], [1, 0]], "baseTexture": "/pa/effects/textures/particles/flat.papa", "rampTexture": "/pa/effects/textures/particles/uncompressed/no_ramp.papa", "dataChannelFormat": "PositionAndColor" }, "red": 1, "green": 1, "blue": 5, "velocityRange" : 5, "drag" : 1.1, "offsetRangeX": 2, "offsetRangeY": 2, "offsetRangeZ": 2, "sizeX": 2, "rampV": 0.01, "emissionRate": 60, "lifetime": 1, "emitterLifetime": 2, "maxParticles": 120, "useWorldSpace": true, "endDistance": 2000, "bLoop" : true }''' ) time = 1 trails = 20 str = '{"emitters":[' base['spec']['alpha'] = {'keys':[[0,1], [float(time) / trails, 0]], 'stepped': True} str += json.dumps(base) + ',\n' for i in xrange(trails): delay = i * float(time) / trails base['spec']['alpha'] = {'keys':[[0,0], [delay, 1], [delay + float(time) / trails, 0]], 'stepped': True} str += json.dumps(base) + ',\n' str = str[:-2] + ']}' print str Put that in your python interpreter and smoke it!
Oh damn that looks awesome. Good work with that. That would go well with this model that I did a while ago .