Register    Login    Forum    FAQ    PinSimDB.org

Board index » Future Pinball » BAM corner




Post new topic Reply to topic  [ 12 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Shadows on playfield.
 Post Posted: Mon May 14, 2018 3:50 pm 
Offline

Joined: Mon Mar 25, 2013 4:02 pm
Posts: 928
Files:
1. beta BAM.dll with shadow maps: http://www.ravarcade.pl/beta/BAM.dll
2. demo table: http://www.ravarcade.pl/beta/shadowmaps-demo.fpt
------------------------------------------
Videos:
How to add shadow maps: https://youtu.be/o2zNDU0J4bk
Old preview video: https://youtu.be/V2qmRNKzd_I
------------------------------------------
Feature list:
- shadows are cast ONLY at playfield.
- shadows are create from "shadow maps" generated in BAM at start ... or ... they are loaded from BAM/Cache dir ... or ... they are loaded from special "TGA" texture from main FPT file.
- shadow are good quality (see video).
- flashers and bulbs can generate shadow maps.
- ambient light shadow maps.
- in same time, you can have up to 7 active flashers with shadow maps and up to 22 bulbs. Bulbs light is only visible on playfield (not on other objects).
In FP only flasher can be light source, all other "lights" don't cast light to other objects, they can only create flares.
- you can have shadow maps generated for all flashers and bulbs (even for 100). Limit to 7/22 is set for active in same time.
- if player don't use "new renderer" and shadow maps are used on table, playfield will be drawed like in "new renderer" (only playfield).
- impact in game FPS should be close to 0.
- shadow maps resolution is 2048 x 1024 (i don't think, that higher resolution will be visible).
------------------------------------------
Tips:
- not every table need shadow maps. Don't try to add it to all. This feature is more for table devs than for end users.
- if you have on table "fake playfield surface" visible for player, you will not see real playfield texture. You may need to remove it.
------------------------------------------
How to add shadow maps.
First, see video. On video is:

1. Where in BAM menu is "Shadow maps" menu.

2. How to select light source (flasher or bulb).
All flashers and bulbs can be selected in menu.
They are sorted alphabetically, buf flashers first, when bulbs.
When you select on light source BAM will try to turn off all other lights and turn on selected one. (Script can still turn on/off lights, so script can interfere here).
You can add new shadow map or delete old one.

3. How to add permanently shadow maps to table.
In short add to script set of xBAM.ShadowMap command. Maps generated from BAM menu are not stored.
Use CTRL-C in BAM menu and CTRL-V in script.
xBAM.ShadowMap commands must be placed inside BAM_init subroutine. If you already have somthing in that subroutine, just merge it.

4. When you run table with shadow maps commands in script. Shadows are calculated then table is starting.

5. Genereated shadowmaps are stored in BAM/Cache dir in zips.
So, if you run (F5) table with shadow maps second time. Shadows are loaded from cache (not calculated again).

6. Table dev can add generated shadow maps to table. So, end user will not have to wait for calculations (only for load).
To add it, table dev need to:
- use "save as TGA" command in BAM menu. This command will store shadowmaps in BAM/Cache and "tableName-shadows.tga" in table dir.
- add "tableName-shadows.tga" as texture. Name of that texture must end with "-shadows". If you rename it from "tableName-shadows" to "shadows-something" it will not work, but to "BAM-shadows" it will work.
- remeber to save table to disk. BAM will load it from disk. So, if you only add it to texture manage but not save it on disk, BAM will not find it.
------------------------------------------
Order where BAM will search for shadow maps:
1. try to load from "*-shadows" texture from table.
2. try to load from BAM\Cache.
3. generate it (and save it in BAM\Cache).
Note. You have "set of all shadow maps params" in script. If that params are different than set stored in BAM/Cache or in texture managee, BAM will not use maps from Cache. It will generet new.
------------------------------------------
Prams in BAM menu:
- Amount [4 - 2000] - how dark is shadow. In most cases 1000 will make center of shadow 100% dark. If you set it higher, edges become more dark.
- Passes [1 - 10] - number of shadows calculation passes. You may see "gradient" on shadow calculated in one pass. You can use higher value to calc averge shadows and remove that gradient. It has no impact how dark shadows are. Higher value -> long calculation time.
- Radius [0.1 - 20.0] - radius of light source. Higher value -> blured edges of shadows. Smaller value -> sharp edges
----- side note begin ----
3 params above are used to calc shadow maps. So, to see effect, you need to execute "* Update *".
----- side note end ----
- Brightness [0.001 - 1000] - well... you know
- Spotlight range [0.001 - 10] - you can change "range" of that spot light
TIP: you can set Brightness low ans Spotlight range high. You will see big spot light, but it will add only littlebit of light.
TIP 2: you can have different spotlight range for different lights.
- White light [0.0001 - 10] - only for bulbs - you for example bulb is RED (rgb: r=200 g=0, b=0) you can add some "white light" to it and make it little brighter. FP does it.
- Reflection [0.0001 - 10] - only for bulbs - light from bulb will make "playfield" color visible, but what will happend if "playfield" is black? So, part of final color can be just color of light source.
------------------------------------------
You should now try BAM menu. It will not break table.

Params from BAM menu are used in xBAM.ShadowMap command in same order.
------------------------------------------
Ambien Light:
It is alway first position on shadow maps list. This shadow map is applied to main light, but shadows dont depend on main light position.

Source of ambient light is big disk, hovering over playfield.
You can decide about:
- Radius of this disk
- Altitude - distance between this disk and playfield
- At edges - how light sources are distributed over this disk. Value < 60 = more at center, 60 = uniformly on the surface, > 60 = more "at edges"
Here is gif with visualisation:
Image

Here is gif with how shadow maps on playfield will look with different "At edges" param:
Image

Here is impact on shadow for different "Radius" values:
Image

... and visalisations for..
Amount:
Image
Passes:
Image

--------------------------------------------
BONUS.
This beta BAM.dll will fix HUGE memory leak in FP. How huge is this leak?
When you only load "New table" in FP editor (before you start game) FP will have ~560 MB free memory.
With new BAM (v215) you do same thing, and FP will have 1.5 GB free memory.
I hope it will solve some of FP crashes.

_________________
http://www.ravarcade.pl
Better Arcade Mode
current BAM version: v1.4-240, released: Aug 16, 2018


Last edited by ravarcade on Wed Jun 13, 2018 3:27 pm, edited 5 times in total.

Top 
 Profile  
 
 Post subject: Re: Shadows on playfield.
 Post Posted: Mon May 14, 2018 6:00 pm 
Offline

Joined: Thu Aug 16, 2012 11:12 pm
Posts: 1649
Location: Arkansas, USA
Wow! That is very impressive! The light seems to cast natural shows. From what you say, BAM creates its own shadow map and the table author would not have to create it manually?

George


Top 
 Profile  
 
 Post subject: Re: Shadows on playfield.
 Post Posted: Tue May 15, 2018 8:29 am 
Offline

Joined: Mon Jan 27, 2014 12:36 pm
Posts: 2083
Location: Ontario, Canada
That looks amazing !
Well done Rav!


Top 
 Profile  
 
 Post subject: Re: Shadows on playfield.
 Post Posted: Tue May 15, 2018 6:20 pm 
Offline
User avatar

Joined: Thu Jul 01, 2010 3:02 pm
Posts: 262
:shock: amazing work! Looks great!

-mark


Top 
 Profile  
 
 Post subject: Re: Shadows on playfield.
 Post Posted: Tue May 15, 2018 10:32 pm 
Offline

Joined: Tue May 01, 2012 11:13 pm
Posts: 325
Location: Abbotsford
Very nice. very very nice. Looks quite good, and saves me time in photoshop doing static shadows. These are dynamic and if I got this right only flashers can be used right? Hmmm, looks like I will be changing some bulbs to flashers shortly.

_________________
_____________________________________

Latest projects and rants at My Facebook Page
_____________________________________

Latest Project: FPx Template Engine


Top 
 Profile  
 
 Post subject: Re: Shadows on playfield.
 Post Posted: Wed May 16, 2018 12:59 pm 
Offline
User avatar

Joined: Sun May 08, 2011 4:57 pm
Posts: 1063
Location: Turin-ITALY
ravarcade wrote:
......In FP only flasher can be light source, all other "lights" don't cast light to other objects, they can only create flares........


If I create a flash model with bulb dimensions, can I use this feature?

Congratulations for the work you did. It sounds very interesting........

Greetings

Gianfranco


Top 
 Profile  
 
 Post subject: Re: Shadows on playfield.
 Post Posted: Wed May 16, 2018 1:18 pm 
Offline

Joined: Mon Mar 25, 2013 4:02 pm
Posts: 928
It is not finished yet.
Now i work on bulb light. You don't need to replace bulbs with frashers. Don't worry.

_________________
http://www.ravarcade.pl
Better Arcade Mode
current BAM version: v1.4-240, released: Aug 16, 2018


Top 
 Profile  
 
 Post subject: Re: Shadows on playfield.
 Post Posted: Wed May 16, 2018 10:16 pm 
Offline

Joined: Tue May 01, 2012 11:13 pm
Posts: 325
Location: Abbotsford
ravarcade wrote:
It is not finished yet.
Now i work on bulb light. You don't need to replace bulbs with frashers. Don't worry.


Very very very cool. ;)

_________________
_____________________________________

Latest projects and rants at My Facebook Page
_____________________________________

Latest Project: FPx Template Engine


Top 
 Profile  
 
 Post subject: Re: Shadows on playfield.
 Post Posted: Fri May 18, 2018 4:31 pm 
Offline

Joined: Thu Aug 16, 2012 11:12 pm
Posts: 1649
Location: Arkansas, USA
Rav,

I was thinking that the "shadow maps" generated in BAM might be saved to the fpRam file for the table. This might save time when the table is loaded again. The "shadow maps" would only need to be generated one time that way. Of course, you probably already thought about this.

George


Top 
 Profile  
 
 Post subject: Re: Shadows on playfield.
 Post Posted: Tue May 29, 2018 11:58 am 
Offline

Joined: Mon Mar 25, 2013 4:02 pm
Posts: 928
First post is update.

Beta BAM.dll (v215)
Files:
ttps://www.ravarcade.pl/beta/BAM.dll
https://www.ravarcade.pl/beta/shadowmaps-demo.fpt

Video "how to add shadow maps"
https://youtu.be/o2zNDU0J4bk

BONUS.
This beta BAM.dll will fix HUGH memory leak in FP. How huge is this leak?
When you only load "New table" in FP editor (before you start game) FP will have ~560 MB free memory.
With new BAM (v215) you do same thing, and FP will have 1.5 GB free memory.
I hope it will solve some of FP crashes.

_________________
http://www.ravarcade.pl
Better Arcade Mode
current BAM version: v1.4-240, released: Aug 16, 2018


Top 
 Profile  
 
Display posts from previous:  Sort by  
 
Post new topic Reply to topic  [ 12 posts ]  Go to page 1, 2  Next

Board index » Future Pinball » BAM corner


Who is online

Users browsing this forum: Google Adsense [Bot] and 7 guests

 
 

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron