Adding Sunlight to your Drawings

      See also, All about Shadows.


Introduction
Once you start working with solid models and rendering them, you will want to add lighting effects to your model. One of the most common requirements is to add sunlight to your drawing. AutoCAD has some very powerful and useful features for accurately creating sunlight effects.

As you may have realised by now, you don't need lights in a scene in order to render a model. Figure number 1 on the left shows the effect of rendering without lights. As you can see, the results are rather uninspiring and there are no shadows. AutoCAD calculates the lighting in a scene where there are no lights by determining the the angle of incidence between the object faces and the line of sight. Faces that are perpendicular or near perpendicular to the line of sight are displayed brighter and faces further from the perpendicular are shown darker. The effect is similar to what you would see if the light source was placed at the camera position; perpendicular faces would reflect more light and faces further from the perpendicular would reflect less light. In figure 1, you can see that the vertical faces of the hedge, facing the viewer are bright, whereas the ground plane is quite dark. Although this effect enables you to clearly see your model, it is far from realistic.

In order to add some sunlight to our scene, we will need to add a light that simulates the sun; AutoCAD calls this type of light a "Distant Light". This is much easier than it sounds and AutoCAD has some very user-friendly tools to help.

As you can see from figures 2, 3 and 4, not only can you simulate sunlight but you can control the time of day, the day of the year and the geographic location. Also, because the renderer can create accurate shadows based upon your parameters, you could even use these techniques to create a shadow analysis.

The three sunlight images on the left show the light and shadow effects on a garden at different times of the day on the 25th June in London. This is all possible without needing to know the first thing about solar geometry!

 

This tutorial will take you, step-by-step through the process of creating sunlight, modifying it and making the necessary shadow and render settings.

Overview & Fast Track
Adding sunlight and rendering a drawing is essentially a 5 step process. If you are familiar with AutoCAD, you may be able to create sunlight by following the Fast Track steps below. If you have never worked with lights before or have never used the renderer, I suggest you follow the full tutorial. Start by downloading the Sample Data or go straight to Getting Started.

Fast Track

  1. Create a Distant Light using the Light command, ViewRenderLight… from the pull-down menu. Set the light type to "Distant Light" and click the New… button.

  2. Name the light and set Shadow Type to "Raytraced" in the New Distant Light dialogue box. Give the new light a name. Click the checkbox to turn shadows on and then click the Shadow Options… button. Click the checkbox to turn "Ray Traced Shadows" on.

  3. Set the Time using the Sun Angle Calculator. Click the Sun Angle Calculator… button in the New Distant Light dialogue box.

  4. Set the Location from the Sun Angle Calculator dialogue box. Click the Geographic Location… button in the Sun Angle Calculator dialogue box.

  5. Render the Scene using the Render command, ViewRenderRender… from the pull-down menu. Set the "Rendering Type" to Photo Raytrace and click the checkbox to turn "Shadows" on.

Download Sample Data
You can use any 3D drawing to follow this tutorial providing that you have drawn a ground plane on which the shadows can be projected. Alternatively, you can download the file shown in the images above. Click on the icon below to download the AutoCAD drawing file Garden.dwg. There are two download options, you can either download the drawing file or you can download the smaller compressed file. The compressed Zip file can be uncompressed with a utility such as WinZip.
    Download Garden.dwg (367KB) Garden.dwg (367KB) - AutoCAD 2000 Drawing File
    Download Garden.zip (73KB) Garden.zip (73KB) - AutoCAD File Zipped
Save the file to the folder where you keep your AutoCAD drawing files. If you downloaded the zipped version, you will need to unzip it before continuing.

Getting Started
Open the Garden.dwg file. You may notice that it is a little slow to open. This is because the garden is constructed from solid objects and AutoCAD has to load some extra bits of the program to deal with them. The opening view is an aerial perspective. This was created using the DVIEW command but you could also use 3D Orbit. The view has been saved so that you can return to it at any time using the Named Views command, Named Views from the Standard toolbar or ViewNamed Views…. Highlight the view name, "Sun View", click the "Set Current" button and then click OK.

In addition to the saved view, the garden drawing also has the various render settings already saved for you. However, if you are not familiar with rendering, it would be useful to have a quick go now so that you know what to expect later in the tutorial.

