Quake Live Film Forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.

How To Enable The "Q3MME" FX script included With Wolfcam and Start Editing it!

Go down

How To Enable The "Q3MME" FX script included With Wolfcam and Start Editing it! Empty How To Enable The "Q3MME" FX script included With Wolfcam and Start Editing it!

Post by Admin Sun Jan 22, 2012 7:57 pm

You of course need to have Wolfcam and some Quake live Demos

Simple Method: Open Wolfcam, click Quake Live demos, double click on one of your demos to open it.

once in wolfcam, assuming you still have the included binds, press '\' (above enter) to pause the demo
open the console (same as quake): press" ` "(tilde) or ctrl+alt+tilde

type: /cg_fxfile "scripts/q3mme.fx" [press enter]
type: /vid_restart [press enter]

Now wolfcam will run the Q3MME.fx file (located in the scripts folder, in the wolfcam QL folder, in your Wolfcam Folder) for this session of wolfcam, you can switch demos and it will remain with this fx file, but not after you close Wolfcam

More Permanent Method:
Open the Autoexec.cfg in your wolfcam QL folder(!!!NOT!! the autoexec in your WOLFCAM BASE FOLDER!!!)
place the following binds (after the unbindall of course)

bind f3 "cg_fxfile scripts/q3mme.fx; vid_restart;"
bind f2 "cg_fxfile scripts/new.fx; vid_restart;"
(you might want to make sure that your version of autoexec doesn't already assign binds to these keys, just use any available key)

this will allow you to call both Q3MME.fx and a file you have not yet created called new.fx (this is a file you will use to make/modify your own scripts Very Happy)


Go into your wolfcam folder and open the wolfcam-QL folder and then open the Scripts folder and finally open Q3MME.fx

You will see this

The basic format for an fx script: (the order generally is as follows, with some scripts having significantly fewer items[having only color, size, shader, and light for example] and some, like rail trail script, have much more than is described here, math/syntax-wise)

x=a variable that presumably can range from -99999 - +99999 unless negatives don't make sense (time)
0-1 pretty self explanatory: value from 0 to 1

*
"event"{.............................tells quake when to use the following information
..............................................for example "weapon/grenade/projectile {"

*vibrate x................................amount of world vibration upon event, only used for impact scripts, .............................................0-xxxx, 70 common
color (0-1) (0-1) (0-1).............. these three variables refer to the RGB color scheme, 0-1 is the percentage of
............................................ the traditional 0-255, 0 0 1 being blue, 1 1 1=white, 0 0 0=black
*alpha 0-1.............................. transparency 0=clear 1=opaque
***model................................the model to be rendered, only applies to certain events ..............................................e.g.rocket/projectile, grenade/projectile
*sound................................... sound that plays at the specified event, you can replace certain sounds ..............................................but it seems impossible
..............................................to replace others via scripts(grenade bounce sound)
shader.................................... shader applied to particles emitted from emitter
size x..................................... size of particles/model etc.
*velocity................................ speed and direction of particles(vector)
*repeat x{.............................. number of times to repeat the enclosed code (often # of particles to emit)

*interval x{.............................x=number of times the script is run in seconds (I believe) so 0.001 which .............................................is common just runs it
.............................................constantly, so to speak, once every 0.001 seconds
*Distance x{........................... x=how often a particle is emitted in world units
*Emitter x{..............................x=life of particles in seconds (things within emitter can be made to change .............................................with the life of the
.............................................particle, though this is a little more advanced
.............................................than this article will go e.g. size changing during life of particle)

*alphafade 0-1 .......................how far into the life of the particle the alpha starts to fade, 1=starts fading .............................................immediately
*colorfade 0-1 ..................... same as alphafade but with color? I ususally use alphafade if possible
*movegravity x .....................gravity applied to particles
*movebounce x y ....................not positive on this one, x seems to be how much gravity is applied to particles
.............................................(higher numbers equate to less upward motion)
..............................................y is definitely the percentage of speed that particles maintain after a collision
..............................................1=no loss of speed 0=stops upon collision
sprite ....................................render as sprite, standard when using particles and projectiles generally not
.........................................used in conjunction with light(not sure what happens when used in conjunction)
light....................................render as a light. (you need to have either sprite, light, OR, though generally .............................................not used, both)
**dirmodel..............................used for projectiles rockets=dirModel
**anglesmodel........................used for projectiles grenades=anglesModel



}}}}
}


*not necessary
**not necessary depending on situation
***only necessary for projectiles, I believe
(use q3mme.fx as reference)


To get started modifying your weapon FX
First isolate the event you would like to start playing with, for this article I will use "weapon/rocket/impact," the rocket explosion
Second use your mouse to highlight all the way from weapon/rocket/impact to just before the next "weapon/xxx/xxx":

weapon/rocket/impact {
vibrate 70
sound sound/weapons/rocket/rocklx1a.wav
shader gfx/damage/burn_med_mrk
size 64
Decal

// animating sprite of the explosion

shader rocketExplosion
size 40
color 1 0.75 0
emitter 1 {
// size will goto zero after 0.5 of the time
Sprite
size 300 * clip(2 - 2*lerp)
Light
}

// Particles

color 1 0.75 0
alpha 0.8
shader flareShader
repeat 20 {
random velocity
scale velocity velocity 250 + rand*50
size 1 + rand*2.5
emitter 1 + rand*0.5 {
colorFade 0.75
Sprite
moveBounce 400 0.75
}
}

color 1 0.50 0
alpha 0.8
shader flareShader
repeat 20 {
random velocity
scale velocity velocity 250 + rand*50
size 1 + rand*2.5
emitter 1 + rand*0.5 {
colorFade 0.75
Sprite
moveBounce 400 0.75
}
}

color 1 0.25 0
alpha 0.8
shader flareShader
repeat 20 {
random velocity
scale velocity velocity 250 + rand*50
size 1 + rand*2.5
emitter 1 + rand*0.5 {
colorFade 0.75
Sprite
moveBounce 400 0.75
}
}

}

all of this...

now copy this (ctrl+C) and then select all (ctrl+a) and delete everything,

then paste the rocket explosion back in and SAVE-AS "new.fx" in the scripts folder(so you can easily call it with f2)
(this process maintains the integrity of q3mme.fx so you can keep it as a reference, which you will want)

Now to start editing!



For this introduction we will keep it simple and merely adjust the color of the particles emitted by the rocket explosion

these particles are controlled by the three blocks of code above that follow the "//particles" line

to change the color of the particles you simply adjust the 3 values after 'color' for each code block

we will make these Patriotic rockets, lol: red, white, and blue

for the first block set the color values to 1 0 0 - red
for the second block set the color values to 1 1 1 - white
for the third block set the color values to 0 0 1 - blue

after you are done editing, just save new.fx and either hit f2 or if new.fx is loaded already just vid_restart to view the effects.
to make the colors stand out more you could set all the alpha values to 1 to increase the opacity
or change the repeat values to create more or less particles of a certain color


just play around with the variables and have fun, though I would recommend a couple things:

  • change very few variables at a time
  • Save everything you are happy with because it is easy to forget how you got some cool effect
  • If you are really trying to get some work done don't exit your demo after changes to fx script, merely enter the console or press the "windows?" button (brings up start menu) and select new.fx, edit, save and go back to wolfcam and /vid_restart (which after you do it once will be *up* *enter* in the console)



Here is a math resource included somewhere in Wolfcam

float variable:
Floating point variables that can store a single number

Valid float variable names are:
size, width, angle -> Used by certain commands
t0, t1, t2, t3 -> temporary values you can use for complex calculations

Vectors:
3 floats grouped together under 1 name used for vector math
You can also access specific float by adding 0, 1, 3 to the vector name

origin, velocity, dir, angles: Used by render commands to output stuff
v0, v1, v2, v3 : Temporarary vectors you can use for calculation and storage

So origin0 will behave like a regular float
Using vectors names in math will result in the length of the vector being used

Special variables:
These can only be modified by special commands
color -> red, green, blue, alpha color
shader -> shader used by some commands
model -> model used by some commands

FX Commands:
There's a whole bunch of command to generate effects, modify variables and spawn entities and do vector math

Float math commands:
Using any float variable name a command starts a float math command
examples:
size 5*size -> Size is now 5*original size
angle 360*rand + size -> angle is now a random value * 360 + size

Vector Math Commands:
Most math command take several inputs and a final storage vector name
Sometimes also followed by additional math value

scale <src> <dst> <math> -> <scr> * <math>
add <src1> <src2> <dst> -> add <src2> to <src2>
addScale <src1> <src2> <dst> <math>-> add <src2> * <math> to <src1>
sub <src1> <src2> <dst> -> substract <src2> from <src>
subScale <src1> <src2> <dst> <math>-> substract <src2> * <math> from <src1>
copy <src> <dst> -> Copy <src>
clear <dst> -> set to 0,0,0
wobble <src> <dst> <math> Randomly move src around within cone of <math> degrees
random <dst> Create a random vector with length 1 in any direction
normalize <src> <dst> Normalize a vector so make it length 1
perpendicular <src> <dst> Create a perpendicular vector to <src>
cross <src1> <src2> <dst> Create the cross product of src1xsrc2


Render Commands:
These will render something on the screen using the current state of the variables
sprite <options> -> view aligned image -> origin, shader, color, size, angle
spark <options> -> view aligned spark -> origin, velocity, shader, color, size, width
quad -> fixed aligned sprite -> origin, dir, shader, color, size, angle
beam -> image stretched between 2 points, origin, shader

FX Math:
Fx scripts can use a fair collection of math functions
They are constructed from a number of options

Math operators:
+, -, *, / -> The regular math operans

Math test operators:(I have not seen any of this cluster work)
Special group of operators that return 0 or 1 depending on a test
< -> ( 0 < 2 ) returns 1 -> 2 smaller than 0
> -> ( 2 > 0 ) returns 1 -> 2 bigger than 0
! -> ( 2 ! 0 ) returns 1 -> 2 unequeal to 0
= -> ( 2 = 2 ) returns 1 -> 2 equal to 2
& -> ( 2 & 2 ) returns 1 -> 2 && 2
| -> ( 2 | 0 ) return 1 -> 2 || 0

The boolean operations only check for not equal to zero, no boolean algebra

Math numbers:
Just regular numbers like 0.112 22 12412

Math Floats:
floats variables like size, width, origin0

Math Vectors:
Vector variables like origin, velocity which will return the vector length

Math Constants:
These are readonly constants to be used in math routines


time -> Time in seconds since the beginning of a map
loop -> Goes from 0 -> 1 during any kind of repeating action in a script
red, green, blue, alpha -> specific color components value in 0,1
pi -> 3.1414155 something not tested
rand -> random value between 0, 1
crand -> random value between -1, 1
lerp -> Goes from 0 -> 1 during the life of an emitter
life -> Amount of life in seconds that an entity got when it was emitted

Math Functions:
These functions can be nested in a math expression with their own expression
so sin( sin ( 3*pi ) ) would be a valid math expression

I have only seen 'clip' work properly from this cluster
sqrt( value ) -> Square root
ceil( value ) -> Round values up to next integer 0.3 -> 1
floor( value ) -> Round values down to next integer 0.3 -> 0
sin( value ) -> regular sinus using degrees
cos( value ) -> regular cosinus using degrees
wave( value ) -> sinus type wave but takes 0-1 to complete compared to 0 - 2pi
clip( value ) -> returns value clipped between 0,1 so <0 becomes 0 and > 1 becomes 1

Math Cvars:
This is a special group, if the fx math parser can't find the variable name
It'll try to see if there's a regular q3 cvar with that name and then it'll use that value
So you can use cg_* values or whatever cvar you want

Admin
Admin
Admin

Posts : 4
Join date : 2012-01-16
Age : 36
Location : Minneapolis MN, USA

https://qlff.board-directory.net

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum