Author Topic: What is muzzleFlash & how to work with it?  (Read 405 times)

0 Members and 1 Guest are viewing this topic.

bitterman

  • Sr. Member
  • ****
  • Posts: 309
  • Karma: +8/-5
  • Doom Newbie
    • View Profile
What is muzzleFlash & how to work with it?
« on: June 02, 2017, 11:14:53 AM »
Sorry can't find any info relating to D3.

Perhaps this is obviuos thing but no luck for me.

Thanks.

The Happy Friar

  • Happy Happy Joy Joy
  • Administrator
  • Hero Member
  • *****
  • Posts: 897
  • Karma: +42/-4
  • Semi-Newbie.
    • View Profile
    • EarthQuake
Re: What is muzzleFlash & how to work with it?
« Reply #1 on: June 02, 2017, 09:26:31 PM »
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

  • Sr. Member
  • ****
  • Posts: 309
  • Karma: +8/-5
  • Doom Newbie
    • View Profile
Re: What is muzzleFlash & how to work with it?
« Reply #2 on: June 03, 2017, 10:39:40 PM »
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.
« Last Edit: June 03, 2017, 10:46:10 PM by bitterman »

bitterman

  • Sr. Member
  • ****
  • Posts: 309
  • Karma: +8/-5
  • Doom Newbie
    • View Profile
Re: What is muzzleFlash & how to work with it?
« Reply #3 on: June 04, 2017, 11:07:37 AM »
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].
« Last Edit: June 04, 2017, 11:13:06 AM by bitterman »