BAM BAM Update v340

ravarcade

Pinball Wizard
Joined
Feb 8, 2020
Messages
101
Reaction score
232
Points
49
Favorite Pinball Machine
AFM

Demo table:

Changes:
- ray cast shadows can be enable per table (not global)

- if light source is inside ball it will not cast shadow

- script: LightExt.EnableRayCastShadows (only for flashers)
You can disable shadows for selected flasher with:
FlasherNameExt.EnableRayCastShadows = False
Value of variable can be read too:
If FlasherNameExt.EnableRayCastShadows Then do something
If Not FlasherNameExt.EnableRayCastShadows Then do something
or toggled On/Off
FlasherNameExt.EnableRayCastShadows = Not FlasherNameExt.EnableRayCastShadows

- script: xBAM.RayCastShadows.Enable
Enable shadows:
xBAM.RayCastShadows.Enable = True
Check if not enabled (and enable if not):
If Not xBAM.RayCastShadows.Enable Then xBAM.RayCastShadows.Enable = True

- script: xBAM.RayCastShadows.Sharpness
Can be read and set:
xBAM.RayCastShadows.Sharpness = 0.8
xBAM.RayCastShadows.Sharpness = xBAM.RayCastShadows.Sharpness - 0.2

- script: xBAM.RayCastShadows.DarkLevel (defaul value = 0.0)
Can be read and set:
xBAM.RayCastShadows.DarkLevel = 0.0
xBAM.RayCastShadows.DarkLevel = xBAM.RayCastShadows.DarkLevel - 0.2
I don't recomend to set values lower than 0.0. With value above 0.0 shadow will still get some light.

- script: xBAM.RayCastShadows.Set sharpness, darkLevel
Use it to enable Ray Cast Shadows and set desired params from script. If you skip darkLevel it will be set to zero.
xBAM.RayCastShadows.Set 0.8


Code below will check if ray cast shadows are enabled. If not will enable it and set default values, but if they are already enable, user will be able to change params.
If Not xBAM.RayCastShadows.Enable Then xBAM.RayCastShadows.Set 0.8 -0.1
 
Last edited by a moderator:
@ravarcade

Thank you so much rav for adding this feature. It was hard to fully explain to you what I was trying to do. Thanks to @Wylte for his excellent VPX method of dynamic ball shadows, I was able to explain it visually what I was going for. So glad you came back with an amazing solution that uses BAM's New Renderer that simply works automatically.... and looks so sexy!


To help explain to others how this works:

