day/ night cycle

Well its been quite some time since I registered and I havent contributed anything to the community.

So here are the blender sources, media and python script: mediafire.com/?okzzzmmdo2z

I tried to comment every line to make it understandable
The camera controls have been left the same to keep things simple, zoom out to see whats happening.
The day takes only 24 seconds (i think).

I know this is far from useful, just wanted to be helpful…

Clouds not by me: javierzhx.deviantart.com/art/Clo … s-34277964

this is quite a nice start Anon - it got some quirks and is perfectible as everything but it is something worth to work with because it is easy to understand for the beginner as well.
Got to fix that dome overlapping the ground though before to be really useful.

Nice stuff, thanks for sharing, but… shadows? Should the trees cast shadows on the terain?

I did that on purpose so people could see whats going on.
Well actually I have some problems with that code:
EDIT: was a wrong setting in Blender, fixed.

Don’t some games do it?

that was precisely what I meant with my sentence you quoted above, but you said that much better :wink:

Uh, I think you misunderstood. The updated code I posted above had to do what you said, it works for the other 2 domes, but the one with clouds doesnt work. Probably because it has transparency…

I did a quick try to fix and failed Anon
I recall I dug skyboxes before and rummaging my stuff I found this - try to see if you find something useful there to help you out.

Tried what?

I didnt find anything useful for me, thanks.

Well, duh, I know some games do it and it’s great.

I was saying that this code here does NOT do it. Or maybe there’s a problem on my side… but I don’t see shadows from the trees.

I think you need Panda3d 1.7 for the shadows.
Or maybe its your hardware.

Yea, I get no shadows either, or there is… but they don’t stand out.

Otherwise, nice demo ^^ I think I may use some of the code if you don’t mind.

Well I do, I always knew my pc was special
It does get weird when the sun goes below the ground though.
I also tried to fade the light to nothing, add a light at the moon position and when the time comes fade it to nothing and fade the sunlight back. Currently there is no transition at all when a new day starts. I tried to use a color interval and change the light transparency for this effect but it didnt work. There must be another way.

I wouldn’t post this in the snippets section if I did.

I myself think this is very unrealistic. I have tried to search some articles about how to do this but couldn’t find anything. Pleade tell me if you know of any.
Also I would like to change the sunlight colour depending on the time of the day with another interval, but I need info

I’m getting similar issues Anon:

and I know for sure light shadowcasting is working in other projects here - aint the time to dig though but you may try to find hypnos zombieshooter somewhere in the forums and easily see by yourself if you want.

Mmmm…I can see shadows only if I replace the DirectionalLight with a Spotlight.

I’m running on Ubuntu 9.10 (32bit) with GeForce Go 7400 (driver NVIDIA 190.53).

I downloaded the archive and tried again and it works, so I have no idea. Is it a good idea to use a spotlight for sun?

And I tried to add changing sun colour, but it looks like

LerpColorScaleInterval(dlightnode, 4, Vec4(1,1,1,1), Vec4(0.1,0.1,0.6,1), blendType = 'easeInOut')

will return an error because ‘dlightnode’ is a light node, not nodePath. Any suggestions on what to do instead?

while searching other stuff I randomly found this

So?..

I did and it works right for me.
So I still think this is a Panda3d issue.

For the record, I am using 1.7.0 on Windows and see no shadows. I will look up the suggested threads in the weekend but if you found the fix let us know…

1.7.0 on Mac

Looks normal, terrain gets dark when sun is not there. But no stencil like shadows as you can see:

I succeeded just using Spotlight - seems to me directlight is not actually suitable for tracing shadows - at least here.