Big bugs in 1.5.0 Pre 2

Report bugs, bug fixes and workarounds here.
Avatar
dirkpitt
Developer
Posts: 674
Joined: 24.10.2004
With us: 20 years 1 month

Post #21by dirkpitt » 10.05.2007, 00:09

I uploaded a new build on May 9 if that helps.
Celestia Unofficial page

Topic author
rthorvald
Posts: 1223
Joined: 20.10.2003
With us: 21 years 1 month
Location: Norway

Post #22by rthorvald » 10.05.2007, 00:15

dirkpitt wrote:I uploaded a new build on May 9 if that helps.
Celestia Unofficial page


I have that one: the red emissive bug is in it.

- rthorvald
Image

Avatar
dirkpitt
Developer
Posts: 674
Joined: 24.10.2004
With us: 20 years 1 month

Post #23by dirkpitt » 10.05.2007, 03:13

rthorvald wrote:
dirkpitt wrote:I uploaded a new build on May 9 if that helps.
Celestia Unofficial page

I have that one: the red emissive bug is in it.

- rthorvald


:oops: Blast.

Topic author
rthorvald
Posts: 1223
Joined: 20.10.2003
With us: 21 years 1 month
Location: Norway

Post #24by rthorvald » 10.05.2007, 13:55

Yet another bug in Pre 2:
Virtual Textures still breaks:
VT Levels above level 7 will not be drawn if the planet has rings. It is completely independent of resolution and memory, as i have tested this with all kinds of filesizes and formats.

This has been discussed before, but i didn??t immediately find the old posting about it...

- rthorvald
Image

Topic author
rthorvald
Posts: 1223
Joined: 20.10.2003
With us: 21 years 1 month
Location: Norway

Post #25by rthorvald » 11.05.2007, 16:17

In the version i got today, the emissive bug is gone.

- rthorvald
Image

Avatar
cartrite
Posts: 1978
Joined: 15.09.2005
With us: 19 years 2 months
Location: Pocono Mountains, Pennsylvania, USA Greate Grandfother from Irshava, Zakarpattia Oblast Ukraine

Post #26by cartrite » 11.05.2007, 23:56

I was trying the cvs version from 5/5/2007 and I noticed a problem with the hurricane model I created a while ago. It wasn't there. I downloaded the model Katrina from the motherlode and that wasn't visible either. Using the model from the mothherlode I noticed that the hurricane is visible when I changed the radius of the earth to 5378 but only when space is behind it. As soon as I rotate the earth the model diappears when It is viewed with earth in the background. These images show what I'm trying to say. I hope.

Image

Image
VivoBook_ASUSLaptop X712JA_S712JA Intel(R) UHD Graphics 8gb ram. Intel(R) Core(TM) i5-1035G1 CPU @ 1.00GHz, 1190 Mhz, 4 Core(s), 8 Logical Processor(s) 8 GB ram. Running on Windows 11 and OpenSuse 15.4

chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 9 months
Location: Seattle, Washington, USA

Post #27by chris » 12.05.2007, 00:44

cartrite wrote:I was trying the cvs version from 5/5/2007 and I noticed a problem with the hurricane model I created a while ago. It wasn't there. I downloaded the model Katrina from the motherlode and that wasn't visible either. Using the model from the mothherlode I noticed that the hurricane is visible when I changed the radius of the earth to 5378 but only when space is behind it. As soon as I rotate the earth the model diappears when It is viewed with earth in the background. These images show what I'm trying to say. I hope.


It sounds like a problem with sorting of translucent objects. Does the add-on feature a model with a transparent texture? If so, can you try adjusting the material opacity from 1.0 to 0.99? This provides a hint to Celestia that a mesh is translucent and should be rendered after opaque objects. This is a standard way of dealing (albeit incompletely) with the need to depth sort translucent objects in realtime 3D graphics. Previous versions of Celestia treated all meshes as potentially translucent, so they would be correctly ordered with respect to spheres. However, they weren't correctly sorted with respect to other meshes, so I added some code to flag as translucent only those meshes containing materials with opacity < 1. Unfortunately, meshes that are translucent only by virtue of a texture with an alpha channel are not detected by this code. I need to eventually write a function to snoop texture headers for alpha information. Until then, the opacity 0.99 trick should help.

--Chris

Avatar
cartrite
Posts: 1978
Joined: 15.09.2005
With us: 19 years 2 months
Location: Pocono Mountains, Pennsylvania, USA Greate Grandfother from Irshava, Zakarpattia Oblast Ukraine

Post #28by cartrite » 12.05.2007, 01:10

That does the trick alright. It's confusing as to why this would work though. I added that line to the material section for the invisible box.

Code: Select all

#celmodel__ascii

material
diffuse 0.85098 0.85098 0.85098
specular 0.498039 0.498039 0.498039
texture0 "cloud-katrina.png"
normalmap "cloud-norm-katrina.png"
specularmap "cloud-spec.png"
end_material

material
opacity 0.99
texture0 "invisible-box.png"
end_material

mesh
vertexdesc
position f3
normal f3
texcoord0 f2
tangent f3
end_vertexdesc

The box is still invisible as it should be. Originaly I had opacity 0.
I'll have to update the model on the motherlode and post some kind of warning or something. Thank's Chris.
cartrite
VivoBook_ASUSLaptop X712JA_S712JA Intel(R) UHD Graphics 8gb ram. Intel(R) Core(TM) i5-1035G1 CPU @ 1.00GHz, 1190 Mhz, 4 Core(s), 8 Logical Processor(s) 8 GB ram. Running on Windows 11 and OpenSuse 15.4

chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 9 months
Location: Seattle, Washington, USA

Post #29by chris » 12.05.2007, 01:38

cartrite wrote:The box is still invisible as it should be. Originaly I had opacity 0.
I'll have to update the model on the motherlode and post some kind of warning or something. Thank's Chris.
cartrite


I would set the opacity of the other material to 0.99. Otherwise, graphics processing power will be wasted drawing invisible pixels of the box. Celestia knows to discard geometry with opacity 0.0.

--Chris

Avatar
cartrite
Posts: 1978
Joined: 15.09.2005
With us: 19 years 2 months
Location: Pocono Mountains, Pennsylvania, USA Greate Grandfother from Irshava, Zakarpattia Oblast Ukraine

Post #30by cartrite » 12.05.2007, 07:19

That makes sense. Even when I couldn't see the model, the earth hesitated a little while it rotated as if the were being drawn. By putting the 0.99 in, it just changed the order the textures were drawn so the model textures were drawn last.
VivoBook_ASUSLaptop X712JA_S712JA Intel(R) UHD Graphics 8gb ram. Intel(R) Core(TM) i5-1035G1 CPU @ 1.00GHz, 1190 Mhz, 4 Core(s), 8 Logical Processor(s) 8 GB ram. Running on Windows 11 and OpenSuse 15.4

chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 9 months
Location: Seattle, Washington, USA

Post #31by chris » 12.05.2007, 11:13

rthorvald wrote:Yet another bug in Pre 2:
Virtual Textures still breaks:
VT Levels above level 7 will not be drawn if the planet has rings. It is completely independent of resolution and memory, as i have tested this with all kinds of filesizes and formats.

This has been discussed before, but i didn??t immediately find the old posting about it...


Thanks for filing a bug on the tracker, Runar. I just committed a fix for the problem to CVS. The problem was caused by an old hack that the new depth sorting code makes unnecessary.

--Chris

Topic author
rthorvald
Posts: 1223
Joined: 20.10.2003
With us: 21 years 1 month
Location: Norway

Post #32by rthorvald » 12.05.2007, 14:36

chris wrote:I just committed a fix for the problem to CVS. The problem was caused by an old hack that the new depth sorting code makes unnecessary


Well, now it works!
However, now on cannot go as close to the surface as before without the surface texture disappearing. That is an acceptable tradeoff, in my opinion - unless it is easily fixed, i??d leave it.

- rthorvald
Image

chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 9 months
Location: Seattle, Washington, USA

Post #33by chris » 12.05.2007, 17:13

rthorvald wrote:
chris wrote:I just committed a fix for the problem to CVS. The problem was caused by an old hack that the new depth sorting code makes unnecessary