- "ray casting ball shadow" means a realtime dynamic ball shadow that reacts to all hardware lights (flashers) automatically, and also reacts to all other lights that have shadowmaps enabled.
- the casting is based on the 3d position (x/y/height) of the light source's "model"
- so if you have use a detached flasher hidden with the light source positioned elsewhere... then the location of the model is where the ray casting is calculated from.
- for flashers with no shadowmap, the brightness / colour is all that will affect the ray cast of the ball shadows
- for all other lights, all settings of the shadowmap will directly affect the ray cast of the ball shadows.
- shadowmaps are not dynamic (they won't change during gameplay)
- ray cast ball shadows ARE dynamic and completely change / project correctly based on lighting, etc throughout gameplay
- both shadowmaps and ray cast ball shadows are displayed ONLY on the main playfield texture! The shadows are rendered as part of the playfield texture. This means the shadows won't display over holes, decals, overlays, or other surfaces / objects.


Does this mean that ALL tables will look super cool with ray casted ball shadows?

- it depends on the table
- old tables not updated to use BAM shadowmaps will only show ball shadows casted from flashers on the table
- new BAM based tables with shadowmpas can use ray casting nicely... but this will depend on how the author created the lighting and shadowmaps
- most tables will need to be updated to "properly" make use of both shadowmaps and ray casting
- some tables may need to have a little bit of code added to disable undesired ray casting for specific flashers
- playfield art with darker colours won't show shadows as well a bright colourful images
- BAM's lighting and Post Processing (and all other lighting) will have a big effect on how visible ray casting and shadowmaps will be

NOTE:

- ray casting is a more modern rendering feature that may use much more of your GPU
- this means you need a fairly decent video card to be able to use it (something that isn't up to 10 years old and is not slow)
- when testing Silent Hill in cabinet mode in 4K, my nVidia GTX 1080 went from 50% usage (no ray casting) to 90% usage with ray casting enabled (keep in mind I'm using a lot of lights and shadowmaps on Silent Hill)


I'm updating Silent Hill's lighting specifically for this, as it looks stunning when done right. Maybe I'll do a before and after video.


Here is a simple quick example of enabling ray cast shadows to the Seawitch table that was already updated nicely for BAM shadowmaps by @JLou5641 . All I did was darken BAM's Post Processing to allow the shadows to be more visible, and enabled Ray Casting.
 

Attachments

  • SW DF2 test and DBS.mp4
    38.8 MB
Last edited:
Updated credit to JLou :)

NOTE:

- ray casting is a more modern rendering feature that may use much more of your GPU
- this means you need a fairly decent video card to be able to use it (something that isn't up to 10 years old and is not slow)
- when testing Silent Hill in cabinet mode in 4K, my nVidia GTX 1080 went from 50% usage (no ray casting) to 90% usage with ray casting enabled (keep in mind I'm using a lot of lights and shadowmaps on Silent Hill)
 
Thanks for credits, it was only a little thing ;)
- when testing Silent Hill in cabinet mode in 4K, my nVidia GTX 1080 went from 50% usage (no ray casting) to 90% usage with ray casting enabled (keep in mind I'm using a lot of lights and shadowmaps on Silent Hill
Aouch! 50% with a 1080 without ray casting... 😅😅. I hope it will work good.. Today, I Always have stutterring with actual pinevent table on my Pincab with Ryzen 5 and 1660ti. And no stutterring when pinevent DMD/BG is disabled.
 
Well, he said 4k! I don't expect THAT much GPU usage on fullHD which is what most people still use anyway.
 
yep.. I forgot to mention i play in 4k on my pincab. 1660ti is little less powerfull than 1080
 
I test all tables on my HD system with an older i5 2500K, GTX 970 and all Pinevent tables with FullDMD and Backglass. Never had a problem with stuttering. Be sure you have PUPStream and the FP Backglass and Arcade mode disabled for PinEvent tables.

Haven't tried ray casting yet on that system though.
 
Last edited:
Keep in mind... when I say that GPU usage went up a lot more with ray casting... that isn't a "bad" thing.

It just shows that FP, (being very old tech) isn't using our more modern GPU's as much as it could (VPX uses even less). ravarcade's New Renderer uses our GPU's more than normal FP for better lighting and shaders.... but up until now that would only use so much of the GPU as well. This new Ray Cast feature is simply making use of parts of our GPU that was probably never used before with FP-BAM.
 
Last edited:
Oh, and this version of BAM also fixes a long running (previously unknown) bug in BAM that prevented shadowmaps from changing colour to match the colour of their light. Before whatever colour that was set in the FP Editor was the only colour the shadowmap would ever use.

Now you can change colours of the light in script and the shadowmap for that light will also change its colour!
 
Keep in mind... when I say that GPU usage went up a lot more with ray casting... that isn't a "bad" thing.

It just shows that FP, (being very old tech) isn't using our more modern GPU's as much as it could (VPX uses even less). ravarcade's New Renderer uses our GPU's more than normal FP for better lighting and shaders.... but up until now that would only use so much of the GPU as well. This new Ray Cast feature is simply making use of parts of our GPU that was probably never used before with FP-BAM.
if now FP use new instructions from GPU, in this case, you're right it's a good news that GPU load up to 90%. 😀.
But for now.. NVIDIA doesn't support RTX function for Opengl, so Ray casting will not calculated by RTX function for those have an RTX..
 
Just when I thought all was lost..
I was starting to think BAM was now focusing on 3D models of a dancing Batman!
@ravarcade, Who can thank you enough for what you do! I don't think it is possible!
So I will quote @wild... "No BAM No Play"...
Thank you for making FP awesome!, cheers!
 
nice !!!
next step pinball reflection in the ball?
(yeah i asked you few years ago :p)
 
Rav, your demo file is not downloadable (at least on Chrome) can you or someone else put up a zipped file instead please?
 
Rav, your demo file is not downloadable (at least on Chrome) can you or someone else put up a zipped file instead please?

I just used Chrome and it works fine. You need to Right Click the link and Choose "Save Link As"
 
Silent Hill (PinEvent)

- BAM Ray cast and shadowmaps and newer lighting update

This video shows off the new feature very nicely. I added shadowmaps to more of the lights, and also changed most lights to flashers instead of bulbs.

For the flashers I use for G.I., I disabled the ray casting, as I only want to cast shadows from the other GI bulbs.

Since Silent Hill is different in that it changes the playfield / ramps / wireramps / lights / flashers at different point in gameplay... I needed to use extra lights that work for only shadowmaps at certain times (and not for lighting) as the shadowmaps use the position of the light model, not where they are in a mini playfield.

Turned out great and looks so much nicer on the later levels as well.

 
- script: xBAM.RayCastShadows.DarkLevel (defaul value = 0.0)
Can be read and set:
xBAM.RayCastShadows.DarkLevel = 0.0
xBAM.RayCastShadows.DarkLevel = xBAM.RayCastShadows.DarkLevel - 0.2
I don't recomend to set values lower than 0.0. With value above 0.0 shadow will still get some light.
I don't understand this. It says to not go below 0 yet the example has -0.2. Anyone understand this? ...Or does he mean to not go above 0? I get an "unexpected end of statement" script error when I set the value to 0 or a positive number. A value of -0.9 produces very long and dark ball shadows. I presume he means to not enter 0 or higher.

I have also have a new problem. A table will only play once when the editor is open. If I press escape while playing the table, go back to the editor and try to play it again, the table crashes.
 
@GeorgeH

I remember hitting that problem.. I don't remember what it was. In any case here's how you can set the values after you find what you like in BAM Menu - Addons - Config Ball & Shadows (long version for example purposes of course):

Code:
    If Not xBAM.RayCastShadows.Enable Then
        'xBAM.RayCastShadows.Set sharpness, darklevel : AddDebugText "enabled from script"
        xBAM.RayCastShadows.Set 0.5, -0.2 
        'xBAM.RayCastShadows.Sharpness = 0.5
        'xBAM.RayCastShadows.DarkLevel = -0.2
    End If
 
@GeorgeH

I remember hitting that problem.. I don't remember what it was. In any case here's how you can set the values after you find what you like in BAM Menu - Addons - Config Ball & Shadows (long version for example purposes of course):

Code:
    If Not xBAM.RayCastShadows.Enable Then
        'xBAM.RayCastShadows.Set sharpness, darklevel : AddDebugText "enabled from script"
        xBAM.RayCastShadows.Set 0.5, -0.2
        'xBAM.RayCastShadows.Sharpness = 0.5
        'xBAM.RayCastShadows.DarkLevel = -0.2
    End If

OK I think I get what was happening. Rav gave this example above that I was using:
If Not xBAM.RayCastShadows.Enable Then xBAM.RayCastShadows.Set 0.8 -0.1

It needs the comma:
If Not xBAM.RayCastShadows.Enable Then xBAM.RayCastShadows.Set 0.8, -0.1

It is odd that it worked when I used a negative number without the comma.
 
Right. It worked because it was interpreted as x - y not as two sets of numbers.
 
I noticed the ball shadows are extremely long. Is there a way to shorten them? I think it would help on Space Shuttle because there are some light blue areas on the playfield where the shadows show up extremely well and the there are areas with white crosshatching where the shadows don't show up very well at all. The shadows almost look like there is a strobe effect when the ball goes over the playfield depending on where the shadows hit.
 
As you can see the red arrow in the screen shot points to the ball shadow that casts across half the length of the table. The shadow seems to be cast too far to me.

Space Shuttle 1.3 New Bounce Option.png
 
For lights with shadowmaps... you will need to adjust the shadowmap settings so they won't have a long range effect. Things like radius / brightness,etc. Some lights you will want to disable ray cast shadows. Flashers automatically work without shadowmaps... and in some cases you may not want to use shadowmaps with them if you already have bulbs in the same area. For me I disabled ray cast shadows for all my G.I. flashers.

This is where having multiple light "presets" can be a problem, as you will want all your lights and shadowmaps tuned correctly to work with ray cast shadows as well. The brightness of your lights will have an effect as well on the ray cast shadows.

Here's my settings so far for Silent Hill.

Keep in mind the Post Processing values change up for different parts of the game. Also, since this table changes up the playfield ramps and some lights, I needed to use "duplicate" bulbs to provide a model position for their shadowmaps because the original light model is actually off screen and gets moved around in a miniplayfield.


1639519303894.png
 
For lights with shadowmaps... you will need to adjust the shadowmap settings so they won't have a long range effect. Things like radius / brightness,etc. Some lights you will want to disable ray cast shadows. Flashers automatically work without shadowmaps... and in some cases you may not want to use shadowmaps with them if you already have bulbs in the same area. For me I disabled ray cast shadows for all my G.I. flashers.

This is where having multiple light "presets" can be a problem, as you will want all your lights and shadowmaps tuned correctly to work with ray cast shadows as well. The brightness of your lights will have an effect as well on the ray cast shadows.

Here's my settings so far for Silent Hill.

Keep in mind the Post Processing values change up for different parts of the game. Also, since this table changes up the playfield ramps and some lights, I needed to use "duplicate" bulbs to provide a model position for their shadowmaps because the original light model is actually off screen and gets moved around in a miniplayfield.

Thanks! The shadow in the screenshot wasn't caused by a flasher but the light appears to come from a bulb that has a shadow map. I will try making some adjustments to the shadow map.
 
Forum activity
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.
      Mibs Mibs: JonPurpleHaze has posted a new reply in the thread "What music are you listening to?".
      Back
      Top