Jump to content



Tutorial info Visit support topic

  • Added on: Apr 28 2021 04:34 PM
  • Date Updated: Apr 13 2022 03:58 AM
  • Views: 4879
 


* * * * *
2 Ratings

RTX (BS) On - Dynamic Ball Shadows

How to implement ball shadows in your table that move away from the ball as it approaches a light source

Posted by Wylte on Apr 28 2021 04:34 PM
Thanks to collaboration with the great minds in the VPin Workshop (VPW), my original idea for moving a shadow circle around has been greatly improved!
 
Introducing VPW Dynamic Ball Shadows: a technique for VPX that simulates the shadows cast by a ball as it moves around a light.  All done within VP - objects that you copy and import into your table, code that you copy into your script, and some basic editor actions.
 
Here's the latest demo table showing off the new-and-improved VPW Dynamic Ball Shadows, with all of the instructions and objects you'll need.
Again, feel free to use and modify however you like, just keep the original credits intact and share any improvements!
Shadow images: Ballshadow, Dynamic Shadow
Materials
 
 
By:
iaakki - apophis - Wylte
 
With help and feedback from (alphabetically):
AstroNasty, Aubrel, baldgeek, Benji, BorgDog, CalleV, HauntFreaks, Rawd, rothbauerw, Skitso, TerryRed, tomate, UnclePaulie, and everyone in VPW
 
Additional thanks to Ninuzzu, JPSalas, and Sliderpoint for their prior work and inspiration.
 
 
 
Original Post:
 
Recently I was playing JPSalas's Black Knight and noticed the ball shadow was only present on the lower playfield.  A couple of quick Ifs and height assignment of the flasher to the ball's z, and bam: shadow on the whole table and ramps.  That got me thinking, though...what else could I do?
I remembered the way Ninuzzo's shadow primitives stretched as the ball moved on the x axis, so I wrote up some code to move the flasher in a similar way.  Then I added the y axis.  Then I repeated the trick of segmenting by z, and tied the "source" of the upper light to the upper playfield bumper.  It actually worked!
...You've seen the title.  I think you can see where I'm going with this.
 
The shadow of the ball now moves in response to EVERY light source (that you want it to!), scaling with intensity and distance!
 
I've written a neat little piece of code that is mostly self-contained (only a collection of flashers, a timer, and a collection with the table's lights) to add to the table to make it work.  There are some included variables to more easily adjust it to the creator/user's taste, as well.  It's built to work alongside the ball shadows in JP's code; this is my personal preference, as it looks more like the shadow is "stretching" away from the ball when both are on.
 
Here is a demo table showing off how it works (saved in 10.7, so you have to import images to make it not look like junk in 10.6), and I've uploaded my CARtoons mod with RTX BS. It's nothing like real ray tracing or fully dynamic lights, but it is a nice effect that I'm really proud of.  I hope this is something people are interested in, and that creators will be able to take advantage of it!
 
Feel free to use and modify however you like, just give me a shout-out somewhere in the code if you do!