Well, now it works!
However, now on cannot go as close to the surface as before without the surface texture disappearing. That is an acceptable tradeoff, in my opinion - unless it is easily fixed, i??d leave it.


At point is the texture disappearing?

--Chris

Topic author
rthorvald
Posts: 1223
Joined: 20.10.2003
With us: 21 years 1 month
Location: Norway

Post #34by rthorvald » 12.05.2007, 17:23

chris wrote:At point is the texture disappearing?


At about 20 kilometers up. Before, i could get within a couple of kilometers.
The planet??s radius is 47522 km, or slightly smaller than Saturn.

This is dependent on the radius, as at an earth-sized planet, there is no noticeable difference.

- rthorvald

PS: have you determined if the XYZ bug is an error in Pre 1 or Pre 2?
Image

Topic author
rthorvald
Posts: 1223
Joined: 20.10.2003
With us: 21 years 1 month
Location: Norway

Post #35by rthorvald » 13.05.2007, 15:17

Chris,
Re the clipping issue:

Today i cannot reproduce it. I do not understand it; this error must have something to do with my setup, or maybe the Celestia session; it does not seem to be a Celestia bug.

For example, yesterday the ground would disappear in the scene below. Today it does not. Maybe a memory issue... As i ran Celestia for some hours, maybe it just could not handle the load of a double(!) set of level 10 PNG 1024x1024 textures...

Incidentially, the below pic demonstrates very well why i wanted to get rid of the VT breaking bug so badly: The top frame is a screenshot using Pre 1. The bottom frame is the same scene with Pre 2 after your fix was applied... And the settings were identical in the two shots (the same textures, and the same rendering options enabled, on the same computer). The ONLY difference here is the Celestia version!
Image
(click for full-size)
- rthorvald
Image

jgrillo2002
Posts: 132
Joined: 26.07.2002
Age: 38
With us: 22 years 3 months
Location: New York, USA

Post #36by jgrillo2002 » 15.05.2007, 03:12

Chris. I get the uniform red planets problem. I have a GeForce 8800GTX with 2GB of ram and a Core 2 Duo 2.7 Ghz

here is the shaders log from mine. all my drivers are up to date

Code: Select all

Vertex shader source:
  1: uniform vec3 light0_direction;
  2: uniform vec3 light0_diffuse;
  3: uniform vec3 light0_specular;
  4: uniform vec3 light0_halfVector;
  5: uniform vec3 eyePosition;
  6: varying vec2 diffTexCoord;
  7: uniform float textureOffset;
  8: uniform vec3 atmosphereRadius;
  9: uniform float mieCoeff;
 10: uniform float mieH;
 11: uniform float mieK;
 12: uniform vec3 rayleighCoeff;
 13: uniform float rayleighH;
 14: uniform vec3 scatterCoeffSum;
 15: uniform vec3 invScatterCoeffSum;
 16: uniform vec3 extinctionCoeff;
 17: vec3 eyeDir = normalize(eyePosition - gl_Vertex.xyz);
 18: float NV = dot(gl_Normal, eyeDir);
 19: varying vec4 diffFactors;
 20: varying vec3 normal;
 21: varying vec3 lightHalfVec0;
 22: varying vec3 scatterEx;
 23:
 24: void main(void)
 25: {
 26: float NL;
 27: normal = gl_Normal;
 28: NL = max(0.0, dot(gl_Normal, light0_direction));
 29: diffFactors.x = NL;
 30: lightHalfVec0 = light0_direction + eyeDir;
 31: diffTexCoord = gl_MultiTexCoord0.st + vec2(textureOffset, 0.0);
 32: {
 33:     float rq = dot(eyePosition, eyeDir);
 34:     float qq = dot(eyePosition, eyePosition) - atmosphereRadius.y;
 35:     float d = sqrt(rq * rq - qq);
 36:     vec3 atmEnter = eyePosition + min(0.0, (-rq + d)) * eyeDir;
 37:     vec3 atmLeave = gl_Vertex.xyz;
 38:     vec3 atmSamplePoint = (atmEnter + atmLeave) * 0.5;
 39:     vec3 atmSamplePointSun = atmEnter * 0.5 + atmLeave * 0.5;
 40:     rq = dot(atmSamplePointSun, light0_direction);
 41:     qq = dot(atmSamplePointSun, atmSamplePointSun) - atmosphereRadius.y;
 42:     d = sqrt(rq * rq - qq);
 43:     float distSun = -rq + d;
 44:     float distAtm = length(atmEnter - atmLeave);
 45:     float density = 0.0;
 46:     atmSamplePoint = atmEnter * 0.333 + atmLeave * 0.667;
 47:     float h = max(0.0, length(atmSamplePoint) - atmosphereRadius.z);
 48:     density += exp(-h * mieH);
 49:     atmSamplePoint = atmEnter * 0.667 + atmLeave * 0.333;
 50:     h = max(0.0, length(atmSamplePoint) - atmosphereRadius.z);
 51:     density += exp(-h * mieH);
 52:     vec3 sunColor = exp(-extinctionCoeff * density * distSun);
 53:     vec3 ex = exp(-extinctionCoeff * density * distAtm);
 54:     float cosTheta = dot(eyeDir, light0_direction);
 55:     float phMie = (1.0 - mieK * mieK) / ((1.0 - mieK * cosTheta) * (1.0 - mieK * cosTheta));
 56:     float phRayleigh = 1.0;
 57:     scatterEx = ex;
 58:     gl_FrontSecondaryColor.rgb = (phRayleigh * rayleighCoeff + phMie * mieCoeff) * invScatterCoeffSum * sunColor * (1.0 - exp(-scatterCoeffSum * density * distAtm));
 59: }
 60: gl_Position = ftransform();
 61: }

Fragment shader source:
  1: uniform sampler2D diffTex;
  2: varying vec2 diffTexCoord;
  3: uniform vec3 ambientColor;
  4: uniform float opacity;
  5: varying vec4 diffFactors;
  6: vec4 diff = vec4(ambientColor, opacity);
  7: varying vec3 normal;
  8: vec4 spec = vec4(0.0);
  9: uniform float shininess;
 10: varying vec3 lightHalfVec0;
 11: uniform vec3 lightcolor0;
 12: uniform vec3 lightspecColor0;
 13: varying vec3 scatterEx;
 14:
 15: void main(void)
 16: {
 17: vec4 color;
 18: float NH;
 19: vec3 n = normalize(normal);
 20: diff.rgb += diffFactors.x * lightcolor0;
 21: NH = max(0.0, dot(n, normalize(lightHalfVec0)));
 22: spec.rgb += diffFactors.x * pow(NH, shininess) * lightspecColor0;
 23: color = texture2D(diffTex, diffTexCoord.st);
 24: gl_FragColor = color * diff + float(color.a) * spec;
 25: gl_FragColor.rgb = gl_FragColor.rgb * scatterEx + gl_SecondaryColor.rgb;
 26: }

Vertex shader source:
  1: uniform vec3 light0_direction;
  2: uniform vec3 light0_diffuse;
  3: uniform vec3 light0_specular;
  4: uniform vec3 light0_halfVector;
  5: uniform vec3 eyePosition;
  6: uniform vec3 atmosphereRadius;
  7: uniform float mieCoeff;
  8: uniform float mieH;
  9: uniform float mieK;
 10: uniform vec3 rayleighCoeff;
 11: uniform float rayleighH;
 12: uniform vec3 scatterCoeffSum;
 13: uniform vec3 invScatterCoeffSum;
 14: uniform vec3 extinctionCoeff;
 15: varying vec3 scatteredColor0;
 16: vec3 eyeDir = normalize(eyePosition - gl_Vertex.xyz);
 17: float NV = dot(gl_Normal, eyeDir);
 18: varying vec3 scatterEx;
 19: varying vec3 eyeDir_obj;
 20:
 21: void main(void)
 22: {
 23: float NL;
 24: {
 25:     float rq = dot(eyePosition, eyeDir);
 26:     float qq = dot(eyePosition, eyePosition) - atmosphereRadius.y;
 27:     float d = sqrt(rq * rq - qq);
 28:     vec3 atmEnter = eyePosition + min(0.0, (-rq + d)) * eyeDir;
 29:     vec3 atmLeave = gl_Vertex.xyz;
 30:     vec3 atmSamplePoint = (atmEnter + atmLeave) * 0.5;
 31:     vec3 atmSamplePointSun = atmEnter * 0.5 + atmLeave * 0.5;
 32:     rq = dot(atmSamplePointSun, light0_direction);
 33:     qq = dot(atmSamplePointSun, atmSamplePointSun) - atmosphereRadius.y;
 34:     d = sqrt(rq * rq - qq);
 35:     float distSun = -rq + d;
 36:     float distAtm = length(atmEnter - atmLeave);
 37:     float density = 0.0;
 38:     atmSamplePoint = atmEnter * 0.333 + atmLeave * 0.667;
 39:     float h = max(0.0, length(atmSamplePoint) - atmosphereRadius.z);
 40:     density += exp(-h * mieH);
 41:     atmSamplePoint = atmEnter * 0.667 + atmLeave * 0.333;
 42:     h = max(0.0, length(atmSamplePoint) - atmosphereRadius.z);
 43:     density += exp(-h * mieH);
 44:     vec3 sunColor = exp(-extinctionCoeff * density * distSun);
 45:     vec3 ex = exp(-extinctionCoeff * density * distAtm);
 46:     scatterEx = ex;
 47:     scatteredColor0 = sunColor * (1.0 - exp(-scatterCoeffSum * density * distAtm));
 48: }
 49: eyeDir_obj = eyeDir;
 50: gl_Position = ftransform();
 51: }

Fragment shader source:
  1: varying vec3 scatterEx;
  2: varying vec3 eyeDir_obj;
  3: uniform float mieK;
  4: uniform float mieCoeff;
  5: uniform vec3  rayleighCoeff;
  6: uniform vec3  invScatterCoeffSum;
  7: uniform vec3 light0_direction;
  8: varying vec3 scatteredColor0;
  9:
 10: void main(void)
 11: {
 12: vec3 color = vec3(0.0, 0.0, 0.0);
 13: vec3 V = normalize(eyeDir_obj);
 14:     float cosTheta = dot(V, light0_direction);
 15:     float phMie = (1.0 - mieK * mieK) / ((1.0 - mieK * cosTheta) * (1.0 - mieK * cosTheta));
 16:     float phRayleigh = 1.0;
 17:     color += (phRayleigh * rayleighCoeff + phMie * mieCoeff) * invScatterCoeffSum * scatteredColor0;
 18:     gl_FragColor = vec4(color, dot(scatterEx, vec3(0.333, 0.333, 0.333)));
 19: }

Vertex shader source:
  1: uniform vec3 light0_direction;
  2: uniform vec3 light0_diffuse;
  3: uniform vec3 light0_specular;
  4: uniform vec3 light0_halfVector;
  5: uniform vec3 eyePosition;
  6: varying vec2 diffTexCoord;
  7: uniform float textureOffset;
  8: uniform vec3 atmosphereRadius;
  9: uniform float mieCoeff;
 10: uniform float mieH;
 11: uniform float mieK;
 12: uniform vec3 rayleighCoeff;
 13: uniform float rayleighH;
 14: uniform vec3 scatterCoeffSum;
 15: uniform vec3 invScatterCoeffSum;
 16: uniform vec3 extinctionCoeff;
 17: vec3 eyeDir = normalize(eyePosition - gl_Vertex.xyz);
 18: float NV = dot(gl_Normal, eyeDir);
 19: uniform vec3 ambientColor;
 20: uniform float opacity;
 21: varying vec4 diff;
 22: varying vec3 scatterEx;
 23:
 24: void main(void)
 25: {
 26: float NL;
 27: diff = vec4(ambientColor, opacity);
 28: NL = max(0.0, dot(gl_Normal, light0_direction));
 29: diff.rgb += light0_diffuse * NL;
 30: diffTexCoord = gl_MultiTexCoord0.st + vec2(textureOffset, 0.0);
 31: {
 32:     float rq = dot(eyePosition, eyeDir);
 33:     float qq = dot(eyePosition, eyePosition) - atmosphereRadius.y;
 34:     float d = sqrt(rq * rq - qq);
 35:     vec3 atmEnter = eyePosition + min(0.0, (-rq + d)) * eyeDir;
 36:     vec3 atmLeave = gl_Vertex.xyz;
 37:     vec3 atmSamplePoint = (atmEnter + atmLeave) * 0.5;
 38:     vec3 atmSamplePointSun = atmEnter * 0.5 + atmLeave * 0.5;
 39:     rq = dot(atmSamplePointSun, light0_direction);
 40:     qq = dot(atmSamplePointSun, atmSamplePointSun) - atmosphereRadius.y;
 41:     d = sqrt(rq * rq - qq);
 42:     float distSun = -rq + d;
 43:     float distAtm = length(atmEnter - atmLeave);
 44:     float density = 0.0;
 45:     atmSamplePoint = atmEnter * 0.333 + atmLeave * 0.667;
 46:     float h = max(0.0, length(atmSamplePoint) - atmosphereRadius.z);
 47:     density += exp(-h * mieH);
 48:     atmSamplePoint = atmEnter * 0.667 + atmLeave * 0.333;
 49:     h = max(0.0, length(atmSamplePoint) - atmosphereRadius.z);
 50:     density += exp(-h * mieH);
 51:     vec3 sunColor = exp(-extinctionCoeff * density * distSun);
 52:     vec3 ex = exp(-extinctionCoeff * density * distAtm);
 53:     float cosTheta = dot(eyeDir, light0_direction);
 54:     float phMie = (1.0 - mieK * mieK) / ((1.0 - mieK * cosTheta) * (1.0 - mieK * cosTheta));
 55:     float phRayleigh = 1.0;
 56:     scatterEx = ex;
 57:     gl_FrontSecondaryColor.rgb = (phRayleigh * rayleighCoeff + phMie * mieCoeff) * invScatterCoeffSum * sunColor * (1.0 - exp(-scatterCoeffSum * density * distAtm));
 58: }
 59: gl_Position = ftransform();
 60: }

Fragment shader source:
  1: uniform sampler2D diffTex;
  2: varying vec2 diffTexCoord;
  3: varying vec4 diff;
  4: varying vec3 scatterEx;
  5:
  6: void main(void)
  7: {
  8: vec4 color;
  9: color = texture2D(diffTex, diffTexCoord.st);
 10: gl_FragColor = color * diff;
 11: gl_FragColor.rgb = gl_FragColor.rgb * scatterEx + gl_SecondaryColor.rgb;
 12: }

Vertex shader source:
  1: uniform vec3 light0_direction;
  2: uniform vec3 light0_diffuse;
  3: uniform vec3 light0_specular;
  4: uniform vec3 light0_halfVector;
  5: uniform vec3 eyePosition;
  6: varying vec2 diffTexCoord;
  7: uniform float textureOffset;
  8: uniform vec3 atmosphereRadius;
  9: uniform float mieCoeff;
 10: uniform float mieH;
 11: uniform float mieK;
 12: uniform vec3 rayleighCoeff;
 13: uniform float rayleighH;
 14: uniform vec3 scatterCoeffSum;
 15: uniform vec3 invScatterCoeffSum;
 16: uniform vec3 extinctionCoeff;
 17: vec3 eyeDir = normalize(eyePosition - gl_Vertex.xyz);
 18: float NV = dot(gl_Normal, eyeDir);
 19: varying vec4 diffFactors;
 20: varying vec3 normal;
 21: varying vec3 lightHalfVec0;
 22: varying vec3 scatterEx;
 23: uniform float cloudShadowTexOffset;
 24: uniform float cloudHeight;
 25: varying vec2 cloudShadowTexCoord0;
 26:
 27: void main(void)
 28: {
 29: float NL;
 30: normal = gl_Normal;
 31: NL = max(0.0, dot(gl_Normal, light0_direction));
 32: diffFactors.x = NL;
 33: lightHalfVec0 = light0_direction + eyeDir;
 34: diffTexCoord = gl_MultiTexCoord0.st + vec2(textureOffset, 0.0);
 35: {
 36:     float rq = dot(light0_direction, gl_Vertex.xyz);
 37:     float qq = dot(gl_Vertex.xyz, gl_Vertex.xyz) - cloudHeight * cloudHeight;
 38:     float d = sqrt(rq * rq - qq);
 39:     vec3 cloudSpherePos = (gl_Vertex.xyz + (-rq + d) * light0_direction);
 40:     float invPi = 1.0 / 3.1415927;
 41:     cloudShadowTexCoord0.y = 0.5 - asin(cloudSpherePos.y) * invPi;
 42:     float u = fract(atan(cloudSpherePos.x, cloudSpherePos.z) * (invPi * 0.5) + 0.75);
 43:     if (diffTexCoord.x < 0.25 && u > 0.5) u -= 1.0;
 44:     else if (diffTexCoord.x > 0.75 && u < 0.5) u += 1.0;
 45:     cloudShadowTexCoord0.x = u + cloudShadowTexOffset;
 46: }
 47: {
 48:     float rq = dot(eyePosition, eyeDir);
 49:     float qq = dot(eyePosition, eyePosition) - atmosphereRadius.y;
 50:     float d = sqrt(rq * rq - qq);
 51:     vec3 atmEnter = eyePosition + min(0.0, (-rq + d)) * eyeDir;
 52:     vec3 atmLeave = gl_Vertex.xyz;
 53:     vec3 atmSamplePoint = (atmEnter + atmLeave) * 0.5;
 54:     vec3 atmSamplePointSun = atmEnter * 0.5 + atmLeave * 0.5;
 55:     rq = dot(atmSamplePointSun, light0_direction);
 56:     qq = dot(atmSamplePointSun, atmSamplePointSun) - atmosphereRadius.y;
 57:     d = sqrt(rq * rq - qq);
 58:     float distSun = -rq + d;
 59:     float distAtm = length(atmEnter - atmLeave);
 60:     float density = 0.0;
 61:     atmSamplePoint = atmEnter * 0.333 + atmLeave * 0.667;
 62:     float h = max(0.0, length(atmSamplePoint) - atmosphereRadius.z);
 63:     density += exp(-h * mieH);
 64:     atmSamplePoint = atmEnter * 0.667 + atmLeave * 0.333;
 65:     h = max(0.0, length(atmSamplePoint) - atmosphereRadius.z);
 66:     density += exp(-h * mieH);
 67:     vec3 sunColor = exp(-extinctionCoeff * density * distSun);
 68:     vec3 ex = exp(-extinctionCoeff * density * distAtm);
 69:     float cosTheta = dot(eyeDir, light0_direction);
 70:     float phMie = (1.0 - mieK * mieK) / ((1.0 - mieK * cosTheta) * (1.0 - mieK * cosTheta));
 71:     float phRayleigh = 1.0;
 72:     scatterEx = ex;
 73:     gl_FrontSecondaryColor.rgb = (phRayleigh * rayleighCoeff + phMie * mieCoeff) * invScatterCoeffSum * sunColor * (1.0 - exp(-scatterCoeffSum * density * distAtm));
 74: }
 75: gl_Position = ftransform();
 76: }

Fragment shader source:
  1: uniform sampler2D diffTex;
  2: varying vec2 diffTexCoord;
  3: uniform vec3 ambientColor;
  4: uniform float opacity;
  5: varying vec4 diffFactors;
  6: vec4 diff = vec4(ambientColor, opacity);
  7: varying vec3 normal;
  8: vec4 spec = vec4(0.0);
  9: uniform float shininess;
 10: varying vec3 lightHalfVec0;
 11: uniform vec3 lightcolor0;
 12: uniform vec3 lightspecColor0;
 13: varying vec3 scatterEx;
 14: uniform sampler2D cloudShadowTex;
 15: varying vec2 cloudShadowTexCoord0;
 16:
 17: void main(void)
 18: {
 19: vec4 color;
 20: float shadow;
 21: float NH;
 22: vec3 n = normalize(normal);
 23: shadow = diffFactors.x;
 24: shadow *= (1.0 - texture2D(cloudShadowTex, cloudShadowTexCoord0).a * 0.75);
 25: diff.rgb += shadow * lightcolor0;
 26: NH = max(0.0, dot(n, normalize(lightHalfVec0)));
 27: spec.rgb += shadow * pow(NH, shininess) * lightspecColor0;
 28: color = texture2D(diffTex, diffTexCoord.st);
 29: gl_FragColor = color * diff + float(color.a) * spec;
 30: gl_FragColor.rgb = gl_FragColor.rgb * scatterEx + gl_SecondaryColor.rgb;
 31: }

Error linking shader program:
Vertex info
-----------
(63) : warning C7532: global function exp requires "#version 110" before use
(67) : warning C7532: global function exp requires "#version 110" before use
Internal error: assembly compile error for vertex shader at offset 4535:
-- error message --
line 128, column 13:  error: invalid operand variable
-- internal assembly text --
!!NVvp4.0
# cgc version 2.0.0001, build date Apr 20 2007 06:21:05
# command line args:
#vendor NVIDIA Corporation
#version 2.0.0.1
#profile gp4vp
#program main
#semantic gl_ModelViewProjectionMatrixTranspose : STATE.MATRIX.MVP
#semantic light0_direction
#semantic light0_diffuse
#semantic light0_specular
#semantic light0_halfVector
#semantic eyePosition
#semantic textureOffset
#semantic atmosphereRadius
#semantic mieCoeff
#semantic mieH
#semantic mieK
#semantic rayleighCoeff
#semantic rayleighH
#semantic scatterCoeffSum
#semantic invScatterCoeffSum
#semantic extinctionCoeff
#semantic cloudShadowTexOffset
#semantic cloudHeight
#var float4 gl_Position : $vout.POSITION : HPOS : -1 : 1
#var float3 gl_Normal : $vin.NORMAL : ATTR2 : -1 : 1
#var float4 gl_Vertex : $vin.POSITION : ATTR0 : -1 : 1
#var float4 gl_MultiTexCoord0 : $vin.TEXCOORD0 : ATTR8 : -1 : 1
#var float4 gl_FrontSecondaryColor : $vout.COLOR1 : COL1 : -1 : 1
#var float4x4 gl_ModelViewProjectionMatrixTranspose : STATE.MATRIX.MVP : c[0], 4 : -1 : 1
#var float3 light0_direction :  : c[4] : -1 : 1
#var float3 light0_diffuse :  :  : -1 : 0
#var float3 light0_specular :  :  : -1 : 0
#var float3 light0_halfVector :  :  : -1 : 0
#var float3 eyePosition :  : c[5] : -1 : 1
#var float2 diffTexCoord : $vout.ATTR0.XY : ATTR0 : -1 : 1
#var float textureOffset :  : c[6] : -1 : 1
#var float3 atmosphereRadius :  : c[7] : -1 : 1
#var float mieCoeff :  : c[8] : -1 : 1
#var float mieH :  : c[9] : -1 : 1
#var float mieK :  : c[10] : -1 : 1
#var float3 rayleighCoeff :  : c[11] : -1 : 1
#var float rayleighH :  :  : -1 : 0
#var float3 scatterCoeffSum :  : c[12] : -1 : 1
#var float3 invScatterCoeffSum :  : c[13] : -1 : 1
#var float3 extinctionCoeff :  : c[14] : -1 : 1
#var float4 diffFactors : $vout.ATTR1 : ATTR1 : -1 : 1
#var float3 normal : $vout.ATTR2.XYZ : ATTR2 : -1 : 1
#var float3 lightHalfVec0 : $vout.ATTR3.XYZ : ATTR3 : -1 : 1
#var float3 scatterEx : $vout.ATTR4.XYZ : ATTR4 : -1 : 1
#var float cloudShadowTexOffset :  : c[15] : -1 : 1
#var float cloudHeight :  : c[16] : -1 : 1
#var float2 cloudShadowTexCoord0 : $vout.ATTR5.XY : ATTR5 : -1 : 1
PARAM c[17] = { state.matrix.mvp,
      program.local[4..16] };
ATTRIB vertex_attrib[] = { vertex.attrib[0..8] };
OUTPUT result_attrib[] = { result.attrib[0..5] };
TEMP R0, R1, R2, R3;
TEMP RC, HC;
DP3.F R0.x, vertex.attrib[0], vertex.attrib[0];
MAD.F R0.y, -c[16].x, c[16].x, R0.x;
DP3.F R0.x, vertex.attrib[0], c[4];
MAD.F R0.y, R0.x, R0.x, -R0;
RSQ.F R0.y, R0.y;
RCP.F R0.y, R0.y;
ADD.F R0.x, -R0, R0.y;
MUL.F R0.xyz, R0.x, c[4];
ADD.F R1.xyz, vertex.attrib[0], R0;
MAX.F R1.w, |R1.z|, |R1.x|;
MIN.F R0.w, |R1.z|, |R1.x|;
DIV.F R0.w, R0, R1.w;
MUL.F R1.w, R0, R0;
SGT.F R1.z, |R1.x|, |R1|;
MAD.F R2.x, R1.w, {-0.01348047, 0.057477314, 0, 0}, {-0.01348047, 0.057477314, 0, 0}.y;
MAD.F R2.x, R2, R1.w, {-0.12123907, 0, 0, 0};
MAD.F R2.x, R2, R1.w, {0.19563593, 0, 0, 0};
MAD.F R2.x, R2, R1.w, {-0.33299461, 0, 0, 0};
MAD.F R1.w, R2.x, R1, {0.99999565, 0, 0, 0}.x;
MUL.F R0.w, R1, R0;
MOV.F R1.x, R0.w;
TRUNC.U.CC HC.x, R1.z;
ADD.F R1.x(NE), -R0.w, {1.5707964, 0, 0, 0};
SLT.F R0.z, vertex.attrib[0], -R0;
MOV.F R0.w, R1.x;
TRUNC.U.CC HC.x, R0.z;
ADD.F R0.w(NE.x), -R1.x, {3.1415927, 0, 0, 0}.x;
SLT.F R0.x, vertex.attrib[0], -R0;
MOV.F R0.z, R0.w;
TRUNC.U.CC HC.x, R0;
MOV.F R0.z(NE.x), -R0.w;
MAD.F R0.x, R0.z, {0.15915494, 0.75, 0, 0}, {0.15915494, 0.75, 0, 0}.y;
MAD.F R0.z, |R1.y|, {-0.018729299, 0.074261002, 0, 0}.x, {-0.018729299, 0.074261002, 0, 0}.y;
MAD.F R0.z, |R1.y|, R0, {-0.21211439, 0, 0, 0}.x;
FRC.F R0.w, R0.x;
SGT.F R0.x, R0.w, {0.5, 0, 0, 0};
TRUNC.U R1.z, R0.x;
ADD.F R0.x, -|R1.y|, {1, 0, 0, 0};
MAD.F R0.z, |R1.y|, R0, {1.5707288, 0, 0, 0}.x;
SLT.F R1.y, vertex.attrib[0], -R0;
TRUNC.U R1.w, R1.y;
RSQ.F R0.x, R0.x;
RCP.F R0.x, R0.x;
MAD.F R1.x, -R0, R0.z, {1.5707964, 0, 0, 0};
ADD.F R0.xyz, -vertex.attrib[0], c[5];
DP3.F R1.y, R0, R0;
RSQ.F R1.y, R1.y;
MUL.F R0.xyz, R1.y, R0;
I2F   R1.w, R1;
MUL.F R1.w, R1, R1.x;
MAD.F R1.x, -R1.w, {2, 0, 0, 0}, R1;
MAD.F result.attrib[5].y, -R1.x, {0.31830987, 0.5, 0, 0}.x, {0.31830987, 0.5, 0, 0};
ADD.F result.attrib[3].xyz, R0, c[4];
MOV.F R1.y, {0, 0, 0, 0}.x;
MOV.F R1.x, c[6];
ADD.F R1.xy, vertex.attrib[8], R1;
MOV.F result.attrib[2].xyz, vertex.attrib[2];
MOV.F result.attrib[0].xy, R1;
SLT.F R1.y, R1.x, {0.25, 0, 0, 0}.x;
DP3.F R1.x, vertex.attrib[2], c[4];
TRUNC.U R1.y, R1;
AND.U.CC HC.x, R1.y, R1.z;
MAX.F result.attrib[1].x, R1, {0, 0, 0, 0};
IF    NE.x;
ADD.F R0.w, R0, {-1, 0, 0, 0}.x;
ELSE;
SLT.F R1.y, R0.w, {0.5, 0, 0, 0}.x;
SGT.F R1.x, result.attrib[0], {0.75, 0, 0, 0};
TRUNC.U R1.y, R1;
TRUNC.U R1.x, R1;
AND.U.CC HC.x, R1, R1.y;
IF    NE.x;
ADD.F R0.w, R0, {1, 0, 0, 0}.x;
ENDIF;
ENDIF;
DP3.F R1.x, c[5], c[5];
ADD.F R1.y, R1.x, -c[7];
DP3.F R1.x, R0, c[5];
MAD.F R1.y, R1.x, R1.x, -R1;
RSQ.F R1.y, R1.y;
RCP.F R1.y, R1.y;
ADD.F R1.x, -R1, R1.y;
MIN.F R1.w, R1.x, {0, 0, 0, 0}.x;
MAD.F R2.xyz, R1.w, R0, c[5];
MUL.F R1.xyz, vertex.attrib[0], {0.667, 0, 0, 0}.x;
MAD.F R1.xyz, R2, {0.333, 0, 0, 0}.x, R1;
DP3.F R1.x, R1, R1;
RSQ.F R1.w, R1.x;
MUL.F R1.xyz, vertex.attrib[0], {0.333, 0, 0, 0}.x;
MAD.F R1.xyz, R2, {0.667, 0, 0, 0}.x, R1;
DP3.F R1.x, R1, R1;
RCP.F R1.w, R1.w;
ADD.F R1.w, R1, -c[7].z;
MAX.F R1.y, R1.w, {0, 0, 0, 0}.x;
MUL.F R1.y, -R1, c[9].x;
RSQ.F R1.x, R1.x;
RCP.F R1.x, R1.x;
ADD.F R2.w, R1.x, -c[7].z;
POW.F R1.w, {2.7182817, 0, 0, 0}.x, R1.y;
ADD.F R1.xyz, R2, vertex.attrib[0];
MAX.F R2.w, R2, {0, 0, 0, 0}.x;
MUL.F R3.x, -R2.w, c[9];
MUL.F R1.xyz, R1, {0.5, 0, 0, 0}.x;
DP3.F R2.w, R1, R1;
ADD.F R3.y, R2.w, -c[7];
DP3.F R2.w, R1, c[4];
POW.F R3.x, {2.7182817, 0, 0, 0}.x, R3.x;
MAD.F R1.x, R2.w, R2.w, -R3.y;
ADD.F R1.w, R1, R3.x;
RSQ.F R3.x, R1.x;
DP3.F R0.x, R0, c[4];
RCP.F R3.x, R3.x;
ADD.F R0.y, -R2.w, R3.x;
MUL.F R2.w, -R0.x, c[10].x;
ADD.F R3.x, R2.w, {1, 0, 0, 0};
MAD.F R2.w, R3.x, R2, R3.x;
RCP.F R3.x, R2.w;
MUL.F R1.xyz, R1.w, -c[14];
MUL.F R0.xyz, R1, R0.y;
MUL.F R2.w, c[10].x, c[10].x;
MAD.F R2.w, -R2, R3.x, R3.x;
MUL.F R2.w, R2, c[8].x;
ADD.F R2.xyz, R2, -vertex.attrib[0];
ADD.F R3.xyz, R2.w, c[11];
DP3.F R2.w, R2, R2;
RSQ.F R2.w, R2.w;
DIV.F R1.xyz, R1, R2.w;
MUL.F R2.xyz, R3, c[13];
POW.F R0.x, {2.7182817, 0, 0, 0}.x, R0.x;
POW.F R0.y, {2.7182817, 0, 0, 0}.x, R0.y;
POW.F R0.z, {2.7182817, 0, 0, 0}.x, R0.z;
MUL.F R0.xyz, R2, R0;
MUL.F R2.xyz, R1.w, -c[12];
DIV.F R2.xyz, R2, R2.w;
POW.F R2.x, {2.7182817, 0, 0, 0}.x, R2.x;
POW.F R2.y, {2.7182817, 0, 0, 0}.x, R2.y;
POW.F R2.z, {2.7182817, 0, 0, 0}.x, R2.z;
MAD.F result.color.secondary.xyz, -R2, R0, R0;
POW.F result.attrib[4].x, {2.7182817, 0, 0, 0}.x, R1.x;
POW.F result.attrib[4].y, {2.7182817, 0, 0, 0}.x, R1.y;
POW.F result.attrib[4].z, {2.7182817, 0, 0, 0}.x, R1.z;
ADD.F result.attrib[5].x, R0.w, c[15];
DP4.F result.position.w, vertex.attrib[0], c[3];
DP4.F result.position.z, vertex.attrib[0], c[2];
DP4.F result.position.y, vertex.attrib[0], c[1];
DP4.F result.position.x, vertex.attrib[0], c[0];
END
# 146 instructions, 4 R-regs
Vertex shader source:
  1: uniform vec3 light0_direction;
  2: uniform vec3 light0_diffuse;
  3: uniform vec3 light0_specular;
  4: uniform vec3 light0_halfVector;
  5: uniform vec3 eyePosition;
  6: varying vec2 diffTexCoord;
  7: varying vec2 nightTexCoord;
  8: uniform float textureOffset;
  9: uniform vec3 atmosphereRadius;
 10: uniform float mieCoeff;
 11: uniform float mieH;
 12: uniform float mieK;
 13: uniform vec3 rayleighCoeff;
 14: uniform float rayleighH;
 15: uniform vec3 scatterCoeffSum;
 16: uniform vec3 invScatterCoeffSum;
 17: uniform vec3 extinctionCoeff;
 18: vec3 eyeDir = normalize(eyePosition - gl_Vertex.xyz);
 19: float NV = dot(gl_Normal, eyeDir);
 20: varying vec4 diffFactors;
 21: varying vec3 normal;
 22: varying vec3 lightHalfVec0;
 23: varying float totalLight;
 24: uniform float nightTexMin;
 25: varying vec3 scatterEx;
 26: uniform float cloudShadowTexOffset;
 27: uniform float cloudHeight;
 28: varying vec2 cloudShadowTexCoord0;
 29:
 30: void main(void)
 31: {
 32: float NL;
 33: totalLight = 0.0;
 34: normal = gl_Normal;
 35: NL = max(0.0, dot(gl_Normal, light0_direction));
 36: diffFactors.x = NL;
 37: lightHalfVec0 = light0_direction + eyeDir;
 38: totalLight += NL;
 39: totalLight = 1.0 - totalLight;
 40: totalLight = totalLight * totalLight * totalLight * totalLight;
 41: totalLight = max(totalLight, nightTexMin);
 42: diffTexCoord = gl_MultiTexCoord0.st + vec2(textureOffset, 0.0);
 43: nightTexCoord = gl_MultiTexCoord1.st;
 44: {
 45:     float rq = dot(light0_direction, gl_Vertex.xyz);
 46:     float qq = dot(gl_Vertex.xyz, gl_Vertex.xyz) - cloudHeight * cloudHeight;
 47:     float d = sqrt(rq * rq - qq);
 48:     vec3 cloudSpherePos = (gl_Vertex.xyz + (-rq + d) * light0_direction);
 49:     float invPi = 1.0 / 3.1415927;
 50:     cloudShadowTexCoord0.y = 0.5 - asin(cloudSpherePos.y) * invPi;
 51:     float u = fract(atan(cloudSpherePos.x, cloudSpherePos.z) * (invPi * 0.5) + 0.75);
 52:     if (diffTexCoord.x < 0.25 && u > 0.5) u -= 1.0;
 53:     else if (diffTexCoord.x > 0.75 && u < 0.5) u += 1.0;
 54:     cloudShadowTexCoord0.x = u + cloudShadowTexOffset;
 55: }
 56: {
 57:     float rq = dot(eyePosition, eyeDir);
 58:     float qq = dot(eyePosition, eyePosition) - atmosphereRadius.y;
 59:     float d = sqrt(rq * rq - qq);
 60:     vec3 atmEnter = eyePosition + min(0.0, (-rq + d)) * eyeDir;
 61:     vec3 atmLeave = gl_Vertex.xyz;
 62:     vec3 atmSamplePoint = (atmEnter + atmLeave) * 0.5;
 63:     vec3 atmSamplePointSun = atmEnter * 0.5 + atmLeave * 0.5;
 64:     rq = dot(atmSamplePointSun, light0_direction);
 65:     qq = dot(atmSamplePointSun, atmSamplePointSun) - atmosphereRadius.y;
 66:     d = sqrt(rq * rq - qq);
 67:     float distSun = -rq + d;
 68:     float distAtm = length(atmEnter - atmLeave);
 69:     float density = 0.0;
 70:     atmSamplePoint = atmEnter * 0.333 + atmLeave * 0.667;
 71:     float h = max(0.0, length(atmSamplePoint) - atmosphereRadius.z);
 72:     density += exp(-h * mieH);
 73:     atmSamplePoint = atmEnter * 0.667 + atmLeave * 0.333;
 74:     h = max(0.0, length(atmSamplePoint) - atmosphereRadius.z);
 75:     density += exp(-h * mieH);
 76:     vec3 sunColor = exp(-extinctionCoeff * density * distSun);
 77:     vec3 ex = exp(-extinctionCoeff * density * distAtm);
 78:     float cosTheta = dot(eyeDir, light0_direction);
 79:     float phMie = (1.0 - mieK * mieK) / ((1.0 - mieK * cosTheta) * (1.0 - mieK * cosTheta));
 80:     float phRayleigh = 1.0;
 81:     scatterEx = ex;
 82:     gl_FrontSecondaryColor.rgb = (phRayleigh * rayleighCoeff + phMie * mieCoeff) * invScatterCoeffSum * sunColor * (1.0 - exp(-scatterCoeffSum * density * distAtm));
 83: }
 84: gl_Position = ftransform();
 85: }

Fragment shader source:
  1: uniform sampler2D diffTex;
  2: uniform sampler2D nightTex;
  3: varying vec2 diffTexCoord;
  4: varying vec2 nightTexCoord;
  5: uniform vec3 ambientColor;
  6: uniform float opacity;
  7: varying vec4 diffFactors;
  8: vec4 diff = vec4(ambientColor, opacity);
  9: varying vec3 normal;
 10: vec4 spec = vec4(0.0);
 11: uniform float shininess;
 12: varying vec3 lightHalfVec0;
 13: uniform vec3 lightcolor0;
 14: uniform vec3 lightspecColor0;
 15: varying float totalLight;
 16: varying vec3 scatterEx;
 17: uniform sampler2D cloudShadowTex;
 18: varying vec2 cloudShadowTexCoord0;
 19:
 20: void main(void)
 21: {
 22: vec4 color;
 23: float shadow;
 24: float NH;
 25: vec3 n = normalize(normal);
 26: shadow = diffFactors.x;
 27: shadow *= (1.0 - texture2D(cloudShadowTex, cloudShadowTexCoord0).a * 0.75);
 28: diff.rgb += shadow * lightcolor0;
 29: NH = max(0.0, dot(n, normalize(lightHalfVec0)));
 30: spec.rgb += shadow * pow(NH, shininess) * lightspecColor0;
 31: color = texture2D(diffTex, diffTexCoord.st);
 32: gl_FragColor = color * diff + float(color.a) * spec;
 33: gl_FragColor += texture2D(nightTex, nightTexCoord.st) * totalLight;
 34: gl_FragColor.rgb = gl_FragColor.rgb * scatterEx + gl_SecondaryColor.rgb;
 35: }

