Various particle emitter questions

Various particle emitter questions

Postby TrabantDeLuxe » Tue Aug 02, 2016 9:05 pm

Hello,

It's me again. I've noted that - at least on my system - there seems to be an alpha sorting issue with the particle emitters. Is this just my install or is this a known bug?

Furthermore, I've wondered what lua control is available with particle emitters. I know of:

Code: Select all
Call( "Emitter:SetEmitterActive", argument );

Where the argument is 1 for on, and 0 for off.

Code: Select all
Call( "Emitter:SetEmitterRate", argument );

Where the argument is the desired emitter rate, being the inverse of particles released (per second?). Anyway, low number is lots of particles. I've seen this being used to turn particle emitters of, by setting a rate of 10000.0 - so practically none. What is the reasoning behind this? Wouldnt it be easier to just turn the emitter off completely?

Code: Select all
Call( "Emitter:SetInitialVelocityMultiplier", argument );

Where the argument is a multiplyer of the initial velocity vector as specified in the particle blueprint. I've used this to some effect to generate a exhaust blast effect.

Code: Select all
Call( "Emitter:SetEmitterColour", r, g, b, a );

Sets the RGBA colour of the emitter. This applies as a sort of global multiplier on the initial, mid and final colour. Control over the individual colours is impossible afaik.

These are all I've found by going over various topics and docs on the interweb. Are there any I'm missing? I'd love control over the width and lifetime of the particles.
TrabantDeLuxe
Passed Fireman
 
Posts: 247
Images: 7
Joined: Mon Mar 21, 2016 10:10 pm
Location: Delft, NL
Has thanked: 176 times
Been thanked: 263 times

Re: Various particle emitter questions

Postby cjbarnes5294 » Tue Aug 02, 2016 11:45 pm

It's me again. I've noted that - at least on my system - there seems to be an alpha sorting issue with the particle emitters. Is this just my install or is this a known bug?


I'm guessing you're referring to the problem where the particles are stacked from youngest at the back to oldest at the front of the screen, no matter where the particle is in space? If so, then yep, it's a bug. :(

Code: Select all
Call( "Emitter:SetEmitterActive", argument );

Where the argument is 1 for on, and 0 for off.

Code: Select all
Call( "Emitter:SetEmitterRate", argument );

Where the argument is the desired emitter rate, being the inverse of particles released (per second?). Anyway, low number is lots of particles. I've seen this being used to turn particle emitters of, by setting a rate of 10000.0 - so practically none. What is the reasoning behind this? Wouldnt it be easier to just turn the emitter off completely?


If the emitter is named Main Smoke Stack then it is hard locked by the internal code to emit in time with the chuff sounds, and SetEmitterActive won't work on it, so the trick was to reduce the rate of emission to practically nil as you have already observed. I don't recommend doing that though, as after a short period of the rate being so low, as soon as the script changes it back to a high emission rate it likes to throw out a clump of particles all at once, and once that clump has decayed it will emit normally again. This clump not only looks unsightly but it has a performance impact as it probably contains all of the hundreds if not thousands of particles all piled on top of one another at once.

Models with scripted driving wheel animation and adhesion physics require the chuff sound timing to also be scripted if it is to stay in sync, so in those cases you might as well script the visible chuff of steam and smoke too, but if you just wanted a relatively simple loco set up to use the core adhesion and chuff sound audio blueprints, and thus want the particles to stay in sync with the chuff sounds set by the game core as is done with Main Smoke Stack, you can do that quite easily: simply make a dummy particle blueprint for Main Smoke Stack with a completely alpha'd out texture (or just any texture with the alpha set to 0 for all three colour settings), then use GetEmitterActive to probe when the Main Smoke Stack is emitting (when a chuff beat is occurring), and turn your custom exhaust particle on or off in time with it using SetEmitterActive. No need to touch SetEmitterRate now, because you can have full control over whether your custom-named exhaust emitter should be exhausting or not, and leave the Main Smoke Stack emitter to mind its own business happily chuffing away to itself, invisibly.

Code: Select all
Call( "Emitter:SetInitialVelocityMultiplier", argument );

Where the argument is a multiplyer of the initial velocity vector as specified in the particle blueprint. I've used this to some effect to generate a exhaust blast effect.

Code: Select all
Call( "Emitter:SetEmitterColour", r, g, b, a );

Sets the RGBA colour of the emitter. This applies as a sort of global multiplier on the initial, mid and final colour. Control over the individual colours is impossible afaik.


There is GetEmitterActive as already mentioned, and GetEmitterRate, but otherwise I think you've got them all. SetEmitterColour with just three arguments (RGB) is also valid if you don't want to modify the alpha.

I'd love control over the width and lifetime of the particles.


Sadly we're restricted to setting those aspects in the blueprint only, as far as I know. To get controlled changing width and lifetimes, you have to resort to making creative use out of multiple particles, but be careful not to add too many particles. In my experience, you can add a fair few emitters to a single locomotive (I think the JT BR Standards I worked on have around 80-90 of them), but if you do that you have to be strict with the max number of particles defined in each blueprint otherwise it is likely to temp dump the game. 3000 for chimney exhausts that might want to last a bit longer, 800 for cylinder cock blasts and other fairly large secondary effects, 200-500 for leaks and small extras, these are some figures I would suggest trying if you fancy going mad with the number of individual particles. :D

Kind regards,
Chris
The Red Queen Hypothesis, applicable to train sim development?

"Here, you see, it takes all of the running you can do, to keep the same place."
cjbarnes5294
Driver
 
Posts: 398
Images: 82
Joined: Mon Mar 31, 2014 12:40 pm
Location: Gloucestershire/North Yorkshire
Has thanked: 551 times
Been thanked: 187 times

