POV-Ray : Newsgroups : povray.newusers : shadows/sunlight Server Time: 8 Mar 2021 13:21:34 GMT
  shadows/sunlight (Message 11 to 14 of 14)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Tor Olav Kristensen
Subject: Re: shadows/sunlight
Date: 5 Dec 2020 21:05:01
Message: <web.5fcbf4f560c1d92ee71929640@news.povray.org>
"Julia" <nomail@nomail> wrote:
> "Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmailcom> wrote:
> > Ash Holsenback <no### [at] spamcom> wrote:
> > > On 12/5/20 12:41 PM, Tor Olav Kristensen wrote:
> > > > You have hidden your light source inside at least one opaque sphere.
> > > > So I think that your problem is not a lack of shadows...
> > >
> > > i think the 1st sphere after the light source is the sun... lol didn't
> > > account for that 2nd object
> >
> > Ok. After re-indenting I see that the last sphere (the moon ?) is in the union
> > with the earth sphere - and it is moved away from the origin, so the light
> > source is inside a single opaque sphere only.
> >
> > So your suggestion to use looks_like (the sun sphere) for the light source is
> > the way to go.
> >
> > --
> > Tor Olav
> > http://subcube.com
> > https://github.com/t-o-k
>
> oh.. i shoud have said that its an amimation of the sum, the earth and the moon
>
> i think the probem is created by the finishes im using
> because if i change it from ambient it's bearly wisible
>
> thanks anyway, i will try to figure out something

Julia,

First you have to find the problem with the light source that Ash hinted at.
You can read about the light source here:
http://povray.org/documentation/view/3.7.1/35/

When you have fixed it you can (just for testing) remove the whole sun sphere
and remove all your ambient statements.

Now you should be able to see shadows from your light source (because the opaque
sun sphere is no longer there to block its light).

Thereafter you can bring back your sun sphere and study the the looks_like
example here:
http://povray.org/documentation/view/3.7.1/40/

If you still have problems you may come back here and show what you have tried.
(But please indent your code better so that it is easier for us to read your
code.)

--
Tor Olav
http://subcube.com
https://github.com/t-o-k


Post a reply to this message

From: Bald Eagle
Subject: Re: shadows/sunlight
Date: 5 Dec 2020 21:55:00
Message: <web.5fcc018160c1d92e1f9dae300@news.povray.org>
"Julia" <nomail@nomail> wrote:
> Hi,
> there is another problem that i have been trying to figure out for the past
> week, but i'm just starting to give up.

Well don't do that - because once you make it past the first few hurdles, you
will see that it was worth it!  :)

If you are new, then it's important to learn how to see exactly what is
happening in your scenes, how to experiment with parts of the scene to see if
they cause/fix any problems, and how to write your code to make all of that a
lot easier on yourself and anyone who's trying to assist you.

Try and keep all of the parts of your scene well organized, and easy to edit.
You have some large objects with a lot of code associated with them.
And as pointed out, some of them may be causing your problems.

Rather than write everything in large blocks of code all at once, build your
objects, and your scene, in smaller bits that can be progressively added
together - it will be cleaner, easier to follow, and easier to modify as you go
through the process.

You will, of course, develop and adopt coding practices that are uniquely your
own, but I have a few suggestions that will help you at the beginning.

Rather than write out the whole scene at once, start writing it piece by piece
in a new file.

I would suggest starting off with a simple "space" that has a camera, light
source, a (temporary) ground plane, and some lines that show you the axes.
This will give you a "blank" scene that allows you to follow things around and
give you a sense of scale.

Now you can add things one at a time.

Rather than make a planet, make _pieces_ of the planet.

So:
#declare Clock = clock;
#declare Origin = <0, 0, 0>;
#declare Earth_radius = 0.5;
#declare Earth_distance = 5;
#declare Tex_Earth = texture {pigment {agate} {finish {specular 0.2}}

Then assemble them:

