Jump to content



Photo
* * * * * 26 votes

WIP: Visual Pinball in Unity


  • Please log in to reply
813 replies to this topic

#181 chepas

chepas

    t.me/horsepin

  • Members
  • PipPipPipPip
  • 1,966 posts

  • Flag: ---------

  • Favorite Pinball: BSD, Tr0n, SW:Stern

Posted 11 March 2020 - 02:52 PM

@freezy. What's the script status of the lamps, bulbs in Unity?

 

State works? Timers?


Bump maps are the new auto-tune :BDH:
VPX - RSS Updates ---- blog.flippingflips.xyz/en/ -- Visual Pinball No.1 (2021) . Est.2000


#182 freezy

freezy

    Member title

  • Members
  • PipPipPipPip
  • 685 posts

  • Flag: ---------

  • Favorite Pinball: T2, TOM, AFM

Posted 11 March 2020 - 03:00 PM

  • Bulbs: Meshes and light sources are created.
  • Inserts: Completely ignored so far.
  • State: Not sure what you mean. We'll probably handle state via ECS components. But there will be an API containing state as well.
  • Timers: We can read and write them. They are only useful with scripting, and we don't know yet how to handle scripting, so they don't do anything. Ideally we would get rid of them altogether, unless someone comes up with a use case that isn't a hack for something that can be solved more elegantly.


#183 dbknightx

dbknightx

    Hobbyist

  • Members
  • PipPip
  • 26 posts

  • Flag: United States of America

  • Favorite Pinball: Lord of the Rings

Posted 11 March 2020 - 03:32 PM

I've been spending quite a bit of time in VPX VR lately, and lighting is the area that seems most lacking to my eyes.  One area in particular is with insert lighting.

 