Re: Various particle emitter questions

Postby TrabantDeLuxe » Thu Aug 04, 2016 9:25 pm

Thanks a lot - I suspected a bug already, knowing the software. I am a bit amazed at the FPS drop that can be caused be a single emitter, but not really sure what parameters mainley affect it. About the number of particles, the way I understand it is that when that number is exceeded, TS simply shuts of the emitter? So basically you want to ensure that ParticlesPerSecond * Lifetime < NumberofParticles.

Also, 80 emitters :O! I'd run out of creative names after about 10.
TrabantDeLuxe
Passed Fireman
 
Posts: 247
Images: 7
Joined: Mon Mar 21, 2016 10:10 pm
Location: Delft, NL
Has thanked: 176 times
Been thanked: 263 times

Re: Various particle emitter questions

Postby cjbarnes5294 » Thu Aug 04, 2016 9:42 pm

TrabantDeLuxe wrote:About the number of particles, the way I understand it is that when that number is exceeded, TS simply shuts of the emitter? So basically you want to ensure that ParticlesPerSecond * Lifetime < NumberofParticles.


Yep and yep. And it's not just the emitter's own particle count that when exceeded stops the emitter, it is effected by all of the other particles in the vicinity as well, although I must admit that I don't know how that works exactly. It's a very fine line getting the right balance between enough particles so that you never get unwanted, ugly pauses in the emitter, and not having so many as to risk crippling the game by running out of memory.

TrabantDeLuxe wrote:Also, 80 emitters :O! I'd run out of creative names after about 10.


Oh trust me, when you want three stages of exhaust, several stages of chimney smoke (to reflect the fire condition), whistles, safety valves, two or three stages of cylinder cocks steam, injectors (steam normal, steam blowing back, water overflows, all x2), steam leaks, steam sanders, wheelslip sparks under each driving wheel in each direction, exhaust sparks etc., you very quickly start to wish you could have more breathing space!

Kind regards,
Chris
The Red Queen Hypothesis, applicable to train sim development?

"Here, you see, it takes all of the running you can do, to keep the same place."
cjbarnes5294
Driver
 
Posts: 398
Images: 82
Joined: Mon Mar 31, 2014 12:40 pm
Location: Gloucestershire/North Yorkshire
Has thanked: 551 times
Been thanked: 187 times

Re: Various particle emitter questions

Postby TrabantDeLuxe » Tue Aug 09, 2016 5:53 pm

Has anyone gotten the "shader name" field to work? I had some ideas on water from overflow pipes and sparks, but my attempts have thus far only generated crashes on scenario loading. Is this feature completely inop, or only available on selected shaders?
TrabantDeLuxe
Passed Fireman
 
Posts: 247
Images: 7
Joined: Mon Mar 21, 2016 10:10 pm
Location: Delft, NL
Has thanked: 176 times
Been thanked: 263 times

Re: Various particle emitter questions

Postby AndiS » Tue Aug 09, 2016 8:52 pm

Not that I know a thing about it, but this is what the TS2012 tech docu says about the shader name:
TrainParticleDefault - the default plain shader, this is only lit by the global lighting colour
TrainParticleEmissive – an emissive shader used for things like flames
TrainParticleLit - a wrap around lit shader, this take lighting from the sun/moon and gives a thicker more
realistic look
AndiS
Top Link Driver!
 
Posts: 736
Joined: Wed Apr 09, 2014 5:48 pm
Has thanked: 268 times
Been thanked: 308 times

Re: Various particle emitter questions

Postby cjbarnes5294 » Thu Aug 18, 2016 9:22 pm

The special shaders definitely work on my setup. When you type in the shader name into the field, make sure you only reference the shader name i.e. TrainParticleLit instead of TrainParticleLit.fx. As you can probably already guess, you don't need to type in TrainParticleDefault as this is the, well, default shader when you leave the field blank. :) TrainParticleEmissive is good for things like wheelslip sparks emitting from under the wheels or hot cinders being blasted out of the chimney when working hard.

Kind regards,
Chris
The Red Queen Hypothesis, applicable to train sim development?

"Here, you see, it takes all of the running you can do, to keep the same place."
cjbarnes5294
Driver
 
Posts: 398
Images: 82
Joined: Mon Mar 31, 2014 12:40 pm
Location: Gloucestershire/North Yorkshire
Has thanked: 551 times
Been thanked: 187 times

Re: Various particle emitter questions

Postby TrabantDeLuxe » Thu Aug 18, 2016 10:35 pm

Managed to get it working indeed. I was trying to get unsupported shaders such as AddATex to work, so that's when I assumed the shader field was inop. TrainParticleLit is rather nice for steam actually, and doesn't come at huge performance cost.

Meanwhile, I just wished the alpha sorting worked, oh well.
TrabantDeLuxe
Passed Fireman
 
Posts: 247
Images: 7
Joined: Mon Mar 21, 2016 10:10 pm
Location: Delft, NL
Has thanked: 176 times
Been thanked: 263 times

Re: Various particle emitter questions

Postby TrabantDeLuxe » Thu Jun 01, 2017 4:22 pm

Does anyone happen to know whether there's been any changes to the particle system in the last weeks? All of a sudden I'm having massive z-fighting issues with 'overlapped' emitters; and afaik the idea worked fine before. I can't remember changing anything myself to the setup.
TrabantDeLuxe
Passed Fireman
 
Posts: 247
Images: 7
Joined: Mon Mar 21, 2016 10:10 pm
Location: Delft, NL
Has thanked: 176 times
Been thanked: 263 times


Return to Rolling Stock General

Who is online

Users browsing this forum: No registered users and 4 guests