aarthificial / pixelgraphics

A collection of pixel art visual effects
MIT License
353 stars 28 forks source link

Movable camera #7

Open davidsoderstrom opened 2 years ago

davidsoderstrom commented 2 years ago

Moving the camera mess with the velocity texture. Any advice?

Heurazio commented 10 months ago

I found a potential fix for this. For this to work, the following pre-requirements need to be met:

  1. You are using the RenderFeature (not the VelocityCamera - a similar fix can be found here https://github.com/aarthificial/pixelgraphics/issues/14)
  2. You are using a perspective camera, not an orthographic one

When both conditions apply, the fix that worked for me is changing line 93 in the VelocityRenderPass class from: cmd.SetGlobalVector(ShaderIds.CameraPositionDelta, screenDelta / 2); to cmd.SetGlobalVector(ShaderIds.CameraPositionDelta, screenDelta * 0.05f);