What is muzzleFlash & how to work with it?

Started by bitterman, June 02, 2017, 11:14:53 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

bitterman

Sorry can't find any info relating to D3.

Perhaps this is obviuos thing but no luck for me.

Thanks.

The Happy Friar

In D3 muzzle flash is the shader that's used to simulate the muzzle flash from a real firearm.  It's a mtr_flashShader in the weapon's def file and there's some poly's in the weapon's md5mesh that use that material.

bitterman

#2
Thanks, I get a start point.

Not clear about base concept about how to engine driven this thing.

mtr_flashShader is just link to lights/round.tga (which is just single radial gradient monochrome  image).

I expected that mF have some deal with film_strip image (which is an analogue of animated gif).

So now I sure about next things:

1. Our plane (quad) in md5mesh  must be named "flash". The engine will search that name.

2. It must have a mtr link to film_strip image.

3. The Code is driven this thing via adds a light (lights/round.tga) from mtr_flashShader in our .def file. Well, not so sure yet ))

4. The world mF and view mF are driven differently.

It is unobvious how to let code know about it's time to on/off muzzleflash. It's not from script.
Some muzzleFlashHandle var in Weapon.cpp.

I expected also that mF will have two states: nodraw ant filmstrip when fire.
But looks like it's  realized differently.

bitterman

#3
Ok, I see, muzzleFlash it's about how it's lights, not how it's looks.

Deal with filmstrip is:

Quote
models/weapons/shotgun/shotgun_mflash
{
   qer_editorimage models/weapons/shotgun/shotgun_mflash.tga
        sort nearest
   deform sprite
   {
      forceHighQuality
      if ( time + parm4 ) * 6.4 < 1.0
      blend add
      map textures/particles/shotgun_mflash_strip.tga
      scale 1 / 32 , 1
      scroll table32[ (time + parm4) * 6.4] , 0
      rotate   rotate90[ parm5 ]
      clamp
   }
}

It's will be visible when "if" expression is true. Some deal with shaderParms[4].