View topic - Dynamic Sun


All times are UTC + 1 hour


Post new topic Reply to topic  [ 29 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Dynamic Sun
PostPosted: 04 Mar 2011, 10:32 
Moderator
User avatar

Joined: 26 Oct 2007, 15:21
Sorry for the long post, but I got latest master to compile in VS 2005, but ran into 2 issues that I needed to fix for it to work:
In
Code:
void CFeatureDrawer::DrawFadeFeaturesSet(std::set<CFeature*>& fadeFeatures, int modelType)
{
   for (std::set<CFeature*>::const_iterator fi = fadeFeatures.begin(); fi != fadeFeatures.end(); ) {
      std::set<CFeature*>::const_iterator fiNext(fi); ++fiNext;

I had to change it to a non const iterator for it to compile:
Code:
void CFeatureDrawer::DrawFadeFeaturesSet(std::set<CFeature*>& fadeFeatures, int modelType)
{
   for (std::set<CFeature*>::iterator fi = fadeFeatures.begin(); fi != fadeFeatures.end(); ) {
      std::set<CFeature*>::iterator fiNext(fi); ++fiNext;

And in ./include/al/efx.h I had to change all
Code:
typedef void (AL_APIENTRY *LPALGENEFFECTS)(ALsizei, ALuint*);

to
Code:
typedef void (ALAPIENTRY *LPALGENEFFECTS)(ALsizei, ALuint*);



I loaded it up, and found this great new feature, dynamic sun :)
I dont mean to drop the bomb on this, but could you share how I can give parameters to this? Because most of my maps rely heavily on pre-baked lighting, and I would like to configure this to suit them more.

Also, I found numerous other rendering bugs, and would like to ask if I should share these, or are they known to you as well? Like the minimap getting corrupted, grass texture issues, and lighting level issues.

Thank you devs for your hard work on giving us great new features!
Top
 Offline Profile  
 
 Post subject: Re: Dynamic Sun
PostPosted: 04 Mar 2011, 17:03 
Spring Developer

Joined: 16 Dec 2006, 20:59
Add a fourth parameter to the "sunDir" in the map info (x,y,z,sunDist). "sunOrbitTime" (in seconds) and "sunStartAngle" (in radians) can also be set. The sun normally starts at the peak elevation point, but e.g. sunStartAngle = PI would make it start at the lowest elevation point.

x,y,z is the axis of rotation for the orbit and sunDist is the distance from the origin to the center of the orbit. So, for a sun that passes through zenith (x,0,z,0) so that x^2+z^2=1^2

For a sun at a constant elevation (0,1,0,sunDist), 0<sunDist<1. Note that a sun too near the horizon currently has zero brightness so cannot be seen.

To change settings at runtime:
Code:
Spring.SetSunParameters(x,y,z,sunDist,sunStartAngle,sunOrbitTime)

Or use completely manual control:
Code:
Spring.SetSunManualControl(true)
Spring.SetSunDirection(x,y,z)

Does it fail? Well it is all untested :)
Top
 Offline Profile  
 
 Post subject: Re: Dynamic Sun
PostPosted: 04 Mar 2011, 22:20 
Community Representative
User avatar

Joined: 08 Sep 2008, 21:59
Location: small cars
8)

awesome
Top
 Offline Profile  
 
 Post subject: Re: Dynamic Sun
PostPosted: 07 Mar 2011, 07:22 
Evolution RTS Developer
User avatar

Joined: 17 Nov 2005, 02:43
Oh hells yes! Excellent work!
Top
 Offline Profile  
 
 Post subject: Re: Dynamic Sun
PostPosted: 07 Mar 2011, 21:39 
User avatar

Joined: 30 Jun 2008, 23:08
Location: Germany
will this effect the shadows of the map (hills,...)? because i thought that they are fixed
Top
 Offline Profile  
 
 Post subject: Re: Dynamic Sun
PostPosted: 08 Mar 2011, 00:15 
Spring Developer

Joined: 16 Dec 2006, 20:59
Correct. Some maps have fixed shadows, and will not look very good if the sun direction is changed.
Top
 Offline Profile  
 
 Post subject: Re: Dynamic Sun
PostPosted: 08 Mar 2011, 00:41 
Evolution RTS Developer
User avatar

Joined: 17 Nov 2005, 02:43
@manolo, for maps that have the shadows literally baked in it won't look very good (very few maps do this tho). For the ones that have baked preshading (which is most of the high quality maps), it's possible that at certain points it might look a little odd, but I doubt it will be so noticeable that it will make a difference to the player. They are all going to be shitting themselves about dynamic sunlight to notice :-) And in the future, mapmakers will simply be not baking preshading, so while it "could" be an issue of sorts, it is one that will resolve itself.
Top
 Offline Profile  
 
 Post subject: Re: Dynamic Sun
PostPosted: 08 Mar 2011, 02:46 
Community Representative
User avatar

Joined: 08 Sep 2008, 21:59
Location: small cars
easy enough to an ambient bake rather than a directional shadowed one; im sure combined with ssmf it will look far superior to anything that exists ATM
Top
 Offline Profile  
 
 Post subject: Re: Dynamic Sun
PostPosted: 08 Mar 2011, 02:49 
User avatar

Joined: 22 Feb 2006, 01:02
Location: cheap kitchen
/shadows 2 turns off terrain shadows, guess you will still be able to do that on maps with pre baked shadows.
Top
 Offline Profile  
 
 Post subject: Re: Dynamic Sun
PostPosted: 08 Mar 2011, 09:02 
User avatar

Joined: 04 Jan 2011, 20:00
Oh great, then also implement a feature to let the teams swap sides.
I mean the team with the sun in their back has the advantage right?

:o)
Top
 Offline Profile  
 
 Post subject: Re: Dynamic Sun