Do you think it would be overkill to try to model inserts accurately with 3D models and transparent materials?  For example, if we could get 3D models for inserts like these (https://www.pinballl...ld-inserts.html) with proper material and light sources underneath, do you feel that would be worth the effort?

 

If so, I'm happy to do some legwork to see what I can find/come up with.

 

If this would introduce too much performance overhead for too little benefit, I'd understand completely.  Lighting is just so crucial to the VR experience.



#184 chepas

chepas

    t.me/horsepin

  • Members
  • PipPipPipPip
  • 1,966 posts

  • Flag: ---------

  • Favorite Pinball: BSD, Tr0n, SW:Stern

Posted 11 March 2020 - 03:32 PM

 

State: Not sure what you mean

 

The Light state from VP can be set, 0,1,2. If these can be set from the script? Nothing in the "Data" respond, have to Getrenderobjects?

 

 

TableApi.Table.Lights["left_flash12"].Data.State = 0;

TableApi.Table.Lights["left_flash12"].Data.Intensity = 2;


Bump maps are the new auto-tune :BDH:
VPX - RSS Updates ---- blog.flippingflips.xyz/en/ -- Visual Pinball No.1 (2021) . Est.2000


#185 freezy

freezy

    Member title

  • Members
  • PipPipPipPip
  • 685 posts

  • Flag: ---------

  • Favorite Pinball: T2, TOM, AFM

Posted 11 March 2020 - 03:46 PM

@dbknightx: TBH I don't know the performance impact. Flupper described a nice technique in his TOTAN thread for inserts, maybe we can leverage this somehow. The other question is whether Unity is able to deliver the desired effect real-time. I would start with a modeling an insert and testing it in a dummy Unity project. If you got the effect, then duplicate it a few dozen more and see how it's performing.

 

@chepas: Apart from flippers, nothing is runtime dynamic yet. So setting light state or intensity doesn't have any effect.


Edited by freezy, 11 March 2020 - 03:56 PM.


#186 cyberpez

cyberpez

    Enthusiast

  • Silver Supporter
  • 394 posts

  • Flag: United States of America

  • Favorite Pinball: Back to the Future

Posted 11 March 2020 - 08:29 PM

@dbknightx @freezy  I'm doing inserts sorta similar on my KK wip..  I've seen no performance issues with it at all and have been really happy with how its turned out.

 

I'm doing it a little different than Flupper, but the gist is..  Insert text is on the playfield with the actual insert transparent.  I have an inset primitive under the playfield with a light also.  The insert primitive is pretty simple, with just an image.  I added a flasher on top to light the area around the insert and the text a bit.  I'm also doing a little disable lighting on the primitive also.  I'm not changing the image or materials.

 

 

Attached Files



#187 freezy

freezy

    Member title

  • Members
  • PipPipPipPip
  • 685 posts

  • Flag: ---------

  • Favorite Pinball: T2, TOM, AFM

Posted 11 March 2020 - 08:38 PM

@cyberpez Yup, those are very cool techniques. As far as I understood, @dbknightx's question was about performance in case we'd use an actual light source with a material with subsurface scattering as opposed to emissive materials.

 

Unity is very new to me, so I can't speak out of experience, but if someone wants to have a go with just modeling an inset light to see how realistic this could look and how it performs, that would be awesome. As far as I know if you have a Blender or even just an .fbx file, you can simply drop it into Unity and then play around with light and materials.



#188 dbknightx

dbknightx

    Hobbyist

  • Members
  • PipPip
  • 26 posts

  • Flag: United States of America

  • Favorite Pinball: Lord of the Rings

Posted 11 March 2020 - 08:54 PM

@cyberpez:  @freezy is right - I was thinking about an actual 3D insert with subsurface scattering and light source underneath.  Thanks for articulating far better than I could.

 

I suspect it will cost too much performance-wise for too little benefit, but can't hurt to try.  I'll reach out to Scott Danesi who engineers many of the repro parts at Pinball Life and see if he'd be willing to share a CAD file for one of their inserts to do some experimenting.



#189 freezy

freezy

    Member title

  • Members
  • PipPipPipPip
  • 685 posts

  • Flag: ---------

  • Favorite Pinball: T2, TOM, AFM

Posted 11 March 2020 - 08:58 PM

Thanks @dbknightx, otherwise I think @flupper modeled TOTAN's inserts as well, might drop him a message too.

 

Would be cool to test this. You could actually put a bulb underneath and apply some refraction to the plastic material.



#190 bord

bord

    Pinball Fan

  • Members
  • PipPipPipPip
  • 603 posts

  • Flag: ---------

  • Favorite Pinball: Star Gazer, Whirlwind, Frontier

Posted 11 March 2020 - 09:12 PM

There are lots of pinball models you can use for this, including faceted inserts, over here. https://pinballmaker...e=Files_Section Pretty easy to convert any of these from Solidworks into Blender.

They'll need to be optimized for performance, though. The way they are modeled right now would probably give quite a stress test in realtime. I use a lot of these in my projects.



#191 dbknightx

dbknightx

    Hobbyist

  • Members
  • PipPip
  • 26 posts

  • Flag: United States of America

  • Favorite Pinball: Lord of the Rings

Posted 11 March 2020 - 09:35 PM

@bord What an amazing site - thanks for the link. It seems that inserts could be pretty low-poly count without impacting their effect on lighting.  This is a great place to start.  Thanks again!



#192 dark

dark

    3D model-man

  • VIP
  • 1,936 posts
  • Location:Toronto

  • Flag: Canada

  • Favorite Pinball: Star Wars, AbraCadaBra,MB, LAH,JPark...too many to choose!

Contributor

Posted 12 March 2020 - 03:13 AM

I think once there's an editor to play around with we can really start to tackle issues like tuning visuals/lighting.  Even going forward with unity I think flupper's method or something similar is still likely to look the best and be easiest on performance.  I'm sure using a complex mesh insert with all the facets could probably be made to look good in unity but it wouldn't look as good and would cost too much on performance.  You have to realize, flupper's renders for the textures of his inserts probably take at least a few minutes to render...if not hours+ if he's maxed settings  to produce a realistic, aesthetically pleasing result, you just can't expect that from a real time engine(yet).

 

At the end of the day, you give the authors a new sandbox with new tools and they'll figure out new solutions/improvements for old problems.



#193 freezy

freezy

    Member title

  • Members
  • PipPipPipPip
  • 685 posts

  • Flag: ---------

  • Favorite Pinball: T2, TOM, AFM

Posted 12 March 2020 - 08:02 AM

I think once there's an editor to play around with we can really start to tackle issues like tuning visuals/lighting.

 

 

You can do that today! While we will add pinball-specific features to the editor, we won't touch the rendering part of Unity. So table authors, install it and start playing around with materials and lighting. You might be surprised what's possible in real-time today.

 

When I first started I checked out a few vids here, they are of very high quality and get you started pretty quickly.



#194 chepas

chepas

    t.me/horsepin

  • Members
  • PipPipPipPip
  • 1,966 posts

  • Flag: ---------

  • Favorite Pinball: BSD, Tr0n, SW:Stern

Posted 12 March 2020 - 11:04 AM

You can more or less do what you want as far as mats and lighting. I managed to load every table I've done in the last 12-16 months and have a look around.

 

There's one thing that it will help with (and that's anyone making a game right now)...... When plastics are not the correct height, walls and things like that, they will really stick out if in the wrong position or height. Either you correct it in Unity or adjust with VP open, but it helps to see any artifact, bad positioning.

 

