While the bulk of my work does involve .effects, .particles, .decals, and other things that make great particle effects, my job as the VFX artist also includes working with just about everything you can see in the game oustide of modeling, mapping, and texturing. The most noticeable among these are the shield effects; I'll talk about the cyborgs and elites later, but right now I want to get into a neat bit of trickery that has a greater impact on gameplay: The jackal shields.
Vanilla HCE only uses one color for its jackal shields, but for SPv3, we want to denote different jackal ranks (i.e. minor, major, and ultra) with different shield colors (blue, orange, and white.) The most obvious way to do this would be to have completely different models with completely different shield shaders for each rank, but .gbxmodel tags are absolutely HUGE when it comes to filesize; since SPv3 has so much content added in, we cannot accomodate even one duplicate .gbxmodel, much less two, so the job fell on me to try and work out a way to color the shields differently without duplicating massive tags.
The other complication was that the CMT jackal shields are scripted to flash red when damaged, but this served as an inspiration. The shield flash was controlled by switching out layers of .shader_transparent_chicago_extended tags based on functions defined in the .biped. If there were some way to script the functions to change the persistent visibilty of shields, I could use them to control the various colors that appear - but each .biped only allows me to make four functions, and because .shaders are controlled through the model, I have to assign different functions for every shield variant, meaning I have to find a way to preserve the red flash in a single function. After some work, I managed to figure this out - and here's how:
First, since .shaders are assinged through the model (which I can't duplicate), I need to figure out a way to link multiple different shaders to one tag. I decided to build off what had already been done with the red flash and attach yellow and white shaders as extra layers to the basic jackal shield.shader_transparent_chicago_extended tag:
I then make duplicate .bipeds for each rank variant (.bipeds are SO MUCH smaller than .gbxmodels.) In each biped, I assign these input values:
"Recent shield damage" turns on when the shield is hit (for the red flash), "shield stun" turns on if the shield is depleted, and "alive" is on as long as the jackal is alive.
These are the same across all .bipeds; what changes are the functions:
Each .biped's B out, C out, and D out correspond to blue color, yellow color, and white color respectively. The function that controls the color does this:
-If the shield has been recently damaged, pass on a value of 1; otherwise, 0.
-If the shield is off, add a value of 1; otherwise, add nothing.
-If the jackal is alive, multiply the above by 1; otherwise, multiply by 0.
-Invert the result (1 becomes 0, 0 becomes 1.)
If the final value is 1, this shield color draws; if it's 0, it does not. If the jackal's shield is not being shot, its shield is on, and the jackal is alive, the function passes on 0, adds 0 (still 0), multiplies by 1 (still 0), and inverts (now 1.) The value is 1, so the shield will draw.
If the jackal is alive but the shield has been depleted, it will pass on 0 (not being shot), add 1 (now 1), multiply by 1 (1), and invert (now 0). The shield will not draw. If the jackal is not alive, the eventual value will be multiplied by 0, which will always result in the shield not drawing.
To change the colors, I simply "deactivate" all but the desired color function by setting the bounds to 0 and 0 (meaning the function cannot output a value above 0, keeping the color invisible) and the square wave threshold to 1 (snapping all values below 1 to 0, just in case.)
That's the hard part done - now that it looks good, I can add an extra touch: I give the shields small dynamic lights that correspond to their different colors. I can change the functions these are assinged to in the .biped tag itself, making things much easier.
Each .biped also has a second red light which flashes using the same flash function as the shield color. The red light adds a lens flare to emphasize the damage that's being done; have a look at the difference:
And with that, we have sexy jackal shields in three color variants. The downside is that the depletion particle effect has to use the same color (since I haven't figured out a way to tie the depletion effect to the shield color, although I'm trying my hardest), but that's a small concession to make.
Hope you guys learned something or just enjoyed the pretty lights. I'll alternate between making more in-depth process analyses like this and just posting minor updates every now and then, but only here on Halomods, so make sure to check back regularly.
This post has been edited by Ifafudafi: 03 August 2011 - 09:55 PM