After opening the Garden.dwg, select ViewRenderRender… from the pull-down menu or click Render on the render toolbar to display the Render dialogue box. Since all of the settings are already made, simply click the OK button. After a few moments, the rendered image will appear in your viewport and your screen should look something like the image above. Notice that the render background has been set to white. This just makes the rendered objects easier to see. Notice also that some of the objects have materials assigned.

Note that rendered views are not interactive, they are just still images, like photographs. You cannot pan, zoom or pick objects in a rendered view as you can in shaded views. Therefore, you must return to your previous viewing mode before continuing with any drawing work. To do this, you must regenerate the view, select ViewRegen from the pull-down menu.

The rendered image that you see is shown with the default lighting as described above and illustrated in figure 1. We have not yet added any lights, so this is the next thing to do.

Adding a Light
Toolbar Light
Pull-down ViewRenderLight…
Keyboard LIGHT
The first step toward simulating sunlight is to create a new "Distant Light".

AutoCAD can create 3 different types of light, namely, Point Light, Spotlight and Distant Light. It is important to understand how each of these light types affects the final rendered image. A point light radiates light in all directions from a single point. A real-world example of this type of light is the bulb of a ceiling pendant light. A spotlight creates a conical light that is also directional. This is similar to a real-world spotlight. Distant lights differ from both point lights and spotlights in that their light rays are not radial, they are parallel.

Lights Dialogue Box

Why are distant lights used to simulate sunlight? Well, although light rays from the Sun are radial, we are so far away from the Sun that the angle between light rays is very small by the time they reach the Earth. To all intents and purposes, they are parallel and since light rays from distant lights are parallel, they most closely resemble sunlight.

So, to create a new distant light, select ViewRenderLight… from the pull-down menu. When the Lights dialogue box appears, select "Distant Light" from the drop-down list and then click the New… button. This will take you to the New Distant Light dialogue box.

Configuring a Distant Light
The second step to simulating sunlight is to name the light and to set the shadow options.

Click in the "Light Name" edit box and type the name of your new distant light. For the sake of simplicity, it might be sensible to call the light "SUN". However, you can call it anything you like providing that it is eight characters or less and doesn't include any of the normal illegal characters such as spaces, asterisks, slashes and dots. If the light name you choose is not liked by AutoCAD, you will see a small error message in the lower left-hand corner of the dialogue box saying "Invalid name".

New Distant Light Dialogue Box

Setting shadow options for a light involves turning shadows on and then specifying the shadow type. When you create any light, you can decide whether it will cast shadows or not. In some cases it is desirable that lights do not cast shadows. This ability to control shadow casting means that you could build a scene with a number of lights, some of which cast shadows and some of which don't. To turn shadows on, click in the "Shadow On" checkbox (shadows are turned off by default).

Now you can set the shadow type. Click the Shadow Options… button to display the Shadow Options dialogue box.

Setting Shadow Options
The AutoCAD renderer can create three different types of shadows. The default shadow type is "Shadow Map" and the alternatives are "Volumetric" and "Ray Traced". You can see from the illustrations below that the shadow map and ray traced shadow types give quite different results. For most objects, the difference between Volumetric and Ray Traced shadows is very small. See All about Shadows for a full description of these shadow types. The type of shadow you use is entirely up to you but in general, ray traced shadows tend to give a better result.

 Shadow Map Shadows Ray Traced Shadows

Shadow Options Dialogue Box The Shadow Options dialogue box is used to specify which shadow type is used when you render the scene. The default shadow type is the shadow map.

Click the "Shadow Volumes/Ray Traced Shadows" check box to change the shadow type. Your dialogue box should now look like the one on the right. Click the OK button to return to the New Distant Light dialogue box.

Using the Sun Angle Calculator
The third step in simulating sunlight is to set the date and time using the Sun Angle Calculator. From the New Distant Light dialogue box, click the Sun Angle Calculator… button to display the Sun Angle Calculator dialogue box.

Sun Angle Calculator Dialogue Box

In order to set the date and time, you must specify the date, the time, the time zone and decide whether you want daylight savings or not.

Starting at the top of the left-hand column in the dialogue box, click in the "Date" edit box and type the date. Note that dates are in the American format (mm/dd). Next, click in the "Clock Time" edit box and enter the time. Note that this is in 24 hour format or military time. If you wish, you can use the adjacent slider bars to set the date and time but it is very difficult to control accurately and is therefore not recommended.

