Page 1 of 1
New Weapon Explosion Shader
Posted: Tue Oct 02, 2012 10:54 pm
by gooball :D
Hi d00ds, I am currently working on adding some new weapons to Quake 3. I want to assign a new weapon, based on the RL, a different explosion shader, but I can't figure out how to get the shader to work. (I'm a bit new with Q3 programming

) Thanks in advance

Re: New Weapon Explosion Shader
Posted: Tue Oct 02, 2012 11:33 pm
by obsidian
Are you having problems with the shader script itself or having some kind of problem getting Q3 to work with your shader?
Re: New Weapon Explosion Shader
Posted: Tue Oct 02, 2012 11:38 pm
by gooball :D
This has nothing to do with the shader script. It puzzles me because I couldn't find an explosion shader for the RL or the GL. But, yes, I can't get the explosion to work with Q3. I haven't created an explosion shader since I could not find an explosion shader for the other weapons.
Re: New Weapon Explosion Shader
Posted: Wed Oct 03, 2012 12:08 am
by obsidian
Looks like they're in pak0.pk3/scripts/gfx.shader.
Code: Select all
rocketExplosion
{
cull disable
{
animmap 8 models/weaphits/rlboom/rlboom_1.tga models/weaphits/rlboom/rlboom_2.tga models/weaphits/rlboom/rlboom_3.tga models/weaphits/rlboom/rlboom_4.tga models/weaphits/rlboom/rlboom_5.tga models/weaphits/rlboom/rlboom_6.tga models/weaphits/rlboom/rlboom_7.tga models/weaphits/rlboom/rlboom_8.tga
rgbGen wave inversesawtooth 0 1 0 8
blendfunc add
}
{
animmap 8 models/weaphits/rlboom/rlboom_2.tga models/weaphits/rlboom/rlboom_3.tga models/weaphits/rlboom/rlboom_4.tga models/weaphits/rlboom/rlboom_5.tga models/weaphits/rlboom/rlboom_6.tga models/weaphits/rlboom/rlboom_7.tga models/weaphits/rlboom/rlboom_8.tga gfx/colors/black.tga
rgbGen wave sawtooth 0 1 0 8
blendfunc add
}
}
Re: New Weapon Explosion Shader
Posted: Wed Oct 03, 2012 10:49 am
by gooball :D
Haha, WOW I'm blind. Thanks anyway

Re: New Weapon Explosion Shader
Posted: Wed Oct 03, 2012 5:30 pm
by themuffinman
So you haven't coded it in either? It's declared in cg_local.h:
cg_weapons.c::CG_RegisterWeapon gets the game to load the shader and other weapon projectile assets into memory during level loading:
Code: Select all
...
case WP_ROCKET_LAUNCHER:
weaponInfo->missileModel = trap_R_RegisterModel( "models/ammo/rocket/rocket.md3" );
weaponInfo->missileSound = trap_S_RegisterSound( "sound/weapons/rocket/rockfly.wav", qfalse );
weaponInfo->missileTrailFunc = CG_RocketTrail;
weaponInfo->missileDlight = 200;
weaponInfo->wiTrailTime = 2000;
weaponInfo->trailRadius = 64;
MAKERGB( weaponInfo->missileDlightColor, 1, 0.75f, 0 );
MAKERGB( weaponInfo->flashDlightColor, 1, 0.75f, 0 );
weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/rocket/rocklf1a.wav", qfalse );
cgs.media.rocketExplosionShader = trap_R_RegisterShader( "rocketExplosion" );
break;
...
cg_weapons.c::CG_MissileHitWall handles the effect
Code: Select all
...
case WP_ROCKET_LAUNCHER:
mod = cgs.media.dishFlashModel;
shader = cgs.media.rocketExplosionShader;
sfx = cgs.media.sfx_rockexp;
mark = cgs.media.burnMarkShader;
radius = 64;
light = 300;
isSprite = qtrue;
duration = 1000;
lightColor[0] = 1;
lightColor[1] = 0.75;
lightColor[2] = 0.0;
if (cg_oldRocket.integer == 0) {
// explosion sprite animation
VectorMA( origin, 24, dir, sprOrg );
VectorScale( dir, 64, sprVel );
CG_ParticleExplosion( "explode1", sprOrg, sprVel, 1400, 20, 30 );
}
break;
...