POV-Ray : Newsgroups : povray.bugreports : object too far from camera is not shown Server Time
9 Nov 2024 00:47:24 EST (-0500)
  object too far from camera is not shown (Message 1 to 5 of 5)  
From: guarnio
Subject: object too far from camera is not shown
Date: 18 Apr 2020 10:20:00
Message: <web.5e9b0b9165bf5d0b5e8f98ff0@news.povray.org>
Hi everybody,

i'm working on a solar system model and was trying to generate the sun. Since
the camera is gonna stay in the earth-lunar vicinity, the Sun is going to be
approximately 150 million km away from the camera. Whilst creating the pictures
i noticed the Sun didn't show up even when it's location was looked at by the
camera. I'm gonna post the code below, as a texture for the sun just download
any texture you want from the internet (or this
https://www.solarsystemscope.com/textures/download/8k_sun.jpg).

I'm gonna share the code with "position_SUN" vector declared at the beginning,
you can just change that and see that just dividing the cut off distance is
dividing the sun's distance ("position_SUN" vector) by /30 (in this case the sun
still appears), while dividing only by /28 makes the sun completely disappear.
I hope someone will be able to help me with what the problem is,
Thanks in advance.

here's the code


global_settings {
noise_generator 2
assumed_gamma 1.6
}
#include "colors.inc"

#declare position_SUN= <150000000,0,0>;

camera {
   perspective
   location <0, 0, 0>
   up <0,1,0>
   right <1.6,0,0>
   look_at position_SUN
   angle 35.4515
}

#declare SUN = sphere {
   position_SUN 696342
   texture {
      pigment {
         image_map {
            jpeg
            "/home/guarn/MEGA/Auto_Navigation/Textures/8k_sun.jpg"
            map_type 1
            interpolate 2
         }
         translate position_SUN
      }
         finish {
            ambient 1
      }
   }
    translate -position_SUN
 scale <1, 1, 1>
    rotate y*0
    rotate x*0
    translate position_SUN
}

light_source {
   position_SUN, rgb<1,1,1>
   looks_like { SUN }
   area_light
   <696342,0,0>, <0,696342,0>, 50, 50
   adaptive 1
   parallel
   jitter
   circular
   orient
}


Post a reply to this message

From: Le Forgeron
Subject: Re: object too far from camera is not shown
Date: 18 Apr 2020 12:16:08
Message: <5e9b27c8$1@news.povray.org>
Le 18/04/2020 à 16:15, guarnio a écrit :
> I hope someone will be able to help me with what the problem is,
> Thanks in advance.

Old, and known, problem: precision and range of value is limited on
computers.

Do not model the solar system with such precision, not with such small
units.

Precision is good around 0, but is terrible for any other value.

Imagine there is a 4 digits precision, you can keep track of 1.000,
0.009 and 0.001, but 1.009 is the same as 1.000.

Precision of float is 7 digits, precision of double is 11 digits.

Kilometre is not suitable for your model in povray.
 (150 000 000 in your code)

The radius of Earth is 6371 km; that could be the unit sphere, as long
as you do not want to model more than Mars orbit.

If it bother you to divide everything with non-round number, use the
next bigger value (10 000km = 1 pov-unit)

Last hint: take the habit to put comments in your code when defining
magic value (such as 150000000) to remember the unit of such quantity.
( 696342 is the the radius of sun, in km; approximatively)


Post a reply to this message

From: Bald Eagle
Subject: Re: object too far from camera is not shown
Date: 18 Apr 2020 16:10:01
Message: <web.5e9b5e7f257f6faafb0b41570@news.povray.org>
"guarnio" <gua### [at] gmailcom> wrote:

> I'm gonna share the code with "position_SUN" vector declared at the beginning,
> you can just change that and see that just dividing the cut off distance is
> dividing the sun's distance ("position_SUN" vector) by /30 (in this case the sun
> still appears), while dividing only by /28 makes the sun completely disappear.
> I hope someone will be able to help me with what the problem is,

Welcome to the large family of people who have coded the solar system.  :D

http://news.povray.org/povray.newusers/thread/%3C4e46a998%40news.povray.org%3E/

and several other threads like it.  see the old discussions about rendering
Ringworld, and the custom version of POV-Ray that was needed.

There's only so large or so small you can get, numerically, before you run into
the problem of "how is that number represented by the computer in a physical way
using 0's and 1's"  You either run off the end one way or the other.

Try to keep everything within 1x10(+/-)6 and you should be fine.




http://news.povray.org/povray.binaries.animations/thread/%3C5922e351%40news.povray.org%3E/

http://news.povray.org/povray.binaries.animations/message/%3Cweb.5916900b4e8509949c5d6c810%40news.povray.org%3E/

etc.


Post a reply to this message

From: guarnio
Subject: Re: object too far from camera is not shown
Date: 15 May 2020 10:10:00
Message: <web.5ebea176257f6faa5e8f98ff0@news.povray.org>
> Old, and known, problem: precision and range of value is limited on
> computers.
>
> Do not model the solar system with such precision, not with such small
> units.


Thank you, I'll reduce the precision of the distances and divide them all by
10^5. I didn't know the issue with using too many digits.

You have been very helpful


Post a reply to this message

From: guarnio
Subject: Re: object too far from camera is not shown
Date: 15 May 2020 10:10:01
Message: <web.5ebea265257f6faa5e8f98ff0@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:

>
> Try to keep everything within 1x10(+/-)6 and you should be fine.
>

Thank you, I'll use your advice!


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.