Using the drop-down list, select the required time zone. For example, if your site is in the UK, select the "GMT/WET" option. Finally, you need to decide whether you would like daylight savings to be calculated. This option will automatically convert GMT (Greenwich Mean Time) to BST (British Summer Time). Most likely you will want to have this option turned on, so click the "Daylight Savings" checkbox.

You will notice that AutoCAD allows you to specify the latitude and longitude of your site. These values must be known in order for AutoCAD to accurately calculate the angle of the Sun. In most cases you won't know these values but fortunately, AutoCAD can help us to locate our site Geographically. Click the Geographic Location… button.

Setting the Geographic Location
The fourth step in simulating sunlight is to specify the geographic location of your site. The Geographic Location dialogue box enables you to do this in a number of ways.

Geographic Location Dialogue Box

The first thing to do is to specify which continent your site is in. Use the drop-down list, centre top of the dialogue box, to select a continent. Once you have done this, you have a number of options. You can simply select the name of a city from the list on the left. You can also select a city by checking the "Nearest Big City" option and picking a point on the map. If your site is not near a big city, you can deselect this option and simply pick any point on the map. Obviously it is very difficult to accurately pick a location from such a small map but you should be able to get close enough to generate realistic shadows.

You have now made all the settings that are needed to simulate sunlight. Click the OK button to return to the Sun Angle Calculator dialogue box. Click the OK button again to return to the New Distant Light dialogue box, click OK a third time to return to the Lights dialogue box and finally, click OK one more time to complete the specification for your distant light.

This might be a good time to save your drawing if you haven't already done so.

Rendering the Scene
Toolbar Render
Pull-down ViewRenderRender…
Keyboard RENDER
The fifth and final step to simulating sunlight is to render a view of your drawing in order to show the effects of light and shadow.

Render Dialogue Box

Start the Render command by selecting ViewRenderRender… from the pull-down menu. The Render dialogue box will appear. First, make sure that the Rendering Type option is set to "Photo Raytrace". Next, make sure that "Shadows" is checked in the Rendering Options section of the dialogue box. Shadows will not be generated if this option is not checked, even if shadows are turned on for your lights.

If you are not using the Garden sample drawing, you should also check that the Destination is set to "Viewport". You may also like to set the render background colour to white.

When you are sure that all settings have been made correctly (your dialogue box should look similar to the one illustrated above), click the Render button. AutoCAD will take a few seconds to render the scene (times will vary depending upon the complexity of the scene and the speed of your computer).

Modifying Sun Light
Once you have created your first sunlight render, you may want to change the time of day or date of the year in order to demonstrate the changing effect of sunlight on your site. You can modify your distant light settings at any time. To do so, select ViewRenderLight… from the pull-down menu to go to the Lights dialogue box. Select your light from the list on the left of the dialogue box and click the Modify… button. This will take you to the Modify Distant Light dialogue box.

Modify Distant Light Dialogue Box

From here you can modify any of the settings you made when you first configured the light. When your changes have been made, render the scene again and you will see the results of your modification. You could use this technique to create images of your site at hourly intervals during a single day or at the same time of day at different times of the year. This will give a good idea how sunlight will affect your site at different times.

Tips & TricksHot Tips

  • Distant Light IconYou may notice that when you create a light for the first time in a drawing, you not only gain a light but you also gain a small icon representing the light and a special new layer. Distant lights are displayed using the icon shown on the right and the name of the light is also shown. Do not move or erase distant light icons. Erasing the icon will delete the light. The new layer created for the light icon is called "ASHADE" and it is a special AutoCAD layer. Do not use this layer for anything else.ASHADE layer However, if you would like to hide your light icons, turn this layer off or freeze it.

  • To save your rendered images to file, set the Destination in the Render dialogue box to "File" and then use the More Options… button to configure file output.

  • Remember that shadows are only visible if they are cast against some solid object. For example, if you want to see shadows cast on the ground, you will need to draw a ground plane.

  • Working with shadow mapped shadows can be tricky and AutoCAD can sometimes throw up unexpected results. Use raytraced shadows to avoid confusion. See the All about Shadows tutorial for more details.