#declare Earth =
sphere {
 Origin, Earth_radius texture {Tex_Earth}
 translate x * Earth_distance
 rotate -y * 360 * Clock
}

This gives things names, meaning, and lets you find WHERE you want to change a
value, once - rather than hunting down every instance.

I define Clock (capitalized) as a "meta-clock" because I find it makes my life
easier when doing animations.   #declare Clock = clock * 0.1;  can slow things
down that may be going WAY too quickly to judge and debug.

You might also think about defining your units in terms of multiples of "POV
units" so that you can play around with distances and scales very easily and
quickly.

So,
#declare M = 1; // a multiplier
#declare kilometer = 1000 * M;   // 1000 POV-units times M

Then you can "shrink" your scene by making M less than 1.

Now you can play with your Earth and make it spin and rotate, and you will only
have ONE object in your scene to focus on which might cause any problems.

And then you can add your moon.

And then you can add your sun.

do that at the end of the file like this:

object {Earth}
object {Moon}
object {Sun}

Then you can comment out ONE LINE, and leave all of the previous code untouched.

I would keep your sizes small and your textures extremely simple, so that you
can see what's going on, and the patterned spheres will allow you to see the
rotation.

One final note:
If you are going to use the looks_like modifier for the Sun, put a "working"
light at the origin with the shadowless keyword, so that it never gets blotted
out.

Then you can work on your actual Sun definition and the rest of the scene will
be lit and visible.  Then just comment out the working light when you have it
all working like you want.


Post a reply to this message

From: Bald Eagle
Subject: Re: shadows/sunlight
Date: 5 Dec 2020 22:10:00
Message: <web.5fcc048e60c1d92e1f9dae300@news.povray.org>
Since POV-Ray has been around for 25+ years, you have more example code than you
can possibly ever read.

Use the Search feature to search for solar system or planet, or similar terms.
add in a username to see what specific users have coded in the past.
Searching for povray solar system in a search engine can pull up sites other
than this that are maintained independently by users.

http://www.f-lohmueller.de/pov_tut/pov__eng.htm#examples
has always been an excellent resource, and there are many others.

Don't get frustrated - I have made exactly the same mistakes you have - dozens
of times.


Post a reply to this message

From: Alain Martel
Subject: Re: shadows/sunlight
Date: 6 Dec 2020 21:34:32
Message: <5fcd4e68$1@news.povray.org>
Le 2020-12-05 à 12:02, Julia a écrit :
> Hi,
> there is another problem that i have been trying to figure out for the past
> week, but i'm just starting to give up.
> The problem is that there arent any shadows. Not only on the other side of the
> sphere but also when its in front of another nothing happens.
> Also when i dont put "ambiet" the spheres just get dark on both sides, still no
> shadow.
> here is the code:
> 
> #include "colors.inc"
> 
> camera {
>          location <5,10,-60>
>          look_at <0,0,0>
>          angle 25
>          }
> 
> light_source {
>          <0,0,0>
> 
> 
>                 }
> 
> 
> // s&#322;o&#324;ce
>   sphere {
>       <0,0,0>, 10
>     pigment {
>          bozo
>                  turbulence 5
>           color_map {
>          [0.0 color <1,0,0>]
>          [0.25 color <1,1,0>]
>          [1.0 color <1,0.65,0>]
>          }
>       scale 3
>     }
>     normal {bumps 1.0}
>     finish {ambient 1}
> 
>   scale 1/6
> 
> 
> 
>    rotate <0,380*clock,0> //obrót
> }
> 

That sphere blocks all the light from your light source.
You have two solutions :
1) Add «no_shadow» to the sphere.
2) Bind it to the light using the looks_like
Ex.:
light_source{LightLocation rgb 1
   looks_like{
     sphere{0 1 pigment{rgb 1}finish{emission 1}}
   }
}

The origin for that sphere is the location of the light, so, it need to 
be build around <0,0,0> no mater where the light is located.


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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