Procedural / dynamic coloring of skybox in OpenGL

I am developing an application that should display the procedural sky, what I mean is that the sky has a daily cycle, which varies depending on what time it is in the simulation.

I saw a method somewhere in the past where they have a color palette: enter image description hereenter image description here

Now, depending on some variable, such as time, somehow the code scans the image and uses a range of colors for the texture of the sky. Also, during sunrise / sunset, the code will scan for yellow, orange, red, as on the right.

I'm not sure what this is called, but I think this is what I need. I would like someone to show me or show me an example of using this technique with opengl and C ++.

On a side note, my skybox is not your average figure, but more - a sky-angle, as shown below enter image description here

As you can see, there is no peak to the horizon of the sky, these are only two blue sides that you see that will have the sky (black is BG). I was wondering if there is a way that I could make a process / dynamic night sky on these two plains (without a visible seam between them), and as a side issue there is also such that the top of the plain disappears to alpha regardless of its night or day

Any explanation / example of how to scan a color code and then set it as a texture in OpenGL / C ++ is greatly appreciated.

+5
source share
1 answer

( ) URL http://golabistudio.com/siamak/portfolio.html
++ , .
, 2 ( ). - skybox. - /. 1, . , , x = ( ).

- . , , 2 , , - : ( ) http://i.imgur.com/Rl8XJ.png

, uv ( ),

  float2 uvpos;
  uvpos.y = IN.uv.y;//the position same as skybox texture
  uvpos.x = 0;//a sample from first horizontal pixel
  float4 colour1 = tex2D( gradientTexture, uvpos);
  uvpos.x = 0.5;//a sample from second horizontal pixel
  float4 colour2 = tex2D( gradientTexture, uvpos);

  float4 skycolor = lerp(colour1 , colour2, (your day time));
  skycolor.xyz += tex2D(skyTexture, IN.uv).xyz;

, .

+1

All Articles