Quake3World.com
https://www.quake3world.com/forum/

New Weapon Explosion Shader
https://www.quake3world.com/forum/viewtopic.php?f=16&t=48194
Page 1 of 1

Author:  gooball :D [ 10-02-2012 02:54 PM ]
Post subject:  New Weapon Explosion Shader

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 :D

Author:  obsidian [ 10-02-2012 03:33 PM ]
Post subject:  Re: New Weapon Explosion Shader

Are you having problems with the shader script itself or having some kind of problem getting Q3 to work with your shader?

Author:  gooball :D [ 10-02-2012 03:38 PM ]
Post subject:  Re: New Weapon Explosion Shader

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.

Author:  obsidian [ 10-02-2012 04:08 PM ]
Post subject:  Re: New Weapon Explosion Shader

Looks like they're in pak0.pk3/scripts/gfx.shader.

Code:
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
   }
}

Author:  gooball :D [ 10-03-2012 02:49 AM ]
Post subject:  Re: New Weapon Explosion Shader

Haha, WOW I'm blind. Thanks anyway :D

Author:  themuffinman [ 10-03-2012 09:30 AM ]
Post subject:  Re: New Weapon Explosion Shader

So you haven't coded it in either? It's declared in cg_local.h:
Code:
   qhandle_t   rocketExplosionShader;


cg_weapons.c::CG_RegisterWeapon gets the game to load the shader and other weapon projectile assets into memory during level loading:

Code:
...
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:
...
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;
...

Page 1 of 1 All times are UTC - 8 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/