VFX – Part 1: Making Effects

From Baldur's Gate 3 Modding

This is Part 1 of the VFX tutorial on the Effect Editor (AllSpark). In this part, we'll make a very basic effect, save it, and compile it for use in the engine.

The Baldur's Gate 3 Toolkit contains the effect tools. Simply launch the Toolkit, load your mod project or create a new one, and wait for it to load.

ⓘ For information on how to create and set up a project, please refer to Getting Started: Creating a New Mod.

For this tutorial, we will use an existing level named WLD_Campfire_E. You can find it in the Act_1A_WLD folder.

Loading the WLD_Campfire_E level.

From there, you will have the full Editor open and will be able to follow this tutorial smoothly.

Effect Editor

Launch the Effect Editor (also called AllSpark) from the main toolbar.

Launching the Effect Editor from the main toolbar.

Interface

The default UI layout of the Effect Editor is outdated. The Modules and Components panels are no longer necessary, so you can close them.

You can customise the layout to your liking and then save your setup using the Save Layout button via the main Editor’s Options menu.

When ready, press the File menu button in the Effect Editor and select New. A new window should open with your Untitled Effect. You should have something that looks like the image below. Let's use it for a quick tour.

A newly created effect.

Effect Preview Panel

On the top-left is the Effect Preview Panel. You will notice it has a few buttons on top for playback and visualisation. Most of them are labelled with mouse-over tooltips.

You can navigate in the preview with:

  • Left mouse button to rotate around the centre of the panel
  • Right mouse button to zoom
  • Middle mouse button to pan

Effects Panel

On the bottom-left, just under the Effect Preview Panel, is a file browser panel called Effects. You can quickly and easily open any effect file that you have on your disk from here. You can also easily copy its name with a right-click, which will be useful at a later stage.

ⓘ Only the Effects folders within the project are visible here. Their extension (.lsefx - Larian Studios Editor FX) indicates that they are the "Editor" files, meaning they're uncompiled source files only used by the Editor. You can think of them as what Photoshop files would be for a texture.

Work Panel

On the right part of the screen, where your new Untitled Effect has appeared in a tab, is the Work Panel with the currently open effects.

At the top is the timeline, where phases are defined and effect components are placed on tracks. Effect components are the building blocks of the effect (particle systems, models, forces, etc.).

At the bottom is the module stack for the selected component. Modules are the editable properties of a component.

Setting Up the Effect

We're not going to delve into all the details of making an effect, just the first steps to get you set up and ready to go.

ⓘ Everything that you make (phases, components, group tracks, tracks, etc.) can be deleted simply by selecting it and pressing the Delete key on your keyboard.

Bounding Sphere or Bounding Box

Before doing anything else, let's add a Bounding Sphere.

To do so, right-click on the first empty track (beneath "Phases") and select the BoundingSphere component.

Adding a BoundingSphere component.

(All components are accessible via this right-click menu, which is why the Components window, which we closed earlier, is deprecated.)

ⓘ Warning: All effects need a Bounding Sphere or Box that lasts as long as the effect. An effect without a Bounding Sphere or Box will trigger an error.

When an effect is outside the camera frustum, it is culled. Without a bounding sphere, it would disappear as soon as its centre is off-camera. The Radius of your Bounding Sphere or the Size of your Bounding Box can be adjusted to control the culling.

Where to adjust Radius of the Bounding Sphere.

Adding Reference Models

Next, let’s add a character as a reference and a floor for better readability.

Create two Model components and drop them on each of the next two tracks.

Assign a model by selecting the Model component and clicking the arrow in the Mesh GUID field.

Characters are made of multiple separate parts that wouldn’t work in the Effect Editor, so instead we use "proxy models", which are collapsed, untextured versions of any race/gender for preview purposes. Since we want it to be a character, type "proxy" in the search filter.

Select the first Model track and assign the mesh Proxy_HUM_M_Fullbody. Select the second Model track to assign the VFX_Static_Reference_20x20_Floor_01_Sand_01 mesh for the floor.

Adding a character model.

ⓘ Models and particles will only appear when the effect is running – it’s considered running when you press the Play button or have it paused.

Set their visibility like the picture below by clicking the little icons on the right of the track names. The first icon will "mute" the tracks, meaning they will not be exported when the effect is compiled. The second icon will force them to be visible in the preview when clicked twice.

Setting the visibility of tracks.

For this example, we will name the component with the character mesh Character by selecting it and typing it in the Name field in the Required module. We will do the same for the floor and name it Floor.

You can adjust the Start/End Time by typing it manually into the field or by dragging the module or its edges on the track.

You might want to have a preview of the character’s animation while working on your effect. There are two ways to play an animation of the model:

  1. Load an animation resource directly in the Animation Resource field.

The screenshot below shows where to assign an animation resource to the model.

Loading an animation directly in the Animation Resource field.

2. Load an animation by selecting an animation short name via the Animation field. This has the advantage of not relying on the character model’s race and gender as much, but it is more difficult to debug if the animation doesn’t play. The Animation subset is used when a singular animation short name uses different animations depending on weapons or classes. The screenshot below shows where to assign an animation short name to the model.

Loading an animation using a short name in the Animation field.

Adding Phases

For this example, we’re making a Prepare effect, which is a looping effect. We therefore need phases.

Right-click in the Phases bar above the track list and add all three of these phases sequentially: Lead In, Loop, Lead Out. The end time of each phase can be adjusted in the boxes seen in the image below.

