Space Engineers

Space Engineers

26 ratings
Creating and Modding Particle Effects in Space Engineers
By nukeguard
In this guide I will show you how you can manipulate or create your own particle effects for Space Engineers.
   
Award
Favorite
Favorited
Unfavorite
Custom Particle Effects
To begin, there are a few ways to enable particle effects:

1. Create a weapon in a weapons.sbc file, you will need this part of code to enable the particle effect.
<Effects> <Effect Action="Shoot" Dummy="EffectsEmpty" Particle="MyParticleEffect" Loop="false" /> </Effects>

The Dummy is the empty name that is in the model you will attach the particle effect to. This empty may need to be rotated, or just rotate the projection of the effect via the property settings discussed later.

2. Utilize the damage state of a block for particle effect

3. use Particle Emitter mod (link is at end of this section)
Particle Emitter Mod
The Particle Effect Example

Once you have set up how you want to have your particle rendered in game, you can now start editing your particle effect. You can either use the example particle effect from the link above or copy one from one of keen's files in Particles_A.sbc or Particles_B.sbc and use those.

To begin editing the particle you can collapse all levels of the xml in the sbc file, if you are using notepad++ you can minimize all Property tags of the effect to better see the PE settings, below is an easier way of displaying the PE settings.


The below code shows how your file should look with the ID and subtypeID for the effect.
<ParticleEffect xsi:type="MyObjectBuilder_ParticleEffect"> <Id> <TypeId>ParticleEffect</TypeId> <SubtypeId>MyParticleEffect</SubtypeId> <!--You need to specify your ID, it can be the same as another, but will overwrite vanilla PE. This is also what is called by another file to link the PE to your block. --> </Id> <Version>0</Version> <!-- This is just internal and allows you to show your version of the PE --> <ParticleId>1337</ParticleId> <!-- This number must be different from any other PE in the game, so pick a high number --> <Length>1.03</Length> <!-- Length of the effect in seconds--> <DurationMin>1</DurationMin> <!-- minimum duration of effect in seconds--> <DurationMax>3</DurationMax> <!-- maximum duration of effect in seconds--> <Loop>false</Loop> <!-- Loops effect in world true = repeats / false = plays once per initiation --> ... ... ...
Note: The DurationMin/DurationMax is the total time the particle lasts, later in the properties there is a Life tag, and that is the time that a single particle spawn lives during the durationMin/Max.
Particle Generations



This line here you can define your particle name. Not necessary, but will help you sort your particle effect generation sections (PE generation is unique to each particle you have, you can have multiple of the PE generations in a single Particle Effect)

<ParticleGeneration Name="MyParticle" Version="0"> Between these tags is where you will have all of the properties of the PE. </ParticleGeneration>

Each PE has Properties sections to define parts of the PE. The property tags define how parts of the particle effect work, there are many, so you can start off with only changing a few to get the hang of this.
Every <Property> tag has a name in it as you can see and basically describes what that particular setting does to the PE. I will describe what the different parts and what they do to better detail than what is in this image.

[img]particle generations section[/img]

I had started this guide when I was working on the tractor beam mod, now that there is a mod that allows you to show particle effects, this is an easy way for you to test your particle effects (yes they do show up on the particle list if you have a mod with your particle effect enabled in the world)
======================================
Important Links
Particle Emitter Mod
The Particle Effect Example
======================================
In this guide I am assuming that you already know how to setup a mod and what you basically need to get started, the only additional things you'll need for a particle effect is a particleeffect.sbc file to save your custom particle in. If you create your own particle atlas you will also need a transparent material definition to define your custom particle effect atlas image. Reference keens TransparentMaterials.sbc file and copy one from there and change the texture location and subtypeid.

The next section describes the property tags and what they do.
Property Tags
To be able to set up your particle effect you'll have to know a few things about these property tags, there are many properties to these particle effects, if you break one and your particle stops working, just revert to where it was working and try again. Here are all of the tags and descriptions of what they do. I try and describe in short what each of these do, you may ask what the 'Key' values are. Those denote time incremented values for specific properties controlled by time and size/intensity, they both can be float/decimal numbers.
The Type of property you can tell by the Type tag:
*Bool - which would require either true or false.
*Int - which requires a whole number
*Float - which can be decimal numbers
*Vector3 - which is usually coordinates on x,y,z
*Vector4 - color denotation (r g b A = x,y,z,W)



