Tutorial: Visual Effects Editor

Tutorial: Effects Editor Well, this is actually a plug in, but it comes included with the toolset, so I've placed it here with the tutorials.

N.B. Invalid values in the effects editor can cause the toolset to crash, and the editor may delete any campaign directory contents, so do a backup before you start!

We're going to create just one effect to get started, but because I am far from being a dab hand with this editor, you can then use this experience to get comfortable with it:

Making your effects 1. First you need to get into the effects editor, so open up the toolset, and from the top menu, select 'Plugins', 'Visual Effects Editor'.

2. You can't actually see any existing effects, and it really is much easier to work from an existing one, so you will need to go into Windows Explorer or equivalent and find them all. They are stored in a set of zip files in the data folder of the game in a zip called NWN2_VFX (there is also an NWN2 Materials zip that might be interesting). Unzip the contents somewhere you can find it.

Effect 1: Cauldron Lights This will make a sort of slow spinning lights similar to the NWN dancing lights placeables, but slower and revolving.

1. We're going to make a particle effect using the 'fireflies' effect. Go to 'open' in the editor, and look in the folder FX_Ambient within your unzipped NWN2_VFX folder, and find fx_fireflies (set file type to pfx to make the search a bit easier, since you are using a particle effect)

2. In the properties of this effect, you're presented with a pretty meaningless bunch of stuff. You'll want to start with setting two of these first, so you can get the general 'feel' of your effect: FlowType & ControlType.

3. FlowType is self explanatory - pick continuous.

4. ControlType sets up the general 'look': pick cartesian if you want the effects to sort of fly away from the point of production, select polar if you want an effect that is centered on an invisible point (like a tornado), select spherical if you want a sphere. We're going to use 'polar'.

5. Now it's time to play around with the other settings. Set the BeginSize and EndSize of your particles. Play around with this to get what you like. For this exercise I used BeginSize of 1.5, and EndSize of 0.9.

6. Set SpawnRate and ParticleLife quite high for the moment. It makes it easier to see what you want in the next steps.

7. We need some dimensions, in order to get what this effect will actually look like. To do this we use the Velocity and Acceleration properties. These are set up 0,0,0 ie. the first number refers to x-axis, and the last z-axis. Velocity sets the speed the particles will move at, so 0,0,1 will make them move upwards slowly. A minus value has the opposite (if you want to make falling snow for example). Acceleration works in the same way, except it makes your particles speed up (or reverse) from the point of acceleration. Disk = TRUE incidentally seems to determine if the particles are spawned in a flat plane or not. I used Velocity 0.7, 0 ,0.3 and acceleration 0.1,0,0. My particles will rise in a slow spiral.

8. Set your EmmisionRadius, in this case how far from the central point your particles are spawned (use the variance property to vary it). I picked 1 to keep it small. I also set ConeHalfAngle and AngleStartVariance to 0. If you want your effect wider at one end, give ConeHalfAngle a number up to 180 (I think, might be 90). AngleStartVariance determines if your particles fire at right angles to the ground (0), or at varying angles (as you set it). You can't actually see the effects of these settings without Velocity, which you have to set first.

9. Set StartTheta to -1. This stops each particle being created in the same place (StartTheta and StartPhi are unfathomable as far as I am concerned).

10. Now change your particle SpawnRate and ParticleLife to something meaningful. I went for 1 and 8, so that I would get a slow gradual spiral with just a few lights that last a while.

11. Set the colours. I used Blue, and red, so my particles start out blue and as they shrink and fade out they go red.

12. Play around with the other variations as you like, but that's pretty much all you need for this effect. SAVE IT in your campaign directory AND somewhere else.

Making the SEF file 1. You can't actually use your effect yet. Create a new SEF file from the toolbar (file --> New --> Special Effect).

2. Click on Add Event on the toolbar. You won’t see much, except an empty line under ‘Name’. Click on that. The properties will now show up at the bottom.

3. There’s lots of probably cool stuff in here, but we’re only interested in the DefinitionFile and the Name. Click on the DefinitionFile and select the effect you made from the list.

4. If you click the Play button, you can see it on the further figure taking effect. You can add more effects if you want, just click play again to update the visual.

5. Save your SEF file in the campaign directory AND somewhere else.

Getting it in the toolset 1. Your not done yet. You can't actually see your effect in the toolset. Close the effects editor. Select a placed effect blueprint in the main toolset and right click --> copy blueprint.

2. Open your copy’s properties, and under behaviour, change the effect it calls - your SEF file should be in the list as long as you saved the SEF file in the campaign directory.

3. Change the localised name, tag and resref while you're at it.

4. Your effect is now part of the campaign directory, and is selectable from the palette.

Just remember, the effects editor regular removes all the contents of your campaign directory (I don’t know why this is), so have a backup handy from before you open the editor.

Making a Spell Just a few notes on making a spell:

1. Keep it simple, don't (yet) try to reinvent the wheel, so go and find a spell with similar effects to what you want, and work from that. I took as an example Ray of Enfeeblement from the Necromancer folder in the VFX folder above - note it's called necromancer ray or some such, meaning all ncromancer rays look the same.

2. Open the SEF file and look at each of the events in the list. Decide what you are going to replace. I decided to have some wrapping coloured beams instead of the standard red beam.

3. I found myself a Beam file from the VFX folders, and adapted the properties in that. I actually made 4 of them, all slightly different in colour and properties, so they would sort of wrap around each other.

Some notes on beam properties: Beams have a begining and end width, so you can make a narrow beam or a cone effect. Amplitude - this basically decides how much to bend the beam in the middle (0 = not at all) Frequency - think of this as the number of elements the beam is made up of. A high frequency and amplitude will give you a sort of stretching wall of a beam, rather than a narrow beam (it can take some time for the preview to update, so keep fiddling) Repeat, Repeat Distance and Rate of Flow together control how smooth and fast the beam is. You can of course also set colours for the beam.

By playing particularly with amplitude and repeat distance, I had four coloured beams that if combined would not follow exactly the same path.

4. Save all of those beams somewhere easy to access/find.

5. Now in the SEF file, remove the default beam, and add events for each of your beams. As before it's the Name and the DefinitionFile you're primarily interested, but you may notice some of the other properties are intersting, like the impact nodes, if you want the beams to fire from or hit a different point on the creature using them.

6. Save your SEF file with a new name somewhere safe. Place copies of all of these in the campaign directory if you're actually going to use them (though you will need to do the tlk/2da entries if this is a new spell)

7. To test, save your files in the override directory. Rename the SEF file to match an existing spell SEF (such as the necromancer ray). Now if I cast Ray of Enfeeblement in game, I will see my new spell effects in play.

Ben Wynniatt-Husey (B G P Hughes)

Additional Notes from Dalvyn: "(StartTheta and StartPhi are unfathomable as far as I am concerned)."

Actually, they relate to cylindrical coordinates.

Coordinates are used to indicate precisely the position of a point in space (or its speed or acceleration, but position is easier to visualize). Cartesian coordinates (x, y, z) are only one way to do that, but there are other kinds of coordinates, like cylindrical coordinates (actually called polar in the editor) and spherical coordinates.

Imagine the earth as a big sphere, with the origin placed at its center and three axes X, Y, and Z. A location (on Earth, in the Earth, or above the Earth) could be indicated with cartesian coordinates (x,y,z). The values x, y, and z could be seen as directions to travel from the center of the Earth to the location (through the depths of the Earth) : you would have to follow axis X for a length of x, then follow the direction of axis Y for a length of y, then finally follow the direction of axis Z for a length of z. That's not very practical though, since it's kind of hard to go to the center of the Earth and move through lava, rock, earth, and whatever else is there.

Cartesian coordinates are not very practical when you want to indicate a location on Earth. Instead, most use longitude and latitude, and height (in case the location is actually not on the ground). Longitude, latitude, and height are actually ... the spherical coordinates of the location; and mathematicians generally call them Theta and Phi.

Without going into too much detail, Phi is the angle formed by the line joining the center of the Earth and the (mathematical) North Pole (highest point on the sphere) and the line joining the center of the Earth with the location. Perhaps it's easier to visualize it in the editor.

Set a high enough SpawnRate (600), and a long ParticleLifeTime (6) so the image is clear. Choose no Velocity (0;0;0) and no Acceleration (0;0;0) so that points are actually highlighted, but they do not move. Make sure you use ControlType Spherical, an EmissionRadius of 4, and an EmissionRadiusVariance of 0. Set both StartTheta and StartPhi to -1. You should then get an empty sphere of Radius 4, with several points on its surface, but none inside.

If you change EmissionRadiusVariance to 4, you will get a bigger sphere with points both on the surface and inside (that's because it's plotting points whose radius - that is, distance from the center/origin - is randomly chosen between 0 and 8 [actually, it's slightly more complex than that, but it's a good enough interpretation]).

Now, as I see it, StartPhi = -1 means that "Phi" (the angle I mentioned above) is randomly chosen... that's why we get points everywhere in the sphere. Set it to StartPhi = 30 and you will get some sort of upside-down cone with no cover. This "cone" is composed of points for which the line between the center and the point forms an angle of 30 degrees with the line joining the center with the "North Pole".

You can use other values to better visualize it. 60 will produce a smaller, but wider cone. 0 is another interesting value: you will get only points situated between the origin/center and the North Pole. With 90, you will get points on the horizontal surface that actually cuts the whole sphere in two equal parts. If you use values between 90 and 180, you will get an inversed cone.

If that helps, Phi is more or less similar to Latitude, with this big difference: Latitude goes from 90°North (= North Pole) down 90° South (= South Pole) while Phi goes from 0 (= North Pole) to 180° (South Pole).

Theta, on the other hand, is similar to Longitude. To visualize it, you can set StartPhi to -1 and try different values of StartTheta.

Note that StartPhi and StartTheta (as well as EmissionRadius) determine the initial position of the effect... The effect then moves according to the set Velocity and Acceleration, and both of those are also expressed in terms of Theta/Phi/Radius.

You can see that by resetting the values so that you get the empty sphere again (StartPhi = -1, StartTheta = -4, EmissionRadiusVariance = 0) then using 1;0;0 as Velocity. The 1 in the Velocity corresponds to Theta (that is, longitude). If you take a location on the surface of Earth and modifies its Longitude/Theta, the location will move on the surface in a direction parallel to the equator (i.e., it will move straight east for example). That's exactly what you can see in the editor: the points are created, then moved (at a constant speed of 1) towards the East. Of course, you can use 2;0;0 to make them move more quickly, and -1;0;0 to make them move in the other direction. (It might be more visible with a lower SpawnRate of 200).

That shows that Velocity (and Acceleration) also use the coordinate system you chose: if you turn to Cartesian coordinates, the 1;0;0 Velocity will mean that the particles will move in a straight line (in the direction of the X axis), but in Spherical coordinates, 1;0;0 is actually a circular movement.

This is true for Acceleration as well. Try this for example: set Velocity to 1;0;0 and Acceleration to 1;0;0. Newly created particles will turn "slowly" in an eastern direction at a speed of 1, and progressively move faster and faster (as Acceleration comes into play). This might not be easy to spot though. Try setting the StartColor to yellow and the EndColor to red, that should help: you will see newly created (yellow) particles move slowly, and older particles (red) move much more quickly. Alternatively, you might try setting Velocity to 2;0;0 and Acceleration to -1;0;0 to see the newly created (yellow) particles move to the east and the older (red) particles move to the west.

I'm not sure how helpful this was (especially since English is not my native tongue), but I hope it helped you get some insight as to what those Theta and Phi are.

Credited Author: Ben Wynniatt-Husey (B G P Hughes)