Textures are very low so you can't get a "great" view or is that because when run from the editor there are settings somewhere for this, or the import?

 

 

Fly Camera. (Attach to the Main Camera, change mainSpeed = 20.0f)

https://gist.github....71306318019d996


Edited by chepas, 12 March 2020 - 11:22 AM.

Bump maps are the new auto-tune :BDH:
VPX - RSS Updates ---- blog.flippingflips.xyz/en/ -- Visual Pinball No.1 (2021) . Est.2000


#195 freezy

freezy

    Member title

  • Members
  • PipPipPipPip
  • 685 posts

  • Flag: ---------

  • Favorite Pinball: T2, TOM, AFM

Posted 12 March 2020 - 11:42 AM

Hmm no, textures are imported as-is, i.e. the original binary that sits in the .vpx file.



#196 chepas

chepas

    t.me/horsepin

  • Members
  • PipPipPipPip
  • 1,966 posts

  • Flag: ---------

  • Favorite Pinball: BSD, Tr0n, SW:Stern

Posted 12 March 2020 - 12:07 PM

I'm on Ultra quality by default and Full Res textures. Maybe need 8K playfield.


Bump maps are the new auto-tune :BDH:
VPX - RSS Updates ---- blog.flippingflips.xyz/en/ -- Visual Pinball No.1 (2021) . Est.2000


#197 chepas

chepas

    t.me/horsepin

  • Members
  • PipPipPipPip
  • 1,966 posts

  • Flag: ---------

  • Favorite Pinball: BSD, Tr0n, SW:Stern

Posted 12 March 2020 - 02:24 PM

What is the purpose of Exporting VPX?

 

I remember coming across the control yesterday and couldn't find it again. This kind of helped but was looking in table nodes anyway.  https://github.com/f....Engine/pull/42 . ( It's buried in the playfield script at the bottom )

 

Are table objects supposed to serialize back (with changes) so you can edit and import back into VP?


Bump maps are the new auto-tune :BDH:
VPX - RSS Updates ---- blog.flippingflips.xyz/en/ -- Visual Pinball No.1 (2021) . Est.2000


#198 freezy

freezy

    Member title

  • Members
  • PipPipPipPip
  • 685 posts

  • Flag: ---------

  • Favorite Pinball: T2, TOM, AFM

Posted 12 March 2020 - 02:27 PM

Are table objects supposed to serialize back (with changes) so you can edit and import back into VP?

 

Yes, but currently I've only customized the flipper inspector so far, and even that one is really basic (transformation changes in the scene view for example aren't persisted yet).

 

The table export button is in the table inspector, i.e. when you select the root node of the imported table.

 

EDIT: If you want, PM me for a Discord invite so we chat without bothering everybody!


Edited by freezy, 12 March 2020 - 02:31 PM.


#199 chepas

chepas

    t.me/horsepin

  • Members
  • PipPipPipPip
  • 1,966 posts

  • Flag: ---------

  • Favorite Pinball: BSD, Tr0n, SW:Stern

Posted 12 March 2020 - 02:39 PM

 

Are table objects supposed to serialize back (with changes) so you can edit and import back into VP?

 

Yes, but currently I've only customized the flipper inspector so far, and even that one is really basic (transformation changes in the scene view for example aren't persisted yet).

 

The table export button is in the table inspector, i.e. when you select the root node of the imported table.

 

EDIT: If you want, PM me for a Discord invite so we chat without bothering everybody!

 

 

The export button isn't in the root, it's buried inside the playfield script, at the bottom.

 

Sorry, I'm ok for Discord and I'm about done with testing anyway so you won't hear a peep.

 

PS. If you have basic questions here, where everyone can see, I don't see the problem. Most answers are not on Github. Some people also don't use horsebook, discord.
 


Bump maps are the new auto-tune :BDH:
VPX - RSS Updates ---- blog.flippingflips.xyz/en/ -- Visual Pinball No.1 (2021) . Est.2000


#200 freezy

freezy

    Member title

  • Members
  • PipPipPipPip
  • 685 posts

  • Flag: ---------

  • Favorite Pinball: T2, TOM, AFM

Posted 12 March 2020 - 02:47 PM

Many things are still about to change, that's why there's no official documentation yet. However if you look at the PRs there's usually a reasonable amount of information what has been done.

 

The export to VPX button is in the inspector of the top node, as you can see here:

 

https://youtu.be/_t1ce4KIfjQ?t=88