Adding the Lead In, Loop, and Lead Out phases.

ⓘ Effects that don’t loop (e.g. cast, impact) don’t require phases. In general, Prepare, Projectile, (some) beams, and looping status effects are the ones that require all these phases.

Double-clicking on the time bar above the phases will automatically adjust it to the duration of the components or phases contained in the effect, scrolling the mouse wheel up and down will zoom in and out of the timeline, and holding the middle mouse button and moving left and right will allow you to shift the timeline left and right.

  • The Lead-In Phase is the build-up phase where the elements are starting to appear. Its duration depends on what you’re trying to achieve, but we generally keep it quite short and punchy – no longer than the animation, in any case. Let’s set it to 0.50 seconds by filling this into the box, as shown previously.
  • The Loop Phase is usually kept very short so it can be interrupted at any point. Let’s type 0.60 in the box so that the duration of the loop becomes 0.10.
  • The Lead-Out Phase is the end of the effect. It should allow enough time for all the active particles to die and the other components, such as models or billboards, to disappear elegantly. It is also very important when a sound is used in an effect not to abruptly cut it short. It’s good practice to make the lead-out a few seconds long to let the particles end their life before the end of the phase. Let’s set it to 2 so that it's 1.90 seconds long.

After setting the phases, it should look something like this:

Setting the phase durations.

You will see that your tracks are now shorter than your phase. Adjust their length by changing each one’s Start/End Time to 0 and 2, respectively. Your effect should now be set to start and look as follows when you press Play:

Playing the effect.

ⓘ There is currently no limitation to the number of Lead-Ins, Loops, or Lead-Outs you can add, but you don’t need more than one of each.

Creating a Particle System

For the purposes of this tutorial, since we want to see the effect visually in the next steps, we will create a simple, basic effect.

As a first step, we will create a new track group. Press the Create new track group button under the Stop button. It should create a new track group.

Creating a new track group.

From this new track group, right-click the first track and select ParticleSystem.

Creating a Particle System in the new track group.

Move your new Particle System to the left so that the system appears from the beginning of the Lead-In Phase.

We will leave all of the behaviour of this Particle System set to default, but we will assign a material to the particles – so that they aren’t just squares with a default texture – and scale them. To do so, click on the small arrow in the Material GUID parameter, find the material with the name VFX_ParticleSystem_AlphaBlend_Unlit_Emissive_TwoSided_Glow_Circle_01, and double-click on the file.

Assigning a material to the particles.

We will scale the particles down a bit so that they aren’t too big. Select your Particle System, and under Required, right-click in the window and select Scale > Scale module. This will add parameters to scale your particles.

Adding the Scale module so we can adjust the scale of the particles.

In the Scale module, locate the Uniform Scale parameter and select the Min Scale. Change the value from 1 to 0.5 for both the first and second point on the curve.

Adjusting the values of the Min Scale.

Finally, now that we see that our Bounding Sphere is too small, we will adjust it to fit the effect correctly. Repeating the steps for the Bounding Sphere from earlier, set the radius to 3 so that all the particles die inside the Bounding Sphere.

If you followed all of the above steps correctly, your effect should look like this:

The new effect successfully set up.

Experimenting

That’s pretty much it for the initial setup! From here on, you’re ready to make the effect per se.

Add tracks and track groups, experiment with components and modules, and see the result in the preview panel by clicking on the big Play button (or the small one in the Effect Preview Panel – they do the same thing).

Some quick tips:

  • Don’t forget Bounding Spheres – every effect needs one.
  • Force affects all the emitters in the same track group.
  • The minimum duration for any phase or component is 0.10 seconds.

Creating the Files

Saving and Naming the Effect

Click File > Save as… or press Ctrl+Shift+S to save the effect.

Saving an effect.

The root folder where the effect should be saved is: \Data\Editor\Mods\<YourMod>\Assets\Effects\.

However, it is advisable to create clearly named subfolders to keep your work organised. For this tutorial, we would create the following folder structure: \Data\Editor\Mods\<YourMod>\Assets\Effects\Spells\Prepare\Paladin.

Name your effect VFX_Prepare_Paladin_Test_01 and click the Save button.

Saving the new effect within a tidy folder structure.

ⓘ For Baldur’s Gate 3, we typically included information about how the effect is intended to be used in the name where possible, to make it easier to manage during implementation (bone name and textkey). For more examples of naming conventions, simply look in the Shared folder.

Compiling the Effect

As mentioned before, .lsefx files are just Editor files; they are not used by the game/engine. For them to be usable by the game, they must be compiled to .lsfx files.

To do so, click Build > Compile Effect in the Effect Editor's toolbar while you have your effect open and selected.

Compiling an effect so it's usable in the game.

This will create a compiled version of the effect in a location outside of the Editor folders. It will follow a folder structure similar to the one used for the Editor files. A message will appear in the Message Log panel in the main Editor to let you know that the action was successful.

A message in the Message Log indicating that the effect was successfully compiled.

This means that the subfolders you might have previously created will also be created there under the Effects_Banks root folder:

\Data\Public\<YourMod>\Assets\Effects\Effects_Banks\

ⓘ This behaviour is hardcoded and cannot be changed. If you haven’t saved your effect before attempting to compile, you will get an error in the Message Log and nothing else will happen.

Conclusion of Part 1

You have created your very first effect! The process will be very similar for all of your effects.

You are now ready to move on to Part 2 of this tutorial, where will explore the creation of resources so you can link the newly made effect.