Property Name="Array size"
-- Rows and columns count (if your atlas is 4 images across x 8 images down, then your Array Size will be x=4 y=8)

Property Name="Array offset"
-- First frame to use (if first image on atlas then 1, if 2nd or 3rd row, just count amount of images from 1)

Property Name="Array modulo"
-- amount of frames to be played

Property Name="Color"
-- Controls Color of Effect

Property Name="Color intensity"
-- Variation of color intensity

Property Name="Bounciness"
-- how bouncy particle is when bouncing on surfaces

Property Name="Emitter size"
-- scale of emitter, area that particles spawn in

Property Name="Emitter inner size"
-- when outer size is larger you can have inner size be larger and make a hole in the center

Property Name="Direction"
-- direction x,y,z to which particle will align (0,0,0 disables particle)

Property Name="Velocity"
-- Velocity of particle on axis

Property Name="Velocity var"
-- randomizes spawn velocity

Property Name="Direction inner cone"
-- direction of inner emitter

Property Name="Direction cone"
-- direction of outer emitter

Property Name="Acceleration"
-- acceleration of particle from emitter

Property Name="Acceleration factor [m/s^2]"
-- acceleration over time

Property Name="Rotation velocity"
-- speed of particle rotation on z axis

Property Name="Radius"
-- radius of particles (scale)

Property Name="Life"
-- Duration of particle effect

Property Name="Streak multiplier"
-- amount of trails each particle

Property Name="Animation frame time"
-- how long each frame plays per loop

Property Name="Enabled"
-- Enables/Disables Effect

Property Name="Particles per second"
-- how many particle spawn per second

Property Name="Material"
-- TransparentMaterials.sbc where texture is found (either keen's or your own)

Property Name="OIT weight factor"
-- smooths transitions to better approximate the intended effect.

Property Name="Collide"
-- can collide with objects

Property Name="SleepState"
-- Does particle have sleep state? (no changes noted)

Property Name="Light"
-- particle is light source

Property Name="VolumetricLight"
-- whether particle emits volumetric lighting

Property Name="Target coverage"
-- don't know what this does, didn't observe any change

Property Name="Gravity"
-- affected by gravity any integer number +/- gravity

Property Name="Offset"
-- offset from point of origin 0,0,0 or empty it's attached to.

Property Name="Rotation velocity var"
-- sets rotation speed, float so can be 0.1

Property Name="Hue var"
-- varies the specified amount from set hue

Property Name="Rotation enabled"
-- allows rotation of particle separate from object

Property Name="Motion inheritance"
-- Inherits motion of empty or object attached to, time controlled

Property Name="Life var"
-- variable life of particle

Property Name="Streaks"
-- persistent trails

Property Name="Rotation reference"
-- Rotational reference for p

Property Name="Angle"
-- Rotates effect on respective axis

Property Name="Angle var"
-- randomizes angle from specified angle

Property Name="Thickness"
-- determines width of particle 1=square 2=rectangle

Property Name="Particles per frame"
-- Particle instances allowed per frame

Property Name="Camera bias"
-- camera bias is used to layer your effects, give this a higher number to bring to front, you use each number as a layer number.

Property Name="Emissivity"
-- how emissive the particle will be

Property Name="Shadow alpha multiplier"
-- unknown, no observed change

Property Name="Use Emissivity Channel"
-- use the emissive channel R in the atlas

Property Name="Use Alpha Anisotropy"
-- unknown, no observed change

Property Name="Ambient light factor"
-- Affected by ambient light?

Property Name="Radius var"
-- radius variation of particle

Property Name="Rotation velocity collision multiplier"
-- determines how much particle rotates after collision

Property Name="Collision count to kill particle"
-- determines how many collisions particle has before it dies

How to understand the Size, Offset, and Modulo in the particle effects.
In this section you'll learn how the atlas is used in the particle effects, and how you can set up your own custom effect with the particle atlas using the size, offset, and modulo properties. (Thank you to Eikester for the help with understanding the modulo properties.)

For this image the atlas is divided up into 16x16 frames, to determine how to get this shape, you need to know the size of the atlas image (in this case it's 8192x8192 which is also the actual required size of particle atlas). You add up the amount of images accross the image and you can get the x size, which is 16, you then take 8192 divide by 16 will get you 512. This means that the frames on the top row are 512x512 (because they are square), so you have 16 frames per row of 4 rows of the explosion. Since these are square your property size of the frames will be:

<Property Name="Array size" Type="Vector3" AnimationType="Const"> Rows and columns count <ValueVector3> <X>16</X> <!-- size of atlas image, divided by x to get size of frame on x plane --> <Y>16</Y> <!-- size of atlas image, divided by y to get size of frame on y plane --> <Z>0</Z> </ValueVector3> </Property>

In this image the frames are split into 256x256, which would be 32x32 in the size property.

This image denotes the 32x16 (256x512) frame size, which you would use with the lightning near the bottom of this atlas.


The offset property tells the particle on which frame to start on the atlas.
<Property Name="Array offset" Type="Int" AnimationType="Const"> <ValueInt>448</ValueInt> </Property>
So, if you are using the 16x16 frame size an you want to use the explosion frames you would start offset at 0. All frame sizes start with 0, so an easy way to figure out quickly what frame you want to start on you would take the number of the row, and columns and multiply them. What I mean is you take for example the lightning section, you would use 32x16 as frame size and then multiply 32x14 to get the starting frame for the lightning. But, for the explosion effect we would start frame at 0 since it it the first frame on the atlas.

The modulo property tell the effect how many frames to use starting with the offset frame number.
<Property Name="Array modulo" Type="Int" AnimationType="Const"> <!-- amount of frames to be played --> <ValueInt>32</ValueInt> </Property>
when using the lightning effect it would start at frame 448 and count 32 frames over and repeat. For the explosion effect you would use frame 0-64 since the frames are 16x16.


The two mods you'll need for easier particle testing
Particle Emitter Mod
the example mod if you want notations in the file.
The Particle Effect Example

I know this doesn't cover all particles, but you should be able to get creating your own with this information. Also you will need to subscribe to the particle example mod and Particle Emitter mod to get the annotated xml file.

If you have anything to add or find incorrect information, let me know! Hope this helps some of you out!
30 Comments
nukeguard  [author] 13 Jan, 2021 @ 12:40am 
Thanks! This reminds me I may need to update some info, CPU particles were removed, it's now only GPU
Zantulo 12 Jan, 2021 @ 7:38am 
This is perfect, thanks Nukeguard!
Qarannia 10 Jul, 2020 @ 12:10am 
Thanks Nuke. I came to the same conclusion and used WC in my mod. It's working brilliantly so far.
nukeguard  [author] 9 Jul, 2020 @ 6:03pm 
you can't change vanilla missile particles without replacing all of them, if you use weapon core, you can replace missile particles
Qarannia 4 Jul, 2020 @ 6:43am 
So how would I go about attaching a particle effect to an actual missile, not the launcher? I looked at a couple of mods but I couldn't really see in the SBC where things like thruster smoke was attached so I tried a few things which ended badly for my game.
nukeguard  [author] 12 Apr, 2020 @ 1:59pm 
Glad this guide helped
Горячий Павел 10 Apr, 2020 @ 10:05pm 
Thanks. I solved the problem with dust, which prevents our riders from driving in the first person on the racetrack. It was enough to remove the parameters of the smoke effect.
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=2055736334
nukeguard  [author] 10 Apr, 2020 @ 11:07am 
to disable vanilla particles replace them with your own of same subtypid and id, not necessarily replaced, but made invisible by your replacement particle.
Горячий Павел 10 Apr, 2020 @ 7:01am 
How to disable vanilla particles?
nukeguard  [author] 16 Mar, 2020 @ 2:37pm 
Glad it helped