BAM Shadow maps 101?

madmrmax

Weeeeeee
Site Supporters
Joined
Sep 21, 2017
Messages
519
Solutions
2
Reaction score
250
Points
75
Favorite Pinball Machine
Indiana Jones (Williams)
Hey all - is there a good overview of BAM shadow maps at the 100 level? I know about @Paolo 's article about using script to dynamically load the TGA shadow maps, but the 100 level course I'm interested in is probably already sprinkled about here and there, but perhaps it was on gopinball.

Basics:
  • Is there a flag to have BAM auto-generate shadow maps on first load?
  • how does shadow maps and "ball shadows" work -- are they the same thing?
  • Should shadow maps be only used for GI (general illum) bulbs?
  • Do shadow maps work with light sequencers? (if I have a light sequence on some bulbs (not inserts) will the shadow map correctly follow? Perhaps answered if shadow maps are only for GI)
  • BAM menu walk through on how to manually create shadow maps
thanks!
-mark
 
Shadowmaps are both a combined shadow and light map that BAM can generate for any light on the table that is a bulbs or flashers.

RayCast Ball shadows (if enabled) work automatically with all flashers (with or without a shadowmap). To use them with a bulb type of light, you must have a shadowmap enabled for that bulb (which determines how the ray cast ball shadow will work with the bulb).

To create a shdowmap:

- run the table
- open bam menu
- Dev menu / Shadowmaps
- goto your flasher or bulb, and add shadowmap
- note, that BAM will turn off all lights on the table to highlight that light and the shadowmap easier (it won't turn the lights back on again for you)
- edit the shadowmap settings until you get the lok you want. If ray cast is enabled, you can see how that will look with the ball using ball controller to move the ball around
- you may need to choose apply settings
- do this for every light you want to have a shadowmap
- when done, choose CTRL+C to copy the settings to the clipboard
- if you can open notepad, CTRL+V to paste the Shadowmap settings to it if you'd like
- exit the table and CTRL+V to paste the Shadowmaps settings to your script
- save the table, exit FP and reload to test with new shadowmaps

Saving all shadowmaps to a single TGA file (for quick loading)

- once you are happy with the shadowmaps / ray cast shadows and you know you will not be changing them anymore, you can choose to save them to a single TGA file from the BAM Shadowmaps menu
- this is saved to same folder as the table file, and named same as the table file with -shadows.TGA on the end
- then import this TGA file to Texture Manager
- this file can be named what you want. I normally rename it Shadowmaps-shadows
- save the table
- if you wish to make changed to the table's lights, you may need to delete this file and regenerate the TGA and reimport it again based on your new lights

BAM normally does the following on table startup (in order):

- looks to see if all shadowmaps have been saved to a single TGA file and added to Texture Manager. If found, this is used and Shadowmaps will not need to be generated, as this file contains all the shadowmaps already
- if a shadowmaps TGA file is not found in texture manager, then BAM will check the BAM \ cache folder for a file that contains the shadowmaps for the table (named the same as the table filename). If this file is found then Shadowmaps are already generated and ready to load and use. If not found, then BAM will generate all the shadowmaps the first time the table loads, and saves them to the BAM \ cache folder


You can use Shadowmaps for GI and flashers. I like to do both where it works well. Sometimes, adding shadowmaps to "every" G.I. light is not ideal, as it may oversaturate the playfield image with the "light" portion it renders, and you may not see the shadows at all, etc. You will want to test how the ray cast shadows look as well. They should not be casting too far from the light.

Look at my examples used in tables like Jaws Bigger Boat Edition to get an idea of what settings to use.

 
Last edited:
Thanks @TerryRed. On a side note, your responses to questions are usually top notch and I think many of them could be written up into standalone guides. Your response here as well as things like "how to RIP voice overs from movies" (link). Of course, you have all this awesome knowledge/have learned it when creating new or updating other tables to your PinEvent quality tables. Would you be ok and interested if someone pulled out any details and created new guides based upon that?

Perhaps it could be done by having someone create a shared google docs/word doc with the topics and text and images, and then you can actually copy and paste from there into new posts (to show you are the author of the guide). Just something to consider.

-mark
 
Shadowmaps are both a combined shadow and light map that BAM can generate for any light on the table that is a bulbs or flashers.

RayCast Ball shadows (if enabled) work automatically with all flashers (with or without a shadowmap). To use them with a bulb type of light, you must have a shadowmap enabled for that bulb (which determines how the ray cast ball shadow will work with the bulb).

To create a shdowmap:

- run the table
- open bam menu
- Dev menu / Shadowmaps
- goto your flasher or bulb, and add shadowmap
- note, that BAM will turn off all lights on the table to highlight that light and the shadowmap easier (it won't turn the lights back on again for you)
- edit the shadowmap settings until you get the lok you want. If ray cast is enabled, you can see how that will look with the ball using ball controller to move the ball around
- you may need to choose apply settings
- do this for every light you want to have a shadowmap
- when done, choose CTRL+C to copy the settings to the clipboard
- if you can open notepad, CTRL+V to paste the Shadowmap settings to it if you'd like
- exit the table and CTRL+V to paste the Shadowmaps settings to your script
- save the table, exit FP and reload to test with new shadowmaps

Saving all shadowmaps to a single TGA file (for quick loading)

- once you are happy with the shadowmaps / ray cast shadows and you know you will not be changing them anymore, you can choose to save them to a single TGA file from the BAM Shadowmaps menu
- this is saved to same folder as the table file, and named same as the table file with -shadows.TGA on the end
- then import this TGA file to Texture Manager
- this file can be named what you want. I normally rename it Shadowmaps-shadows
- save the table
- if you wish to make changed to the table's lights, you may need to delete this file and regenerate the TGA and reimport it again based on your new lights

BAM normally does the following on table startup (in order):

- looks to see if all shadowmaps have been saved to a single TGA file and added to Texture Manager. If found, this is used and Shadowmaps will not need to be generated, as this file contains all the shadowmaps already
- if a shadowmaps TGA file is not found in texture manager, then BAM will check the BAM \ cache folder for a file that contains the shadowmaps for the table (named the same as the table filename). If this file is found then Shadowmaps are already generated and ready to load and use. If not found, then BAM will generate all the shadowmaps the first time the table loads, and saves them to the BAM \ cache folder


You can use Shadowmaps for GI and flashers. I like to do both where it works well. Sometimes, adding shadowmaps to "every" G.I. light is not ideal, as it may oversaturate the playfield image with the "light" portion it renders, and you may not see the shadows at all, etc. You will want to test how the ray cast shadows look as well. They should not be casting too far from the light.

Look at my examples used in tables like Jaws Bigger Boat Edition to get an idea of what settings to use.

On the topic of shadow maps, I've seen a few comments by you about "shadow maps don't take X Y or Z object type into consideration". Do you feel like you know what object types are "honored" vs. not?


I'm curious if shadow maps honor custom models regardless of type (e.g. custom toy vs. custom ornament, etc)

In my TOM remake, I'm recreating the ball guides to have the 7mm gap at the bottom cutouts that allows for GI lights to shine through and highlight the playfield. I've not gotten the guides to a point yet where I'm adding it to the table and generating shadow maps, but I was considering to have the custom model just be an ornament instead of having per-polygon collision, and use an invisible FP wall. This is a technic that I've seen done in the VPX version of TOM.

But I'm wondering about impact on shadow map as well as ray cast shadows.
1705700584169.png
 
Shadowmaps will be created based on the FP table items and "FP models" that are visible. If the object was placed within the playfield in the FP editor, and is still there when the table starts, it should affect shadowmaps.

If something is placed outside the playfield and is relocated using a miniplayfield, that has no effect on shadowmaps.

BAM Custom models (FBX / OBJ) have no effect on Shadowmaps.
 
Shadowmaps will be created based on the FP table items and "FP models" that are visible. If the object was placed within the playfield in the FP editor, and is still there when the table starts, it should affect shadowmaps.

If something is placed outside the playfield and is relocated using a miniplayfield, that has no effect on shadowmaps.

BAM Custom models (FBX / OBJ) have no effect on Shadowmaps.
ok that seems to be an ok limitation. Looks like I won't get shadow maps for the "mirror" reflection in TOM, but everything else should be ok.

Should shadow maps work for all objects on the miniplayfield? I'm wondering if your comment is that objects on a miniplayfield is not affected\taken into effect by shadowmaps on other playfields/main playfield.
 
What you see in the FP Editor that is located within the playfield is what effects shadowmaps.
 
Regarding shadow maps -- There was some discussion back in 2023 that sometimes shadowmaps wouldn't show up for certain bulbs. There definitely seems to be some sort of "limit" but I don't know if it is variable and what is the primary constraint.

Based upon how I order the ShadowMap call in BAM_Init some of my bulbs won't use the created shadow map.

@ravarcade - is there an actual hard coded limit or is it all variable?
 
Regarding shadow maps -- There was some discussion back in 2023 that sometimes shadowmaps wouldn't show up for certain bulbs. There definitely seems to be some sort of "limit" but I don't know if it is variable and what is the primary constraint.

Based upon how I order the ShadowMap call in BAM_Init some of my bulbs won't use the created shadow map.

@ravarcade - is there an actual hard coded limit or is it all variable?

I have found they work on all bulbs, including slingshots. They are supposed to work on flashers but I have never added them. I don't what the problem was on the previous question.

The problem that can occur is they may not look like they work because of bright lighting that washes out the shadow map. There are also some playfield textures that don't work as well. Try going brighter on the shadow maps and darker on the table lighting. You might try the settings I used on Attack From Mars. Those settings usually work. You might try replacing the playfield texture with a solid white texture just to see if it works. On Attack From Mars, I have 4 different lighting settings. When you change to the brighter settings like on Day mode, the shadow maps are not as obvious.

I have just recently found that increasing Reflection to 0.25, the Brightness could be set to 0.5.

xBAM.ShadowMap "LeftSlingshotBulb1", 1500, 1, 0.5, 0.5, 2, 0, 0.25

If you set Reflection to something far above 0.25, you will probably find the shadow maps overpower the playfield texture so you can't even see it.
 
General chit-chat
Help Users
You can interact with the ChatGPT Bot in any Chat Room and there is a dedicated room. The command is /ai followed by a space and then your ? or inquiry.
ie: /ai What is a EM Pinball Machine?
  • No one is chatting at the moment.
  • Chat Bot Mibs Chat Bot Mibs:
    DrazeScythe has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Torntabittz has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    brotherboard has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    GARRY040 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    BL2K has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Chilldog has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    rodneyfitz has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    ace19120 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Tomasaco has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Greek_Jedi has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Beermano has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    02browns has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    nitram1864 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    aeponce has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    JEAN LUC has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    lorenzom has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    maxangelo19 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Dragonslapper has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    royaljet has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Tyfox has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Goldtopboy has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    slick267 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    dabreeze has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Spike has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Tofa has left the room.
      Chat Bot Mibs Chat Bot Mibs: Tofa has left the room.
      Back
      Top