0
\$\begingroup\$

With a perspective projection matrix and camera system already in place, I have a scene with a small jet fighter flying high over a wide and deep canyon with many cliffs and rocky surfaces; these are all being rendered as wireframes for now. The camera is following the ship which is flying entirely on the X-Z plane.

Right now, when the ship moves by some amount r, the entire canyon moves by that same amount in the opposite direction. I want to have parts that are further away from the camera to move slower, so I need parallax.

If I were going to implement parallax, in which part of the rendering system would it go, the projection matrix?

Below is a screenshot of the game as it is. The ship is moving forward and about to pass through some rocky crags.

enter image description here

\$\endgroup\$
  • 5
    \$\begingroup\$ If you are using 3D graphics, shouldn't that happen automatically? Depending how your camera is angled, the part of the canyon that is further away should look like it's moving slower, while the part of the canyon that is closer will look like its moving fast. Maybe it would help if you posted a picture of what the game looks like now and how you'd like it to look like. \$\endgroup\$ – TomTsagk Oct 4 '19 at 16:36
  • 5
    \$\begingroup\$ Are you using an orthographic projection matrix, or a perspective projection matrix with a very narrow field of view? These will suppress parallax - the parallax effect becomes stronger the wider your field of view spreads (a wider frustum in the distance compresses the displacement of the objects into fewer pixels of on-screen movement) \$\endgroup\$ – DMGregory Oct 4 '19 at 16:48
  • \$\begingroup\$ @DMGregory I am using a perspective project matrix. The original fov was 60deg, so I changed it to 90deg, and the effect seems slightly more apparent, but what should I do if I want to strengthen it? If I increase the fov any more, then it will look fish-eyed, and I don't want that. \$\endgroup\$ – Mode77 Oct 4 '19 at 18:18
  • 1
    \$\begingroup\$ Actually DMGregory’s answer is a frequent used technique- for examply the ‘speed boost’ effects in Need4Speed or Burnout games use this effect to increase the sense of speed. \$\endgroup\$ – Felsir Oct 4 '19 at 18:49
  • 1
    \$\begingroup\$ It sounds like your canyon model has a very shallow depth then, so there's very little differentiation in apparent speed between the closest and furthest parts of the mesh. Have you tried stretching out the depth of your model, or adding a copy in the deep background, to evaluate the effect of depth range? \$\endgroup\$ – DMGregory Oct 4 '19 at 19:09
0
\$\begingroup\$

It turns out the reason I couldn't see the parallax effect very well was that all the features of the landscape had the same relative scale. When I added some objects to the scene that were much smaller than the terrain, I bolted past them with higher speed than the landscape was moving.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.