MEL Sun Simulator

From TOI-Pedia
TOI Sun Simulator interface

Introduction

This script calculates the altitude and azimuth for the sun for any given date, time and location. It can automatically rotate a directional light for you.

Download

The SunSim script can be downloaded from our MEL Database.

Video Tutorial

Loading the player...


Usage (Quick reference)

  1. Load the script (source script)
  2. Launch the interface using the command: toi_sunSim();
  3. Select the directional light to be used (optional)
  4. Enter location and date and time
    You have to manually select if Daylight Saving Time is in effect!
  5. Click the Orient light to set date, time and location-button to rotate the specified directional light


This script was intended to be used with the Mental Ray Physical Sun and Sky, available from Maya 8.5. You can use the Mental Ray Physical Sun (called sunDirection) as the sun for this SunSim script.

More information on how to set up the Mental Ray Physical Sun and Sky in your scene can be found in the Mental Ray Physical Sun and Sky tutorial.

Usage (step-by-step)

Loading and starting the script

Download the MEL-script from our MEL Database and save it somewhere on your computer.

Open your Script Editor: Window » General Editors » Script Editor.

Click File » Source Script. Select the SunSim MEL-file that you downloaded.

You can launch the interface by entering the command toi_sunSim(); in the command line at the bottom of your screen and press [enter]. This is case sensitive, so make sure you get it right. You may omit the round brackets and semi-colon for single commands.

MEL sunSim start command.jpg


Preparation

You'll probably want the script to rotate a directional light for you, so you can render with a correct light setup. So you'll need to specify which light the script should use.

The script doesn't require any specific render type. You can make your own light setup for software rendering, or use Mental Ray. The script was intended however to be used with the Mental Ray Physical Sun and Sky.

To set up a Mental Ray Physical Sun and Sky, follow the Mental Ray Physical Sky tutorial now.

Once you've completed that setup, or when you choose to use your own light setup, it's time to let the script know which light to use. If you're using a Mental Ray Physical Sky and checked Automatically use MR Physical Sky, you don't have to do anything: the script will auto detect the light. Otherwise, select the Directional light and click Use selected in the Light section of the SunSim interface.

MEL sunSim select light.jpg

You can check Automatically update on changes (on by default). This will automatically rotate the directional light when the location, date or time is updated.

MEL sunSim auto update.jpg

Setting the Location

The location is specified in latitude and longitude. The default coordinates are the location of the faculty of Architecture in Delft (NL). You can use Google maps or any other application to obtain coordinates.

MEL sunSim location.jpg


Setting the orientation

By default, the script assumes the negative Z-axis to be pointing northward. If you need to change this, you can use the Orientation sub-section of the interface.


MEL sunSim orientation.jpg


You can create a graphical north-arrow in the origin by clicking (re)create. You can enter a rotation in the interface to rotate the north arrow, or you can rotate the arrow manually (make sure you select the arrow and not the circle around it).


Setting date and time

Date and time is pretty self-explanatory.

Please note that you have to manually specify whether 'Daylight Saving Time' is in effect (this is pretty complicated to calculate, as it's more of a cultural/political issue than it's physics).

MEL sunSim datetime.jpg


The default timezone is Central European Time. For other locations, a different timezone may be more appropriate. Only a few timezones are available as preset, but you can specify any timezone, using the UTC timezone and the timezone offset.


Rotating the light

If you didn't check Automatically update on changes in the Light section, you must click the Orient light to given date, time and location. The script will update the rotation of the specified light to the date, time and location you specified.

MEL sunSim orient.jpg

The script will also output some extra information, such as the altitude and azimuth (in degrees) of the sun at the given date and location. It also displays some estimates for the sunrise, sunset and 'solar noon' for the given date and location (these are accurate to within one minute for locations on earth).

Exposure control for Mental Ray Physical Sky

When you use the Mental Ray Physical Sky, your image may be over- or underexposed. You can use the mia_exposure_control (Tone Mapper) to control the exposure.

The mia_exposure_control node in the Hypershade (Utilities tab)


To give you some pointers for the values you could use:

 summer and fallwinter
Gain0.150.3
Compression3.04.0

Note that these are pointers only. You should fine-tune these settings to you own requirements or likings. For detailed information, please refer to the Tone Mapping page.

If you've created additional cameras after you've created the Physical Sky, you need to update the camera connections to be connected to the Physical Sky and exposure control.

Personal tools
Actions
Navigation
Tools