PostPosted: 08 Mar 2011, 12:01 
Spring Developer

Joined: 16 Dec 2006, 20:59
And team1 cannot jeffyspam because the wind is too strong. Luckily team2 had some lightning strike their advfus to even things out a bit.
Top
 Offline Profile  
 
 Post subject: Re: Dynamic Sun
PostPosted: 08 Mar 2011, 12:06 
Spring Developer
User avatar

Joined: 28 Jun 2007, 06:30
Beherith wrote:
And in ./include/al/efx.h I had to change all
Code:
typedef void (AL_APIENTRY *LPALGENEFFECTS)(ALsizei, ALuint*);

to
Code:
typedef void (ALAPIENTRY *LPALGENEFFECTS)(ALsizei, ALuint*);

ALAPIENTRY is deprecated in OpenAL1.1, so update your OpenAL headers.
Top
 Offline Profile  
 
 Post subject: Re: Dynamic Sun
PostPosted: 08 Mar 2011, 19:34 
Evolution RTS Developer
User avatar

Joined: 17 Nov 2005, 02:43
knorke wrote:
/shadows 2 turns off terrain shadows, guess you will still be able to do that on maps with pre baked shadows.


Knorke... Prebaked shadows means that the shadow is burned into the texture. As a result, using /shadows 2 would do nothing.
Top
 Offline Profile  
 
 Post subject: Re: Dynamic Sun
PostPosted: 08 Mar 2011, 19:59 
MC: Legacy & Spring 1944 Developer
User avatar

Joined: 29 Apr 2005, 00:14
Location: #moddev - join it!
I think he was meaning 'turn off engine shadows if they look funky on old maps'
Top
 Offline Profile  
 
 Post subject: Re: Dynamic Sun
PostPosted: 08 Mar 2011, 20:26 
Evolution RTS Developer
User avatar

Joined: 17 Nov 2005, 02:43
Wouldn't this take the place of the engine shadows?
Top
 Offline Profile  
 
 Post subject: Re: Dynamic Sun
PostPosted: 09 Mar 2011, 01:22 
User avatar

Joined: 22 Feb 2006, 01:02
Location: cheap kitchen
if i understand correctly, those are the engine shadows just updated with a new feature.
Quote:
I think he was meaning 'turn off engine shadows if they look funky on old maps'
yup.
So if you have some old map with shadows drawn onto the terrain, it might be better to switch engine terrain shadows off so that you do not get double shadows, possible pointing in different directions.
Top
 Offline Profile  
 
 Post subject: Re: Dynamic Sun
PostPosted: 09 Mar 2011, 01:24 
Evolution RTS Developer
User avatar

Joined: 17 Nov 2005, 02:43
Ahh ok. YOur wording was a bit funky.
Top
 Offline Profile  
 
 Post subject: Re: Dynamic Sun
PostPosted: 09 Mar 2011, 01:37 
User avatar

Joined: 17 Sep 2010, 14:49
So how can this be turned off, for a map with shadows on the texture? SunOrbitTime=something?
Top
 Offline Profile  
 
 Post subject: Re: Dynamic Sun
PostPosted: 09 Mar 2011, 09:46 
Evolution RTS Developer
User avatar

Joined: 17 Nov 2005, 02:43
I believe this post answers your question (read all the way through to the end and it'll make sense).

zerver wrote:
Add a fourth parameter to the "sunDir" in the map info (x,y,z,sunDist). "sunOrbitTime" (in seconds) and "sunStartAngle" (in radians) can also be set. The sun normally starts at the peak elevation point, but e.g. sunStartAngle = PI would make it start at the lowest elevation point.

x,y,z is the axis of rotation for the orbit and sunDist is the distance from the origin to the center of the orbit. So, for a sun that passes through zenith (x,0,z,0) so that x^2+z^2=1^2

For a sun at a constant elevation (0,1,0,sunDist), 0<sunDist<1. Note that a sun too near the horizon currently has zero brightness so cannot be seen.

To change settings at runtime:
Code:
Spring.SetSunParameters(x,y,z,sunDist,sunStartAngle,sunOrbitTime)

Or use completely manual control:
Code:
Spring.SetSunManualControl(true)
Spring.SetSunDirection(x,y,z)

Does it fail? Well it is all untested :)
Top
 Offline Profile  
 
 Post subject: Re: Dynamic Sun
PostPosted: 09 Mar 2011, 23:37 
Spring Developer

Joined: 16 Dec 2006, 20:59
jK wrote:
ALAPIENTRY is deprecated in OpenAL1.1, so update your OpenAL headers.

https://github.com/downloads/spring/spr ... libs-v8.7z
Top
 Offline Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 29 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: Exabot [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Site layout created by Roflcopter et al.