Jump to content

ScatterSky Sun color


Recommended Posts

I have played with most all the variables on a scattersky and I can't change the sun color. In game it is pure white and the sun is kind of yellow in reality. Any changes I make to sunscale or colorize etc just turns the whole scene yellow. In the code:

mSunColor.set( 0, 0, 0, 1.0f );

mSunScale = ColorF::WHITE;

wont just change the sun it colors the whole scene, clouds and all. Anyone got a cool trick ?

Link to comment
Share on other sites

The properties under the scattersky have nothing to do with the sun at all, they are just there for how the lighting affects the scene. As far as i know the sun in torque is just a white disc with glow applied to it and the only way to change it is by changing the hlsl file for the scattersky, i think anyway the rayleigh colour is affected by the time of day to give that colour glow of yellow outside the main disc

EDIT: Im an idiot, rayleigh affects the colour of the sky not the sun sorry but it is in scattersky hlsl file somewhere

Edited by marauder2k9
Link to comment
Share on other sites

@marauder that picture almost proves my point, go out and look at the sun at sunset and the sky around it. With all the variables in there I think it should be closer.


Looking at the shaders/common/scattersky pixel and vertex doesn't show the color of the sun specifically.. I'll keep digging seems like it would be easy to just set 2 or 3 colors and lerp to the time of day but .... thanks for the reply

@fLUnKnhaXYU I changed the corona graphic and material to blues and greens and no difference on the sun in scattersky ... thanks ...

Link to comment
Share on other sites

I couldn't find anything on a corona color for the scattersky sun . All I can figure is that scatters the colors from a point which is the center of a sun . IDK , I couldnt see where it adds a sun object , just generates the sky coloring using the rayleigh setting .

you might try these settings

sunSize = 50

rayleighScttering = 0.2

meiScattering = ??? - I think this is more for objects in the sky (maybe something like 0.0045)

flareType = null - you can add you own flare , any color .

i used a medium blue color for colorize . you should get a sun area that is mostly the colorize color with a small amount of bright or scattered color . If it doesnt make sense Im probably just not expressing it well . Torque 3D documentation release 3.5.1 at readTheDocs page 82 Scatter Sky .

Link to comment
Share on other sites

I think I get what youre saying now . Theres a little on sunColor in both the scatterSky.CPP and the timeOfDay.CPP maybe youll see something there . Seems that putting a corona at the point in time of day would do it , then you could reduce the size for the scattersky sun to 0 and just use the corona and lighting settings . I found that slightly dimly lit look quite appealing . Im having a little trouble in finding some useful range for the MIE Scattering value , I cant see any change in the lighting .

heres another setting if you'd care to try it , its basically the same , with an orange light all the way across .


   new ScatterSky(testSSky) {
      skyBrightness = "0.6";
      sunSize = "100000";
      colorizeAmount = "80";
      colorize = "0.388235 0.388235 0.968628 1";
      rayleighScattering = "0.5";
      sunScale = "0.996 0.996 0.988 1";
      ambientScale = "0.302 0.302 0.298 0.184";
      fogScale = "0.976471 0.984314 0.996078 1";
      exposure = "999999";
      zOffset = "0";
      azimuth = "0";
      elevation = "35";
      moonAzimuth = "0";
      moonElevation = "45";
      castShadows = "1";
      staticRefreshFreq = "8";
      dynamicRefreshFreq = "8";
      brightness = "1";
      flareType = "NullLightFlare";
      flareScale = "2";
      nightColor = "0.0313726 0.0313726 0.0313726 1";
      nightFogColor = "0 0 0 1";
      moonEnabled = "1";
      moonMat = "Moon_Glow_Mat";
      moonScale = "0.02";
      moonLightColor = "0 0 0 1";
      useNightCubemap = "1";
      nightCubemap = "NightCubemap";
      attenuationRatio = "0 1 1";
      shadowType = "PSSM";
      texSize = "512";
      overDarkFactor = "2000 1000 500 100";
      shadowDistance = "100";
      shadowSoftness = "0.15";
      numSplits = "4";
      logWeight = "0.91";
      fadeStartDistance = "0";
      lastSplitTerrainOnly = "1";
      representedInLightmap = "1";
      shadowDarkenColor = "0.301961 0.313726 0.207843 0";
      includeLightmappedGeometryInShadow = "0";
      position = "-11.431 6.11889 100.864";
      Rotation = "1 0 0 0";
      scale = "1 1 1";
      canSave = "1";
      canSaveDynamicFields = "1";
         mieScattering = "0.0008";//----------this might be weird but Im not seeing much affect from changes to this setting
Link to comment
Share on other sites

  • 2 weeks later...

@Flun not sure the sunsize of 100000 is correct I use 0.15 since the stock size is way to big and exposure of 9999999 would way overdrive the clouds visual.

Any devs care to chime in on this? There is a huge struct and calculation for what I feel is a unnatural look. If I could just make a yellow sun I can be happy for now. Thanks .....

Link to comment
Share on other sites

@Hodo33 , Its all possibly quite contrary yet i believe that the rayleigh scattering is responsible for dimming things considerably in this case .

I think 999999 was as high as I could go .


I just played around with this because I agree that an orangish star would look nice , so those numbers produced the largest and darkest scatterSky sun that i could manage without super lighting the sky.background .

also I really do like the visual affect on the scene's lighting .

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...