Sun Position Calculator

Announcements, requests and support regarding the Blender Indigo export script
User avatar
GNUdo
Posts: 40
Joined: Sat Feb 10, 2007 10:05 am
Contact:

Sun Position Calculator

Post by GNUdo » Thu Apr 17, 2008 9:05 pm

I'm trying to learn Python programming and recently I saw a discussion about a tool to calc the sun position that can be used with Indigo.
Most of the major 3D programs have a way to set the sun based on location, date, time, etc., but I'm a Blender user and I found no existing solution.
So I decided to write my own script. Initially I thought to expand Blendigo, because I use quite often Indigo to render, but I ended to write a separate script, so that the sun can be managed in Blender like any other lamp.

I think it is simple to understand the various parameters required, but I attached an image showing the script screenshots, including usage instructions.

Do you think it could be useful to someone else than me?
Can someone try it and report back any bug?
I'm sure it is full of bugs, first because I didn't find two different web sites that use the same formulas to do the calculations, but primarly because I'm a bad programmer :-(

Now Fiat Lux! :-)

Update:
# added check to handle wrong sunrise and sunset because of wrong TZ
# the "Now" button sets the current timezone
# added animation support
Attachments
fiat_lux.zip
Fiat Lux v0.7
(6 KiB) Downloaded 417 times
fiat_lux.gif
Fiat Lux screeshots (old version)
fiat_lux.gif (86.9 KiB) Viewed 6668 times
Last edited by GNUdo on Sat Apr 19, 2008 4:40 am, edited 1 time in total.

User avatar
Pinko5
Posts: 497
Joined: Mon Feb 19, 2007 8:15 pm
Location: Italy

Post by Pinko5 » Thu Apr 17, 2008 9:07 pm

Wow GNUdo very useful script i try it asap!!!
Luca. ;)

Vanessa07
Posts: 312
Joined: Mon Sep 24, 2007 11:17 pm
Location: Suisse

Post by Vanessa07 » Thu Apr 17, 2008 9:26 pm

Thx, Many people were waiting for this :D :D

User avatar
joegiampaoli
Posts: 837
Joined: Thu Oct 05, 2006 7:12 am
Location: San Miguel de Allende-MEXICO
Contact:

Post by joegiampaoli » Thu Apr 17, 2008 10:00 pm

Hmmm sun is created below horizon at my location at 3 PM :?

But looks promising.... :wink:
Joe Giampaoli
Never tie a ship to a single anchor, nor life to a single hope
My Indigo Gallery

User avatar
MESCH973
Posts: 76
Joined: Mon Mar 17, 2008 8:51 pm
Location: Italia

Post by MESCH973 » Thu Apr 17, 2008 11:13 pm

useful script GNUdo grazie

User avatar
GNUdo
Posts: 40
Joined: Sat Feb 10, 2007 10:05 am
Contact:

Post by GNUdo » Fri Apr 18, 2008 12:46 am

@joegiampaoli:

Do you mean "San Miguel de Allende-MEXICO" (20.92 N, 100.75 W) for your location?
Are you sure you entered all the required data (Latitude, Longitude, Date, Time, Timezone, DST)?
With the data shown in pic1, I get the Sun high on the horizon (see Altitude in pic2).
Attachments
pic1.gif
pic1.gif (28.92 KiB) Viewed 6552 times
pic2.gif
pic2.gif (23.71 KiB) Viewed 6554 times

User avatar
dougal2
Developer
Posts: 2532
Joined: Wed Nov 15, 2006 8:17 am
Location: South London

Post by dougal2 » Fri Apr 18, 2008 1:12 am

Very cool! I look forward to seeing a blender analemma render :)

(rendering an analemma is a good way to check that the eccentricity calculation is correct)

Gengibre
Posts: 19
Joined: Sun Jan 20, 2008 7:02 am

Post by Gengibre » Fri Apr 18, 2008 2:46 am

Thans, I will try it ASAP

Harry Beaver
Posts: 34
Joined: Thu Dec 06, 2007 11:52 pm

Post by Harry Beaver » Fri Apr 18, 2008 3:26 am

This is also very usefull to me, thanks ! trying right now

neepneep
Indigo 100
Posts: 413
Joined: Wed Jun 28, 2006 10:21 am

Post by neepneep » Fri Apr 18, 2008 3:50 am

Thanks!!! I've been waiting for a script like this for ages!!

Is it possible to animate ?? (would it be possible to do so with IPO curves?)

User avatar
Pinko5
Posts: 497
Joined: Mon Feb 19, 2007 8:15 pm
Location: Italy

Post by Pinko5 » Fri Apr 18, 2008 4:30 am

Ok for me works fine...
Tnx again
Luca. ;)

User avatar
GNUdo
Posts: 40
Joined: Sat Feb 10, 2007 10:05 am
Contact:

Post by GNUdo » Fri Apr 18, 2008 5:57 am

@neepneep:

It could be definitely possible to animate, but I'm not so familiar with animations, I've done only the basic tutorials.
Anyway a basic procedure could be:
- in the first frame put the sun here,
- in the next frame put it (here + (time increment)),
- and so on, right?
For animations where frame time increment is 1/25 sec or even 1 sec I don't think it is necessary to vary sun position every frame, maybe every minute..

Ok, I'll look into this

mario
Posts: 38
Joined: Sun Oct 22, 2006 3:57 am
Location: Carbonia(Sardinia Italy)

Post by mario » Fri Apr 18, 2008 7:44 am

Works fine here:
lat 39°1639 N
long. 8°9135 E
Thanks

User avatar
joegiampaoli
Posts: 837
Joined: Thu Oct 05, 2006 7:12 am
Location: San Miguel de Allende-MEXICO
Contact:

Post by joegiampaoli » Fri Apr 18, 2008 8:31 pm

GNUdo
Sorry I was enterning the west value wrong it was negative

Working well

Thx :D
Joe Giampaoli
Never tie a ship to a single anchor, nor life to a single hope
My Indigo Gallery

neepneep
Indigo 100
Posts: 413
Joined: Wed Jun 28, 2006 10:21 am

Post by neepneep » Fri Apr 18, 2008 9:04 pm

GNUdo wrote:@neepneep:

It could be definitely possible to animate, but I'm not so familiar with animations, I've done only the basic tutorials.
Anyway a basic procedure could be:
- in the first frame put the sun here,
- in the next frame put it (here + (time increment)),
- and so on, right?
For animations where frame time increment is 1/25 sec or even 1 sec I don't think it is necessary to vary sun position every frame, maybe every minute..

Ok, I'll look into this
There may be easier ways to do it - for example you could have an 'Insert IPO keyframe' button on your script GUI and when clicked, it would put the current date/time settings into the IPO editor.
Next, move to the desired end frame, change the date/location/etc in the script and then click 'Insert IPO keyframe'. That would plot the ending date/time and all you have to do is press alt-a to see the sun move - for each frame, the script would check the IPO curve and work out the appropriate interpolated time/date value and update the sun accordingly.

I don't know how useful it would be to animate the location, but naturally animating the time and date would be most useful....

Post Reply
17 posts

Who is online

Users browsing this forum: No registered users and 32 guests