Where do I put the sun?

Blitz3D Forums/Blitz3D Programming/Where do I put the sun?

Lilprog(Posted 2004) [#1]
In my baseball game I want a moving sun during the game to simulate the shadows moving across the field. My question is what height to set the sun at. If you think about the trig for a second, The farther away the more realistic the shadows because the angle gets closer to the real angle, but there has to be a point where the angle change is so close that it is realistic. Plus I dont know the effects of putting a light real far away from the current playing field. Thoughts?

Rob


Rob Farley(Posted 2004) [#2]
The angle it totally dependant on where you are in the world and at what point in Earth is in it's orbit, which is why the sun is lower in the winter than in the summer for example.

Quite frankly, the way I do it is put a sun sprite in the sky, set the entity order so it draws behind scenary. And the put it at entityx(camera)+xoffset, yoffset , entityz(camera)+zoffset then play with the offsets until it looks right.

With regards to putting an actual dx light somewhere, again, it's just play with it until it looks right, but for the visible flare you should use what I mentioned above or it'll look like it's not very far away (because it won't be!)


slenkar(Posted 2004) [#3]
93 million miles away from the playing field.
and it has to be 14,000,000 kilometres wide.
nah just use the shadow system and a sprite


jhocking(Posted 2004) [#4]
In the sky. *rim shot*


AntonyWells(Posted 2004) [#5]
For the lights, use ranges within 0 to 1, not 0 to 255.

Then, you can position the lights realistically. (I.e where the sprite is, instead of 40,000 leagues above the sky)

the shading is also much nicer with 0-1 lights too imo.


jhocking(Posted 2004) [#6]
Heh, sorry about my first post. I couldn't resist.

For the visual of the sun use an add blend mode or alpha sprite. You don't have to actually put it all that far, just set EntityOrder so that it looks far away because it is behind everything. For the actual light use a directional light. Then the light will all be parallel coming from one direction, like sunlight, but you don't have to put it far away.


IPete2(Posted 2004) [#7]
Hee hee

http://www.blitzbasic.co.nz/Community/posts.php?topic=35967

check this out!

IPete2.