3
$\begingroup$

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?

$\endgroup$
4
$\begingroup$
  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.

$\endgroup$
  • 1
    $\begingroup$ 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 $\endgroup$ – ratchet freak Feb 11 '17 at 16:00
  • $\begingroup$ 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)? $\endgroup$ – ali Feb 12 '17 at 20:01
  • 1
    $\begingroup$ 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? $\endgroup$ – ali Feb 12 '17 at 20:08
3
$\begingroup$

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

$\endgroup$
0
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.