How to screen shake an ortho camera with a single image skybox?

Hi all,
So I have been trying to figure out how I’m going to handle my background here. I plan on going for a parallax effect, but the code snippet I found didn’t seem to affect the object I placed it on. I think that, for the “far background”, I essentially want a stationary skybox - but when I tested with my current camera, the shake (which works with rotations, using Cinemachine’s m_AmplitudeGain) exited the borders of my attempted solution, per the video below.

I think the way I’m going to handle parallax, or at least try to, is by combining the view of a perspective camera with my ortho camera and putting the parallax on a unique layer. I suspect there will be some issues when there are y-axis camera changes but I’ll cross that bridge when I come to it. I don’t think this will resolve the issue I’m having with the background, though, as seen below.

Does anyone have any insight for me?
Video of current background/camera shake situation (no parallax, this is a small test scene with nothing to parallax)

(Also, the distortion shader is doing something weird here; you can see where it is distorting, but also the mat itself is interfering with viewing the geometry. But I think that is a question for postprocessing/shaders. However, when I tried using a sprite as the background (which didn’t look great), the sprite would get a huge chunk taken out of it as the particle expanded. So that might affect my possible approach to the camera handling.)

Heyyoo :slight_smile:

If I understand well you need camera to always look at the background?
One easy way to achieve this could be to use a canvas with render mode set to screen space camera and place your background with an image component. This way your background will always follow the camera regardless of the position and rotation.
There are lot of ways to achieve this but with this kind of setup it’s the most straight forward.

Let us know if this works.

Well, it definitely gave me a fixed background, which is very helpful! Thank you!
But unfortunately, it made the problem with my distortion post effect/shader, whatever that is, very pronounced:

I think it makes more sense to tackle that as a shader issue, though, or a post issue. So I think this question was answered! And I’ll be back in another forum momentarily :slight_smile:

What happens if you add a material to your image component (For example with the standard shader)?

Oh, perfect! Guess I just need to put my tiles on a mat too and that should help there. Thanks so much!

1 Like