Procedural Camera Shake

Is there a way to add a NoiseProceduralTexture’s values to the position of a camera?

I’m trying to find the easiest way of creating a random persistent camera shake / sway.
The NME is great but it would be nice if I could just define a noise texture and just add the values to the camera position and tweak it in my main js code.

You could always do it like doom did and take the cameras xz position pass that to a sin/cos algo that gives you head bob.

This is a simple example of it, you can make this way way better but this is kinda the idea.

Cool, thanks for the tip.
I’ll have a crack at it in the next few days. If I come up with something I’ll post it.

Thought about it more and remembered its more like this.

You take the velocity and time and then you can bobble it pretty much anyway you want.

This uses the default camera stuff which probably would not be ideal, you would more want to do your own control setup.

Also that is pseudo code so there might be some mistakes in it, just tried to hack it out fast.

2 Likes

I’ve come up with something a little closer to what I want, thanks in part to this post: Vehicle animation using x,y co ordinates and orientation

It’s a way to dynamically create loads of keyframes and randomize the timing between them. Ideally, I’d like to split this up between X, Y and Z so each axis behaves differently, but that’s for the next iteration. The “sway” of the camera still feels off for camera shake, I’ve tried different kinds of easing but still needs tweaking as well.

If anyone is able to do this more efficiently, I’m happy to hear it! :slight_smile: