1
0
Fork 0

Fix bottom/middle/top shading, and update global clouds.

This commit is contained in:
Stuart Buchanan 2011-10-13 22:39:27 +01:00
parent 23e27e21ac
commit 0cbdcd6aa0
3 changed files with 116 additions and 83 deletions

View file

@ -34,63 +34,80 @@ ns = Nimbostratus (Rain cloud)
<PropertyList> <PropertyList>
<clouds> <clouds>
<cb-large> <cb-large>
<min-cloud-width-m>1600</min-cloud-width-m> <min-cloud-width-m>2200</min-cloud-width-m>
<min-cloud-height-m>4000</min-cloud-height-m> <min-cloud-height-m>1200</min-cloud-height-m>
<num-sprites>10</num-sprites> <num-sprites>3</num-sprites>
<texture>cl_cumulus.png</texture> <texture>/Models/Weather/congestus_sheet1.rgb</texture>
<num-textures-x>4</num-textures-x> <num-textures-x>1</num-textures-x>
<num-textures-y>4</num-textures-y> <num-textures-y>3</num-textures-y>
<min-bottom-lighting-factor>0.3</min-bottom-lighting-factor> <min-bottom-lighting-factor>0.2</min-bottom-lighting-factor>
<min-middle-lighting-factor>0.3</min-middle-lighting-factor>
<min-shade-lighting-factor>0.4</min-shade-lighting-factor> <min-shade-lighting-factor>0.4</min-shade-lighting-factor>
<min-sprite-width-m>800</min-sprite-width-m> <min-sprite-width-m>1300</min-sprite-width-m>
<min-sprite-height-m>800</min-sprite-height-m> <min-sprite-height-m>600</min-sprite-height-m>
<height-map-texture>true</height-map-texture> <height-map-texture>true</height-map-texture>
</cb-large> </cb-large>
<cb-small> <cb-small>
<min-cloud-width-m>800</min-cloud-width-m> <min-cloud-width-m>2200</min-cloud-width-m>
<min-cloud-height-m>800</min-cloud-height-m> <min-cloud-height-m>1200</min-cloud-height-m>
<num-sprites>3</num-sprites>
<texture>/Models/Weather/congestus_sheet1.rgb</texture>
<num-textures-x>1</num-textures-x>
<num-textures-y>3</num-textures-y>
<min-bottom-lighting-factor>0.3</min-bottom-lighting-factor>
<min-middle-lighting-factor>0.3</min-middle-lighting-factor>
<min-shade-lighting-factor>0.4</min-shade-lighting-factor>
<min-sprite-width-m>1300</min-sprite-width-m>
<min-sprite-height-m>600</min-sprite-height-m>
<height-map-texture>true</height-map-texture>
</cb-small>
<cu-con>
<min-cloud-width-m>900</min-cloud-width-m>
<min-cloud-height-m>500</min-cloud-height-m>
<num-sprites>10</num-sprites> <num-sprites>10</num-sprites>
<texture>cl_cumulus.png</texture> <texture>/Models/Weather/cumulus_sheet1.rgb</texture>
<num-textures-x>3</num-textures-x>
<num-textures-y>3</num-textures-y>
<min-bottom-lighting-factor>0.3</min-bottom-lighting-factor>
<min-shade-lighting-factor>0.4</min-shade-lighting-factor>
<min-sprite-width-m>600</min-sprite-width-m>
<max-sprite-width-m>900</max-sprite-width-m>
<min-sprite-height-m>600</min-sprite-height-m>
<max-sprite-height-m>900</max-sprite-height-m>
<height-map-texture>true</height-map-texture>
</cu-con>
<cu-large>
<min-cloud-width-m>1300</min-cloud-width-m>
<min-cloud-height-m>700</min-cloud-height-m>
<num-sprites>10</num-sprites>
<texture>/Textures/Sky/cl_cumulus2.png</texture>
<num-textures-x>4</num-textures-x> <num-textures-x>4</num-textures-x>
<num-textures-y>4</num-textures-y> <num-textures-y>4</num-textures-y>
<min-bottom-lighting-factor>0.3</min-bottom-lighting-factor> <min-bottom-lighting-factor>0.3</min-bottom-lighting-factor>
<min-middle-lighting-factor>0.6</min-middle-lighting-factor>
<min-top-lighting-factor>1.0</min-top-lighting-factor>
<min-shade-lighting-factor>0.4</min-shade-lighting-factor> <min-shade-lighting-factor>0.4</min-shade-lighting-factor>
<min-sprite-width-m>400</min-sprite-width-m> <min-sprite-width-m>600</min-sprite-width-m>
<min-sprite-height-m>400</min-sprite-height-m> <max-sprite-width-m>900</max-sprite-width-m>
<height-map-texture>true</height-map-texture> <min-sprite-height-m>600</min-sprite-height-m>
</cb-small> <max-sprite-height-m>900</max-sprite-height-m>
<cu-large>
<min-cloud-width-m>600</min-cloud-width-m>
<max-cloud-width-m>1200</max-cloud-width-m>
<min-cloud-height-m>400</min-cloud-height-m>
<max-cloud-height-m>800</max-cloud-height-m>
<num-sprites>20</num-sprites>
<texture>cl_cumulus2.png</texture>
<num-textures-x>4</num-textures-x>
<num-textures-y>4</num-textures-y>
<min-bottom-lighting-factor>0.2</min-bottom-lighting-factor>
<min-shade-lighting-factor>0.3</min-shade-lighting-factor>
<min-sprite-width-m>400</min-sprite-width-m>
<max-sprite-width-m>700</max-sprite-width-m>
<min-sprite-height-m>300</min-sprite-height-m>
<max-sprite-height-m>700</max-sprite-height-m>
<height-map-texture>true</height-map-texture> <height-map-texture>true</height-map-texture>
</cu-large> </cu-large>
<cu-small> <cu-small>
<min-cloud-width-m>600</min-cloud-width-m> <min-cloud-width-m>900</min-cloud-width-m>
<max-cloud-width-m>900</max-cloud-width-m> <min-cloud-height-m>500</min-cloud-height-m>
<min-cloud-height-m>400</min-cloud-height-m> <num-sprites>10</num-sprites>
<max-cloud-height-m>600</max-cloud-height-m> <texture>/Textures/Sky/cl_cumulus2.png</texture>
<num-sprites>20</num-sprites>
<texture>cl_cumulus2.png</texture>
<num-textures-x>4</num-textures-x> <num-textures-x>4</num-textures-x>
<num-textures-y>4</num-textures-y> <num-textures-y>4</num-textures-y>
<min-bottom-lighting-factor>0.4</min-bottom-lighting-factor> <min-bottom-lighting-factor>0.5</min-bottom-lighting-factor>
<min-middle-lighting-factor>0.7</min-middle-lighting-factor>
<min-top-lighting-factor>1.0</min-top-lighting-factor>
<min-shade-lighting-factor>0.5</min-shade-lighting-factor> <min-shade-lighting-factor>0.5</min-shade-lighting-factor>
<min-sprite-width-m>300</min-sprite-width-m> <min-sprite-width-m>600</min-sprite-width-m>
<max-sprite-width-m>400</max-sprite-width-m> <max-sprite-width-m>700</max-sprite-width-m>
<min-sprite-height-m>200</min-sprite-height-m> <min-sprite-height-m>500</min-sprite-height-m>
<max-sprite-height-m>300</max-sprite-height-m> <max-sprite-height-m>700</max-sprite-height-m>
<height-map-texture>true</height-map-texture> <height-map-texture>true</height-map-texture>
</cu-small> </cu-small>
<ns-large> <ns-large>
@ -102,11 +119,13 @@ ns = Nimbostratus (Rain cloud)
<texture>cl_st.png</texture> <texture>cl_st.png</texture>
<num-textures-x>1</num-textures-x> <num-textures-x>1</num-textures-x>
<num-textures-y>1</num-textures-y> <num-textures-y>1</num-textures-y>
<min-shade-lighting-factor>0.2</min-shade-lighting-factor>
<min-middle-lighting-factor>0.2</min-middle-lighting-factor>
<min-bottom-lighting-factor>0.2</min-bottom-lighting-factor> <min-bottom-lighting-factor>0.2</min-bottom-lighting-factor>
<min-sprite-width-m>300</min-sprite-width-m> <min-sprite-width-m>300</min-sprite-width-m>
<max-sprite-width-m>600</max-sprite-width-m> <max-sprite-width-m>600</max-sprite-width-m>
<min-sprite-height-m>100</min-sprite-height-m> <min-sprite-height-m>300</min-sprite-height-m>
<max-sprite-height-m>200</max-sprite-height-m> <max-sprite-height-m>600</max-sprite-height-m>
<height-map-texture>false</height-map-texture> <height-map-texture>false</height-map-texture>
<z-scale>0.5</z-scale> <z-scale>0.5</z-scale>
</ns-large> </ns-large>
@ -127,31 +146,44 @@ ns = Nimbostratus (Rain cloud)
<height-map-texture>false</height-map-texture> <height-map-texture>false</height-map-texture>
<z-scale>0.5</z-scale> <z-scale>0.5</z-scale>
</ns-white> </ns-white>
<st-small> <sc>
<min-cloud-width-m>1000</min-cloud-width-m> <min-cloud-width-m>3500</min-cloud-width-m>
<min-cloud-height-m>200</min-cloud-height-m> <min-cloud-height-m>1600</min-cloud-height-m>
<num-sprites>40</num-sprites> <num-sprites>4</num-sprites>
<texture>cl_cumulus.png</texture> <texture>/Models/Weather/congestus_sheet1.rgb</texture>
<num-textures-x>4</num-textures-x> <num-textures-x>1</num-textures-x>
<num-textures-y>4</num-textures-y> <num-textures-y>3</num-textures-y>
<min-bottom-lighting-factor>0.9</min-bottom-lighting-factor> <min-bottom-lighting-factor>0.5</min-bottom-lighting-factor>
<min-sprite-width-m>400</min-sprite-width-m> <min-sprite-width-m>1900</min-sprite-width-m>
<max-sprite-width-m>800</max-sprite-width-m> <max-sprite-width-m>2100</max-sprite-width-m>
<min-sprite-height-m>400</min-sprite-height-m> <min-sprite-height-m>1000</min-sprite-height-m>
<max-sprite-height-m>800</max-sprite-height-m> <max-sprite-height-m>1000</max-sprite-height-m>
<height-map-texture>false</height-map-texture> <height-map-texture>false</height-map-texture>
<z-scale>0.3</z-scale> <z-scale>0.3</z-scale>
</sc>
<st-small>
<min-cloud-width-m>4000</min-cloud-width-m>
<min-cloud-height-m>4000</min-cloud-height-m>
<num-sprites>20</num-sprites>
<texture>/Models/Weather/stratus_sheet1.rgb</texture>
<num-textures-x>3</num-textures-x>
<num-textures-y>2</num-textures-y>
<min-bottom-lighting-factor>0.4</min-bottom-lighting-factor>
<min-sprite-width-m>1500</min-sprite-width-m>
<min-sprite-height-m>1500</min-sprite-height-m>
<height-map-texture>false</height-map-texture>
<z-scale>0.4</z-scale>
</st-small> </st-small>
<st-large> <st-large>
<min-cloud-width-m>2000</min-cloud-width-m> <min-cloud-width-m>5000</min-cloud-width-m>
<min-cloud-height-m>1000</min-cloud-height-m> <min-cloud-height-m>5000</min-cloud-height-m>
<num-sprites>40</num-sprites> <num-sprites>20</num-sprites>
<texture>cl_st.png</texture> <texture>/Models/Weather/stratus_sheet1.rgb</texture>
<num-textures-x>1</num-textures-x> <num-textures-x>3</num-textures-x>
<num-textures-y>1</num-textures-y> <num-textures-y>2</num-textures-y>
<min-bottom-lighting-factor>0.9</min-bottom-lighting-factor> <min-bottom-lighting-factor>0.4</min-bottom-lighting-factor>
<min-sprite-width-m>600</min-sprite-width-m> <min-sprite-width-m>1900</min-sprite-width-m>
<min-sprite-height-m>600</min-sprite-height-m> <min-sprite-height-m>1900</min-sprite-height-m>
<height-map-texture>false</height-map-texture> <height-map-texture>false</height-map-texture>
<z-scale>0.4</z-scale> <z-scale>0.4</z-scale>
</st-large> </st-large>
@ -162,7 +194,7 @@ ns = Nimbostratus (Rain cloud)
<type>st-small</type> <type>st-small</type>
<count>5</count> <count>5</count>
<width>1000</width> <width>1000</width>
<height>200</height> <height>0</height>
<hdist>1</hdist> <hdist>1</hdist>
<vdist>1</vdist> <vdist>1</vdist>
</box> </box>
@ -173,7 +205,7 @@ ns = Nimbostratus (Rain cloud)
<type>cu-small</type> <type>cu-small</type>
<count>4</count> <count>4</count>
<width>800</width> <width>800</width>
<height>200</height> <height>0</height>
<hdist>2</hdist> <hdist>2</hdist>
<vdist>2</vdist> <vdist>2</vdist>
</box> </box>
@ -181,18 +213,18 @@ ns = Nimbostratus (Rain cloud)
<cu-con> <cu-con>
<box> <box>
<type>cu-large</type> <type>cu-con</type>
<count>1</count> <count>2</count>
<width>1500</width> <width>1500</width>
<height>200</height> <height>0</height>
<hdist>2</hdist> <hdist>2</hdist>
<vdist>1</vdist> <vdist>1</vdist>
</box> </box>
<box> <box>
<type>cu-small</type> <type>cu-small</type>
<count>4</count> <count>1</count>
<width>1000</width> <width>1000</width>
<height>200</height> <height>0</height>
<hdist>1</hdist> <hdist>1</hdist>
<vdist>2</vdist> <vdist>2</vdist>
</box> </box>
@ -254,8 +286,8 @@ ns = Nimbostratus (Rain cloud)
<sc> <sc>
<box> <box>
<type>cu-large</type> <type>sc</type>
<count>5</count> <count>1</count>
<width>2500</width> <width>2500</width>
<height>300</height> <height>300</height>
</box> </box>

