6
$\begingroup$

I want to make a sci-fi animation, but whenever I make something like a planet to scale relative to a spaceship, I seem to be getting weird floating point inaccuracy errors. How do I handle a situation like this? Can I use false perspective? What about compositing two different scenes together? What is the "correct" way to handle a scene like this?

Here's a screenshot of what's happening(a 6.3 km radius sphere and a 20 m side cube).

There's weird vertex shifting in Cycles too: enter image description here

$\endgroup$
5
  • 1
    $\begingroup$ Could you maybe include a screenshot of what is going wrong? $\endgroup$
    – PGmath
    Mar 5, 2021 at 18:00
  • $\begingroup$ I added a picture. $\endgroup$ Mar 5, 2021 at 19:52
  • $\begingroup$ @PGmath do you know how the answer to this? $\endgroup$ Mar 6, 2021 at 16:48
  • 1
    $\begingroup$ It reminds me one very old blender conference presentation (I can not found it) it was exactly about this space galactic animation ... they explaned ho w to trick this with two scenes somehow connected by camera? ... $\endgroup$
    – vklidu
    Mar 27, 2021 at 11:10
  • $\begingroup$ Is it possible that you could find this presentation? $\endgroup$ Mar 27, 2021 at 16:39

2 Answers 2

6
+50
$\begingroup$

As mentioned, another option is to use Forced Perspective. This is where an object's distance appears to be different to its actual distance due to how it appears and/or moves.

By placing an object in the middle-distance and parenting it to the Camera's location, it can move as if it were actually placed "at infinity" - so that it moves in relation to the background.

This can be achieved using the 'Child of' constraint with the settings set to enable Location but to disable rotation (since we want its position to be based on the viewpoint but not to be affected by the rotation of the camera).

child of to parent only to location

Here's the result using the default cube and a default size icosphere placed at a slight distance. Note that I've added some static stars to the background to make it more apparent that the sphere is appearing static in relation to the background and making it appear more ‘planet sized’ since it doesn’t change as the camera moves around the foreground objects :

space with forced perspective

Blend file included for reference

$\endgroup$
3
  • 3
    $\begingroup$ Big fan of this approach :). Even in CGI there's still a place for old-school movie tricks. $\endgroup$ Mar 27, 2021 at 13:51
  • $\begingroup$ How would you get realistic reflections with this approach? $\endgroup$ Mar 27, 2021 at 16:38
  • 2
    $\begingroup$ The “distant” object is in the correct place from line of sight from the camera so there will be some offset for any reflections in other objects. However, the offset will be proportional to the distances between the “distant” object and the relative positions of the camera and object. Provided you ensure the “distant” object is significantly further away than the distance between the camera and the object, the inaccuracies in the reflection should be insignificant and unnoticeable in most cases. Move “planet” further away for more accurate reflection. $\endgroup$ Mar 27, 2021 at 17:22
4
$\begingroup$

I'm not particularly experienced with working to such extremes so there may be a better accepted solution to this but I would probably opt for using the compositor to combine the different elements (very large scale and much smaller scale).

The reasons for the distortion are - as you say - due to floating point innaccuracies. Floating Point representations of numbers are very good to storing both large and small numbers alike. However, there is a limit to the precision of the value that can be held and the precision is essentially in proportion to the value being stored.

So, for example, a vertex only 100m from the origin with a precision of 0.001% would only drift by +/- 0.001m (ie, 1mm) - probably not an issue. However, a vertex at 1000 times the distance from the origin could drift by up to 1000 times the amount - ie, 1m. For the surface of a large planet, 1m innaccuracy of a vertex probably isn't too much of a concern, but for a 20m scale spaceship it would be really significant and noticeable. (Note: Floats are actually far more precise than this so the real effect would be far less than this, but it's a good value in order to demonstrate the cacluation.)

As you proposed, by rendering the large and small scale objects in different scenes - with each appropriately scaled and clipping distances chosen to minimise precision errors - you can avoid the problem and simply composite the results to produce the final render.

$\endgroup$
3
  • 1
    $\begingroup$ Thank you, I appreciate the answer. I am going to wait a while longer to see if there are any better ones, but if they are not, I will mark this as solved. $\endgroup$ Mar 6, 2021 at 19:50
  • $\begingroup$ Also I have a question about this method. Is there anyway to get indirect lighting with this method, or would i have to use fake area lights? $\endgroup$ Mar 7, 2021 at 0:34
  • 1
    $\begingroup$ Yes - you’d need to setup the scene to provide the indirect light from the planet - although you could just render out a view of the planet and place it on a plane in the right place and make it invisible to the camera. $\endgroup$ Mar 7, 2021 at 10:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .