<p>Sunlight is typically modeled as a directional light. All rays point the same direction off into infinity. </p>

CC BY-SA 3.0
2017-02-10T17:16:32.643Z
2017-02-10T17:16:32.643Z
ratchet freak
<p>What others said. Sun is modelled as a directional light, i.e. the direction of light is independent of the intersection point as it's very far away. So you just define a point in space and that itself is the "direction towards the light source". If you want the direction of light rays towards the objects you gotta negate that.</p>

<p>Coming to your second part. For shadow rays, you need to send a ray from the point of intersection towards the light source, since it's the sun in your case, the direction is just the location of the sun. Do note that the origin of the ray is not <code>intersection point</code> rather it's <code>intersection point + epsilon</code> where epsilon is a very small value (say 0.001) in order to avoid intersection of the ray with the object it generated from.</p>

<p>After that you check for intersection of objects with this shadow ray. You don't need to compute the intersection points, you just need to know whether the ray intersected with an object or not. If it did you set the pixel color to just the ambient color.</p>

CC BY-SA 3.0
2017-02-11T17:43:46.127Z
2017-02-11T17:43:46.127Z
gallickgunner
<ol>
<li><p>Sun light can be represented as a distant light. Light sources are radial like a bulb, though in the case of the sun, it is so far away from the Earth, that a reasonable approximation is to consider that all rays coming out of the sun are parallel at the Earth's surface. Using a distant light is an approximation. Because it's far away it is also assumed that there is no variation of light intensity as you go up or down (change height).</p></li>
<li><p>If you do physically based rendering, the sun is an area light. From the Earth it looks like a small disk so you can approximate this with a large disk that is far far away. Area light like all light sources obeys a light intensity square fall off. So you will need to put your area light far away so that the intensity on the ground or as you change height doesn't vary much. Representing the sun as an area light avoids having to do strange things to the surface shader such as specifying a specular size.</p></li>
</ol>

CC BY-SA 3.0
2017-02-11T16:00:31.973Z
if you want to model the sun as an area light then you can also make it a directional light but instead of a single angle make it centered around a cone
ratchet freak
CC BY-SA 3.0
2017-02-12T20:01:24.350Z
Thanks for the answer. What I basically try to calculate is the Sun direct irradiance at few surface points(in a room floor). Knowing the clock time and site latitude, longitude I can get sun angular position. Is it then valid to use this single Sun direction for all the sensors(assuming I go with your first answer, Sun as directional source)?
ali
CC BY-SA 3.0
2017-02-12T20:08:37.037Z
Ratchet, did I understand it correctly that you mean instead of sending a shadow ray to a fixed direction, sampling the direction from a solid angle around that fixed direction?
ali
CC BY-SA 3.0
2017-02-11T15:17:23.673Z
2017-02-11T23:30:45.983Z
2017-02-11T23:30:45.983Z
user18490
<p>How is sun modelled for ray tracing rendering? Is it part of the scene, like a
sphere with a centre in some far location or it is just considered as a point?</p>

<p>Also regarding sending shadow rays to the sun, is it, again, sampling a sphere
or just sending shadow rays to one point?</p>

<raytracing><shadow><ray>
Sending shadow rays to the sun
ali
# Sending shadow rays to the sun

(Asked by: username_0 on 2017-02-10)

How is sun modelled for ray tracing rendering? Is it part of the scene, like a
sphere with a centre in some far location or it is just considered as a point?

Also regarding sending shadow rays to the sun, is it, again, sampling a sphere
or just sending shadow rays to one point?

**Tags:** raytracing, shadow, ray


---

## 3 answers

### Answer by username_3 on 2017-02-11. Score: 4 | Accepted answer

1. Sun light can be represented as a distant light. Light sources are radial like a bulb, though in the case of the sun, it is so far away from the Earth, that a reasonable approximation is to consider that all rays coming out of the sun are parallel at the Earth's surface. Using a distant light is an approximation. Because it's far away it is also assumed that there is no variation of light intensity as you go up or down (change height).
2. If you do physically based rendering, the sun is an area light. From the Earth it looks like a small disk so you can approximate this with a large disk that is far far away. Area light like all light sources obeys a light intensity square fall off. So you will need to put your area light far away so that the intensity on the ground or as you change height doesn't vary much. Representing the sun as an area light avoids having to do strange things to the surface shader such as specifying a specular size.

> **Comments:**
> **username_1**: if you want to model the sun as an area light then you can also make it a directional light but instead of a single angle make it centered around a cone  
> **username_0**: Thanks for the answer. What I basically try to calculate is the Sun direct irradiance at few surface points(in a room floor). Knowing the clock time and site latitude, longitude I can get sun angular position. Is it then valid to use this single Sun direction for all the sensors(assuming I go with your first answer, Sun as directional source)?  
> **username_0**: username_1, did I understand it correctly that you mean instead of sending a shadow ray to a fixed direction, sampling the direction from a solid angle around that fixed direction?  

---

### Answer by username_1 on 2017-02-10. Score: 3

Sunlight is typically modeled as a directional light. All rays point the same direction off into infinity.


---

### Answer by username_2 on 2017-02-11. Score: 0

What others said. Sun is modelled as a directional light, i.e. the direction of light is independent of the intersection point as it's very far away. So you just define a point in space and that itself is the "direction towards the light source". If you want the direction of light rays towards the objects you gotta negate that.

Coming to your second part. For shadow rays, you need to send a ray from the point of intersection towards the light source, since it's the sun in your case, the direction is just the location of the sun. Do note that the origin of the ray is not `intersection point` rather it's `intersection point + epsilon` where epsilon is a very small value (say 0.001) in order to avoid intersection of the ray with the object it generated from.

After that you check for intersection of objects with this shadow ray. You don't need to compute the intersection points, you just need to know whether the ray intersected with an object or not. If it did you set the pixel color to just the ambient color.


---