Error linking shader program:
Vertex info
-----------
(72) : warning C7532: global function exp requires "#version 110" before use
(76) : warning C7532: global function exp requires "#version 110" before use
Internal error: assembly compile error for vertex shader at offset 4972:
-- error message --
line 140, column 13:  error: invalid operand variable
-- internal assembly text --
!!NVvp4.0
# cgc version 2.0.0001, build date Apr 20 2007 06:21:05
# command line args:
#vendor NVIDIA Corporation
#version 2.0.0.1
#profile gp4vp
#program main
#semantic gl_ModelViewProjectionMatrixTranspose : STATE.MATRIX.MVP
#semantic light0_direction
#semantic light0_diffuse
#semantic light0_specular
#semantic light0_halfVector
#semantic eyePosition
#semantic textureOffset
#semantic atmosphereRadius
#semantic mieCoeff
#semantic mieH
#semantic mieK
#semantic rayleighCoeff
#semantic rayleighH
#semantic scatterCoeffSum
#semantic invScatterCoeffSum
#semantic extinctionCoeff
#semantic nightTexMin
#semantic cloudShadowTexOffset
#semantic cloudHeight
#var float4 gl_Position : $vout.POSITION : HPOS : -1 : 1
#var float3 gl_Normal : $vin.NORMAL : ATTR2 : -1 : 1
#var float4 gl_Vertex : $vin.POSITION : ATTR0 : -1 : 1
#var float4 gl_MultiTexCoord0 : $vin.TEXCOORD0 : ATTR8 : -1 : 1
#var float4 gl_MultiTexCoord1 : $vin.TEXCOORD1 : ATTR9 : -1 : 1
#var float4 gl_FrontSecondaryColor : $vout.COLOR1 : COL1 : -1 : 1
#var float4x4 gl_ModelViewProjectionMatrixTranspose : STATE.MATRIX.MVP : c[0], 4 : -1 : 1
#var float3 light0_direction :  : c[4] : -1 : 1
#var float3 light0_diffuse :  :  : -1 : 0
#var float3 light0_specular :  :  : -1 : 0
#var float3 light0_halfVector :  :  : -1 : 0
#var float3 eyePosition :  : c[5] : -1 : 1
#var float2 diffTexCoord : $vout.ATTR0.XY : ATTR0 : -1 : 1
#var float2 nightTexCoord : $vout.ATTR1.XY : ATTR1 : -1 : 1
#var float textureOffset :  : c[6] : -1 : 1
#var float3 atmosphereRadius :  : c[7] : -1 : 1
#var float mieCoeff :  : c[8] : -1 : 1
#var float mieH :  : c[9] : -1 : 1
#var float mieK :  : c[10] : -1 : 1
#var float3 rayleighCoeff :  : c[11] : -1 : 1
#var float rayleighH :  :  : -1 : 0
#var float3 scatterCoeffSum :  : c[12] : -1 : 1
#var float3 invScatterCoeffSum :  : c[13] : -1 : 1
#var float3 extinctionCoeff :  : c[14] : -1 : 1
#var float4 diffFactors : $vout.ATTR2 : ATTR2 : -1 : 1
#var float3 normal : $vout.ATTR3.XYZ : ATTR3 : -1 : 1
#var float3 lightHalfVec0 : $vout.ATTR4.XYZ : ATTR4 : -1 : 1
#var float totalLight : $vout.ATTR5.X : ATTR5 : -1 : 1
#var float nightTexMin :  : c[15] : -1 : 1
#var float3 scatterEx : $vout.ATTR6.XYZ : ATTR6 : -1 : 1
#var float cloudShadowTexOffset :  : c[16] : -1 : 1
#var float cloudHeight :  : c[17] : -1 : 1
#var float2 cloudShadowTexCoord0 : $vout.ATTR7.XY : ATTR7 : -1 : 1
PARAM c[18] = { state.matrix.mvp,
      program.local[4..17] };
ATTRIB vertex_attrib[] = { vertex.attrib[0..9] };
OUTPUT result_attrib[] = { result.attrib[0..7] };
TEMP R0, R1, R2, R3;
TEMP RC, HC;
DP3.F R0.x, vertex.attrib[0], vertex.attrib[0];
MAD.F R0.y, -c[17].x, c[17].x, R0.x;
DP3.F R0.x, vertex.attrib[0], c[4];
MAD.F R0.y, R0.x, R0.x, -R0;
RSQ.F R0.y, R0.y;
RCP.F R0.y, R0.y;
ADD.F R0.x, -R0, R0.y;
MUL.F R0.xyz, R0.x, c[4];
ADD.F R1.xyz, vertex.attrib[0], R0;
SLT.F R0.y, vertex.attrib[0], -R0;
TRUNC.U R0.y, R0;
MAX.F R1.w, |R1.z|, |R1.x|;
MIN.F R0.w, |R1.z|, |R1.x|;
DIV.F R0.w, R0, R1.w;
MUL.F R1.w, R0, R0;
SGT.F R1.z, |R1.x|, |R1|;
MAD.F R2.x, R1.w, {-0.01348047, 0.057477314, 0, 0}, {-0.01348047, 0.057477314, 0, 0}.y;
MAD.F R2.x, R2, R1.w, {-0.12123907, 0, 0, 0};
MAD.F R2.x, R2, R1.w, {0.19563593, 0, 0, 0};
MAD.F R2.x, R2, R1.w, {-0.33299461, 0, 0, 0};
MAD.F R1.w, R2.x, R1, {0.99999565, 0, 0, 0}.x;
MUL.F R0.w, R1, R0;
MOV.F R1.x, R0.w;
TRUNC.U.CC HC.x, R1.z;
ADD.F R1.x(NE), -R0.w, {1.5707964, 0, 0, 0};
SLT.F R0.z, vertex.attrib[0], -R0;
MOV.F R0.w, R1.x;
TRUNC.U.CC HC.x, R0.z;
ADD.F R0.w(NE.x), -R1.x, {3.1415927, 0, 0, 0}.x;
SLT.F R0.x, vertex.attrib[0], -R0;
MOV.F R0.z, R0.w;
TRUNC.U.CC HC.x, R0;
MOV.F R0.z(NE.x), -R0.w;
MAD.F R0.x, R0.z, {0.15915494, 0.75, 0, 0}, {0.15915494, 0.75, 0, 0}.y;
ADD.F R0.z, -|R1.y|, {1, 0, 0, 0}.x;
FRC.F R0.w, R0.x;
SGT.F R0.x, R0.w, {0.5, 0, 0, 0};
TRUNC.U R1.z, R0.x;
MAD.F R0.x, |R1.y|, {-0.018729299, 0.074261002, 0, 0}, {-0.018729299, 0.074261002, 0, 0}.y;
MAD.F R0.x, |R1.y|, R0, {-0.21211439, 0, 0, 0};
MAD.F R0.x, |R1.y|, R0, {1.5707288, 0, 0, 0};
DP3.F R1.y, vertex.attrib[2], c[4];
RSQ.F R0.z, R0.z;
RCP.F R0.z, R0.z;
MAD.F R0.x, -R0.z, R0, {1.5707964, 0, 0, 0};
I2F   R0.y, R0;
MUL.F R0.y, R0, R0.x;
MAD.F R0.x, -R0.y, {2, 0, 0, 0}, R0;
MAD.F result.attrib[7].y, -R0.x, {0.31830987, 0.5, 0, 0}.x, {0.31830987, 0.5, 0, 0};
ADD.F R0.xyz, -vertex.attrib[0], c[5];
DP3.F R1.x, R0, R0;
MAX.F R1.w, R1.y, {0, 0, 0, 0}.x;
RSQ.F R1.y, R1.x;
MUL.F R0.xyz, R1.y, R0;
ADD.F R1.x, -R1.w, {1, 0, 0, 0};
MUL.F R1.y, R1.x, R1.x;
MUL.F R1.y, R1, R1.x;
MUL.F R2.x, R1.y, R1;
ADD.F result.attrib[4].xyz, R0, c[4];
MOV.F result.attrib[3].xyz, vertex.attrib[2];
MOV.F R1.y, {0, 0, 0, 0}.x;
MOV.F R1.x, c[6];
ADD.F R1.xy, vertex.attrib[8], R1;
MAX.F result.attrib[5].x, R2, c[15];
MOV.F result.attrib[0].xy, R1;
SLT.F R1.x, R1, {0.25, 0, 0, 0};
MOV.F result.attrib[1].xy, vertex.attrib[9];
TRUNC.U R1.x, R1;
AND.U.CC HC.x, R1, R1.z;
MOV.F result.attrib[2].x, R1.w;
IF    NE.x;
ADD.F R0.w, R0, {-1, 0, 0, 0}.x;
ELSE;
SLT.F R1.y, R0.w, {0.5, 0, 0, 0}.x;
SGT.F R1.x, result.attrib[0], {0.75, 0, 0, 0};
TRUNC.U R1.y, R1;
TRUNC.U R1.x, R1;
AND.U.CC HC.x, R1, R1.y;
IF    NE.x;
ADD.F R0.w, R0, {1, 0, 0, 0}.x;
ENDIF;
ENDIF;
DP3.F R1.x, c[5], c[5];
ADD.F R1.y, R1.x, -c[7];
DP3.F R1.x, R0, c[5];
MAD.F R1.y, R1.x, R1.x, -R1;
RSQ.F R1.y, R1.y;
RCP.F R1.y, R1.y;
ADD.F R1.x, -R1, R1.y;
MIN.F R1.w, R1.x, {0, 0, 0, 0}.x;
MAD.F R2.xyz, R1.w, R0, c[5];
MUL.F R1.xyz, vertex.attrib[0], {0.667, 0, 0, 0}.x;
MAD.F R1.xyz, R2, {0.333, 0, 0, 0}.x, R1;
DP3.F R1.x, R1, R1;
RSQ.F R1.w, R1.x;
MUL.F R1.xyz, vertex.attrib[0], {0.333, 0, 0, 0}.x;
MAD.F R1.xyz, R2, {0.667, 0, 0, 0}.x, R1;
DP3.F R1.x, R1, R1;
RCP.F R1.w, R1.w;
ADD.F R1.w, R1, -c[7].z;
MAX.F R1.y, R1.w, {0, 0, 0, 0}.x;
MUL.F R1.y, -R1, c[9].x;
RSQ.F R1.x, R1.x;
RCP.F R1.x, R1.x;
ADD.F R2.w, R1.x, -c[7].z;
POW.F R1.w, {2.7182817, 0, 0, 0}.x, R1.y;
ADD.F R1.xyz, R2, vertex.attrib[0];
MAX.F R2.w, R2, {0, 0, 0, 0}.x;
MUL.F R3.x, -R2.w, c[9];
MUL.F R1.xyz, R1, {0.5, 0, 0, 0}.x;
DP3.F R2.w, R1, R1;
ADD.F R3.y, R2.w, -c[7];
DP3.F R2.w, R1, c[4];
POW.F R3.x, {2.7182817, 0, 0, 0}.x, R3.x;
MAD.F R1.x, R2.w, R2.w, -R3.y;
ADD.F R1.w, R1, R3.x;
RSQ.F R3.x, R1.x;
DP3.F R0.x, R0, c[4];
RCP.F R3.x, R3.x;
ADD.F R0.y, -R2.w, R3.x;
MUL.F R2.w, -R0.x, c[10].x;
ADD.F R3.x, R2.w, {1, 0, 0, 0};
MAD.F R2.w, R3.x, R2, R3.x;
RCP.F R3.x, R2.w;
MUL.F R1.xyz, R1.w, -c[14];
MUL.F R0.xyz, R1, R0.y;
MUL.F R2.w, c[10].x, c[10].x;
MAD.F R2.w, -R2, R3.x, R3.x;
MUL.F R2.w, R2, c[8].x;
ADD.F R2.xyz, R2, -vertex.attrib[0];
ADD.F R3.xyz, R2.w, c[11];
DP3.F R2.w, R2, R2;
RSQ.F R2.w, R2.w;
DIV.F R1.xyz, R1, R2.w;
MUL.F R2.xyz, R3, c[13];
POW.F R0.x, {2.7182817, 0, 0, 0}.x, R0.x;
POW.F R0.y, {2.7182817, 0, 0, 0}.x, R0.y;
POW.F R0.z, {2.7182817, 0, 0, 0}.x, R0.z;
MUL.F R0.xyz, R2, R0;
MUL.F R2.xyz, R1.w, -c[12];
DIV.F R2.xyz, R2, R2.w;
POW.F R2.x, {2.7182817, 0, 0, 0}.x, R2.x;
POW.F R2.y, {2.7182817, 0, 0, 0}.x, R2.y;
POW.F R2.z, {2.7182817, 0, 0, 0}.x, R2.z;
MAD.F result.color.secondary.xyz, -R2, R0, R0;
POW.F result.attrib[6].x, {2.7182817, 0, 0, 0}.x, R1.x;
POW.F result.attrib[6].y, {2.7182817, 0, 0, 0}.x, R1.y;
POW.F result.attrib[6].z, {2.7182817, 0, 0, 0}.x, R1.z;
ADD.F result.attrib[7].x, R0.w, c[16];
DP4.F result.position.w, vertex.attrib[0], c[3];
DP4.F result.position.z, vertex.attrib[0], c[2];
DP4.F result.position.y, vertex.attrib[0], c[1];
DP4.F result.position.x, vertex.attrib[0], c[0];
END
# 153 instructions, 4 R-regs

chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 9 months
Location: Seattle, Washington, USA

Post #37by chris » 15.05.2007, 06:38

jgrillo2002 wrote:Chris. I get the uniform red planets problem. I have a GeForce 8800GTX with 2GB of ram and a Core 2 Duo 2.7 Ghz

here is the shaders log from mine. all my drivers are up to date


Thanks for posting your shaders.log file. Just yesterday, I checked in fixes for the errors and warnings logged. #version 110 is now present in all Celestia shaders, which will silence the warnings. Cloud shadows were causing an internal shader compiler error in the GeForce 8800 driver. Another change that I made yesterday disables the complex cloud shaders, since they've been causing all sorts of trouble and slowdown--some of it the fault of Celestia, while other issues are graphics driver problems. The quick summary: if you update Celestia from CVS or wait for version 1.5.0pre3, the shaders problems will be gone, and so will the red Earth you're seeing now.

--Chris

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 22
With us: 22 years 7 months
Location: Hamburg, Germany

Post #38by t00fri » 15.05.2007, 07:03

After recompiling CVS, I now find that 'cloud shadows' simply don't have any visible effect anymore. Is this right? If so people might be wondering about what the menue entry is supposed to stand for.

Bye Fridger
Image

Avatar
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Post #39by Cham » 15.05.2007, 10:13

I don't see any cloud shadows too. Nothing.
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 9 months
Location: Seattle, Washington, USA

Post #40by chris » 15.05.2007, 10:27

t00fri wrote:After recompiling CVS, I now find that 'cloud shadows' simply don't have any visible effect anymore. Is this right? If so people might be wondering about what the menue entry is supposed to stand for.


They do have a visible effect, but not when used with virtual textures textures or 'split' textures (i.e. textures too large for hardware.) There are three approaches that I have for addressing this, but I didn't deem them important enough to justify delaying 1.5.0.

- Cube maps clouds: proper clouds shadows become trivial when clouds are a cube map. Cube maps also have the advantage of allowing cloud maps that are effectively four times larger per side than normal (and since less of the texture is wasted near the poles, the increase in memory footprint is 12x rather than 16x.) Every graphics card sold in the last 6 years supports cube maps.

- A 2D texture lookup can be used for the rectangular to spherical conversion required for correct cloud shadows with a normal cloud map. Only possible on GeForce 8 series and Radeon HD 2900 hardware, since they're the only cards that support filtering of 32-bit floating point textures.

- A rewrite of the sphere renderer (long overdue anyhow) would let me get cloud shadows working for split textures, albeit only the simplified shadows--the more sophisticated approach I attempted will still be limited by the crude arctan and arcsin approximations used by the shader compiler. If only hardware supported these functions natively like it does other transcendentals such as sin, cos, and exp, cloud shadows would have been working nicely this whole time.

--Chris


Return to “Bugs”