VisualPinball.Engine icon indicating copy to clipboard operation
VisualPinball.Engine copied to clipboard

Animate Ramps on ball contact

Open freezy opened this issue 8 months ago • 2 comments

Real ramps in pinball machines vibrate when the ball passes through, because ramps are not 100% rigid. The goal of this issue is to create a vertex shader that animates the ramp mesh in a natural way when the ball passes through, to emulate this vibration.

The main difficulty is that the ramp mesh doesn't move uniformly but is dependent on a) the ball position and ball velocity and b) on the points where the ramp is attached to the playfield, which are more rigid than parts further away from the attachement points.

a) can be retrieved from the physics engine. For b), a rigidity map will be provided where the black means no vibration and white full vibration. The map can be assigned to the shader.

The animation itself should be sin/cos-like movement for each vertex, in the direction of collision normals betwen the ball and the ramp. It's not wave-like but the whole object is moving, with the strength depending on the rigidity map and a global strength parameter. The frequency is also defined by a global parameter.

Write the vertex shader based on the HDRP/Lit shader, with a parameter of the vibration strength and frequency.

freezy avatar Apr 29 '25 18:04 freezy

How and why do this with a fragment shader? Seems like a problem for a vertex shader to me.

arthurkehrwald avatar Jun 15 '25 14:06 arthurkehrwald

Absolutely, I'm not sure why I wrote fragment shader when I meant vertex shader. Updated description.

freezy avatar Jun 15 '25 17:06 freezy