#Parallax + Zoom Trigger Compatibility

3 messages · Page 1 of 1 (latest)

mortal hazel
#

Hey everyone! This isn't technically a bug, more of a technical question, but I'm new to the server so hopefully this is the right place? I've been running into a technical challenge and wanted to see if anyone here has dealt with it or has ideas.

I'm working on a level with parallax balloons in the background, and I need them to scale correctly when I use the zoom trigger. The problem is that zoom and scale don't follow the same function -- if you zoom out by half and scale an object by 2x, the object won't appear the same size throughout the transition. It matches at the start and end, but does a weird shrink/grow thing in between.

Here's a video showing the effect in my level: https://www.tiktok.com/t/ZP8buQfox/

My current solution is figuring out the actual function the scale needs to follow, then interpolating a bunch of scale triggers to approximate that curve. It works visually, but it tanks performance hard since I'm scaling thousands of objects at once. You can see the FPS drop in the video whenever a camera zoom happens.

So I'm curious: has anyone dealt with keeping parallax backgrounds intact during camera zooms? It feels like it should be a common problem since parallax backgrounds are everywhere, but I haven't been able to find anyone really talking about it. Would love any advice or alternative approaches!

Technical math explanation in case its helpful, yap warning:

The core issue is that zoom operates on the camera's field of view, which affects apparent object size as a reciprocal function (1/z), while scale triggers apply a linear multiplier to the object directly. So when you zoom out by some factor over time, the apparent size of everything shrinks along a 1/x curve, but a scale trigger interpolates linearly (or along one of GD's built-in easings, which are all polynomial/sinusoidal). To keep a parallax object looking the same size during a zoom, you need the scale to follow the exact inverse of the zoom's 1/x curve, which is itself a hyperbolic function. None of GD's easing options (ease in/out, elastic, bounce, exponential, etc.) actually produce a true reciprocal curve; they're all approximations of different shapes. That's why even "exponential" easing doesn't solve it: exponential and hyperbolic look vaguely similar but diverge enough mid-transition to produce that visible shrink/grow artifact. The only way to nail it within the editor is to brute-force it with a chain of small linear or ease-in scale triggers that approximate the 1/x curve piecewise, which is what I'm doing, but at the cost of performance.

TikTok

951 likes, 76 comments. “Progress update 2: now with lots more balloons!”

▶ Play video
graceful sparrowBOT
#

Please follow the format by adding images/video showing your issue and giving a text explanation of your bug!

#

@mortal hazel

Edit your message to follow the EXACT format below, labels included.

#1127097880189083758 format

  • Title: Make a short title that explains what bug you're having.
  • Description: Describe the bug and provide context, images, videos, or level IDs.
  • Attempted Fixes: Explain what you've tried doing to solve this issue. You should also see the [faq post](#1199510794111553686 message) in this channel.) If you're providing a solution, explain the solution that worked for you here.