View file

@ -15,9 +15,9 @@ float wScale = usrAttr1.b;
float hScale = usrAttr2.r; float hScale = usrAttr2.r;
float shade_factor = usrAttr2.g; float shade_factor = usrAttr2.g;
float cloud_height = usrAttr2.b; float cloud_height = usrAttr2.b;
float bottom_factor = shade_factor; float bottom_factor = usrAttr3.r;
float middle_factor = 1.0; float middle_factor = usrAttr3.g;
float top_factor = 1.0; float top_factor = usrAttr3.b;
void main(void) void main(void)
{ {
@ -55,15 +55,16 @@ void main(void)
// Determine the shading of the vertex. We shade it based on it's position // Determine the shading of the vertex. We shade it based on it's position
// in the cloud relative to the sun, and it's vertical position in the cloud. // in the cloud relative to the sun, and it's vertical position in the cloud.
float shade = mix(shade_factor, top_factor, smoothstep(-0.3, 0.0, n)); float shade = mix(shade_factor, top_factor, smoothstep(-0.3, 0.3, n));
//if (n < 0) { //if (n < 0) {
// shade = mix(top_factor, shade_factor, abs(n)); // shade = mix(top_factor, shade_factor, abs(n));
//} //}
float h = gl_Position.z; if (gl_Position.z < 0.5 * cloud_height) {
shade = min(shade, shade = min(shade, mix(bottom_factor, middle_factor, gl_Position.z * 2.0 / cloud_height));
min(mix(bottom_factor, middle_factor, smoothstep(0.0, 0.5 * h, h)), } else {
mix(middle_factor, top_factor, smoothstep(0.5 * h, h, h)) ) ); shade = min(shade, mix(middle_factor, top_factor, gl_Position.z * 2.0 / cloud_height - 1.0));
}
//float h = gl_Position.z / cloud_height; //float h = gl_Position.z / cloud_height;
//if (h < 0.5) { //if (h < 0.5) {
@ -78,7 +79,7 @@ void main(void)
gl_FrontColor = gl_LightSource[0].diffuse * shade + gl_FrontLightModelProduct.sceneColor; gl_FrontColor = gl_LightSource[0].diffuse * shade + gl_FrontLightModelProduct.sceneColor;
// As we get within 100m of the sprite, it is faded out. Equally at large distances it also fades out. // As we get within 100m of the sprite, it is faded out. Equally at large distances it also fades out.
gl_FrontColor.a = min(smoothstep(10.0, 100.0, fogCoord), 1.0 - smoothstep(range*0.8, range, fogCoord)); gl_FrontColor.a = min(smoothstep(10.0, 100.0, fogCoord), 1.0 - smoothstep(range*0.9, range, fogCoord));
gl_BackColor = gl_FrontColor; gl_BackColor = gl_FrontColor;
// Fog doesn't affect clouds as much as other objects. // Fog doesn't affect clouds as much as other objects.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 313 KiB

After

Width:  |  Height:  |  Size: 289 KiB