Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.


Dark Dreams of Furiae - a new module for NWN:EE! Buy now
Attention, new and old users! Please read the new rules of conduct for the forums, and we hope you enjoy your stay!

Spell animation BAM and Translucent (7) flag

Sam_Sam_ Member Posts: 171

I would like to know how the engine implements transparency/translucency (from a mathematical standpoint) into BAMs that themselves store no Alpha channel transparency information.

Let's take the animation for Magic Missile (SPMAGMIS.BAM) as an example:
This BAM is called via a Projectile (MAGICMIS.PRO) which has the "Translucent (7)" flag set. This flag effectively turns
What is the equation that calculates the alpha channel levels (or is there some quasi-standard filter that is used)?




  • ScottBrooksScottBrooks Member Posts: 687
    This is a great resource.

    We support the following blend modes

    Translucent(7) checked off

    Blended(9) checked off
    glBlendFunc(GL_DST_COLOR, GL_ONE);

    And in IWD
    Translucent(7) and Blended(9)
    glBlendFunc(GL_SRC_COLOR, GL_ONE);

  • Sam_Sam_ Member Posts: 171
    Thank you very much! That was exactly what I was looking for :smile:

    I figured out how to duplicate these blending effects using ImageMagick:

    convert.exe source.ext dest.ext -channel rgba -fx "(u*(1-v))+(v*1)" result.ext
    glBlendFunc(GL_DST_COLOR, GL_ONE);
    convert.exe source.ext dest.ext -channel rgba -fx "(u*v)+(v*1)" result.ext
    Translucent(7) and Blended(9)
    glBlendFunc(GL_SRC_COLOR, GL_ONE);
    convert.exe source.ext dest.ext -channel rgba -fx "(u*u)+(v*1)" result.ext

  • Sam_Sam_ Member Posts: 171

    I have just 2 more related questions, if you would be so kind:

    1) It seems the BAM frame size limit of 255x255 px (or perhaps 256x256 px) has been lifted in the EEs. Can you confirm this?
    2) In which scenarios does the second entry in the BAM's Palette take on the special properties of being the "shadow" color, or does it always?

    Thank you very much for your time!
    - @Sam_

  • ScottBrooksScottBrooks Member Posts: 687
    1: 256x256 has been lifted(ish). If it's compressed the engine still needs to decompress that bam to render it, so going over that should still be avoided. If it's a bamv2, then we can send that data directly to the card, so it renders much faster(but then you skip the fancy effects you can do to a bam)

    2: When the bam is rendering, it asks the palette system how many entries are reserved. If the 2nd entry matches the shadow color of 0x00000000, then it returns 2 Otherwise it returns 1. So basically if the 2nd entry is the shadow color, then it will treat it as such. Otherwise it just uses the 1 reserved entry of the color key green.

  • GalactygonGalactygon Member, Developer Posts: 412
    I did some playing around with the new alpha bit by patching palette entries in WeiDU. You can do some never-seen-before stuff such as this smoke effect.

Sign In or Register to comment.