New Release D3D9Client Development

DaveS

Space Shuttle Ultra Project co-developer
Addon Developer
Donator
Beta Tester
Joined
Feb 4, 2008
Messages
8,876
Reaction score
201
Points
153
That looks really good. Now if we could just sort out the atmosphere, things are set.
 

jarmonik

Addon Developer
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,134
Reaction score
108
Points
63
Website
users.kymp.net
Wouldn't cases 1 and 2 take care of case 3 given their 3D nature?


Most definitely not, since, cases 1 & 2 wont require a global cloud coverage at all if the camera doesn't go higher that 30km, some synthetic clouds resembling a current local weather is perfectly good enough and that's what FSX and X-Plane are doing as far as I can tell. There's no "big picture" about a global cloud patterns.

---------- Post added at 06:49 ---------- Previous post was at 05:45 ----------

In the next image, the shadows turn into some ugly artifacts when the sun is directly overhead.




I made some changes, does this work better ?


Code:
float4 CloudTechPS(CloudVS frg) : COLOR
{
    float2 vUVMic = frg.texUV.xy * vMicroOff.zw + vMicroOff.xy;
    float2 vUVTex = frg.texUV.xy;

    // jarmonik: reduce microtex resolution
    vUVMic *= 0.33f;

    float a = (tex2Dlod(NoiseTexS, float4(vUVTex,0,0)).r - 0.5f) * ATMNOISE;

    float4 cTex = tex2D(DiffTexS, vUVTex);
    float4 cMic = tex2D(CloudMicroS, vUVMic);

#if defined(_CLOUDNORMALS)

    if (bCloudNorm) {

#if defined(_CLOUDMICRO)
        float4 cMicNorm = tex2D(CloudMicroNormS, vUVMic);  // Filename "cloud1_norm.dds" (does not exists in distribution)
#endif

                                                           // Filter width
        float d = 2.0 / 512.0;
        float3 nrm = 0;
        float3 nrmMicro = 0;

        float x1 = tex2D(DiffTexS, vUVTex + float2(-d, 0)).a;
        float x2 = tex2D(DiffTexS, vUVTex + float2(+d, 0)).a;
        nrm.x = (x1*x1 - x2*x2);

        float y1 = tex2D(DiffTexS, vUVTex + float2(0, -d)).a;
        float y2 = tex2D(DiffTexS, vUVTex + float2(0, +d)).a;
        nrm.y = (y1*y1 - y2*y2);

        float m = max(abs(nrm.x), abs(nrm.y));

        float dMN = dot(frg.nrmW, vSunDir);    // Planet mean normal sun angle
                                               // Bump magnitude/contrast function
                                               // Increase normals contrast based on sun-earth angle.
        float contrast = (m * (1.0f + (dMN*2.0f)));

#if defined(_CLOUDMICRO)
        // Blend in cloud normals only on thick clouds.
        nrm.xy = (nrm.xy + saturate((cTex.a * 4.0f) - 1.5f) * (cMicNorm.rg - 0.5f));
#endif

        nrm = normalize(nrm) * contrast;

        // jarmonik: sarutate() added as a safety check
        nrm.z = sqrt(1.0f - saturate(nrm.x*nrm.x + nrm.y*nrm.y));

        // Approximate world space normal from local tangent space
        nrm = normalize((vTangent * nrm.x) + (vBiTangent * nrm.y) + (frg.nrmW * nrm.z));

        float dCS = dot(nrm, vSunDir);            // Cloud normal sun angle

                                                  // Brighten the lighting model for clouds, based on sun-earth angle.
                                                  // Low sun angles = greater effect. No modulation leads to washed out normals at high sun angles.
        dCS = saturate((1.0f - dMN) * (dCS * (1.0f - dCS)) + dCS);
        dCS = saturate((1.0f - dMN) * (dCS * (1.0f - dCS)) + dCS);


        // jarmonik: With a high sun angle, don't let the dCS go below 0.65f to avoid unnaturally dark edges.
        dCS = lerp(0.65f*dMN, 1.0f, dCS);
    

        // Effect of normal/sun angle to color
        // Add some brightness (borrowing red channel from sunset attenuation)
        // Adding it to the sun illumination factor, taking care to keep from saturating
        cTex.rgb *= dCS + ((1.0f - dCS) * 0.2f);
    }
#endif

#if defined(_CLOUDMICRO)
    float f = cTex.a;
    float g = lerp(1.0f, cMic.a, frg.fade.y);
    float h = (g + 4.0f)*0.2f;
    cTex.a = saturate(lerp(g, h, f) * f);
#endif

    // Reduce attenuation near terminator (multiply by 3)
    // Change attenuation to be grayscale, not colored (.r not .rgb)
    // Ensure illumination goes as far as possible by borrowing red channel (.r)
    float3 color = cTex.rgb*saturate(frg.atten.r * 3)*fCloudInts + frg.insca.rgb*vHazeMax;

    return float4(saturate(color + a), cTex.a*saturate(fCloudInts*fCloudInts));    
 }
 
Last edited:

DaveS

Space Shuttle Ultra Project co-developer
Addon Developer
Donator
Beta Tester
Joined
Feb 4, 2008
Messages
8,876
Reaction score
201
Points
153
Most definitely not, since, cases 1 & 2 wont require a global cloud coverage at all if the camera doesn't go higher that 30km, some synthetic clouds resembling a current local weather is perfectly good enough and that's what FSX and X-Plane are doing as far as I can tell. There's no "big picture" about a global cloud patterns.
What about FlightGear? It has an orbital element as well as an atmospheric flight element.
 

Felix24

Member
Joined
May 13, 2010
Messages
189
Reaction score
1
Points
18
Many improvements in microtexture code and overall rendering:




Here's the code. I think it's ready, but if anybody tries it and finds something they don't like, let me know.

PHP:
float4 CloudTechPS(CloudVS frg) : COLOR
{
    float2 vUVMic = frg.texUV.xy * vMicroOff.zw + vMicroOff.xy;
    float2 vUVTex = frg.texUV.xy;

    // jarmonik: reduce microtex resolution
    // vUVMic *= 0.5f; // new

    float a = (tex2Dlod(NoiseTexS, float4(vUVTex,0,0)).r - 0.5f) * ATMNOISE;

    float4 cTex = tex2D(DiffTexS, vUVTex);
    float4 cMic = tex2D(CloudMicroS, vUVMic);

#if defined(_CLOUDNORMALS)

    if (bCloudNorm) {

#if defined(_CLOUDMICRO)
        float4 cMicNorm = tex2D(CloudMicroNormS, vUVMic);  // Filename "cloud1_norm.dds" (does not exists in distribution)
#endif

    // Filter width
    float d = 2.0 / 512.0;
    float3 nrm = 0;
    float3 nrmMicro = 0;

    float x1 = tex2D(DiffTexS, vUVTex + float2(-d, 0)).a;
    float x2 = tex2D(DiffTexS, vUVTex + float2(+d, 0)).a;
    nrm.x = (x1*x1 - x2*x2);

    float y1 = tex2D(DiffTexS, vUVTex + float2(0, -d)).a;
    float y2 = tex2D(DiffTexS, vUVTex + float2(0, +d)).a;
    nrm.y = (y1*y1 - y2*y2);

    float dMN = dot(frg.nrmW, vSunDir);    // Planet mean normal sun angle

#if defined(_CLOUDMICRO)
        // Blend in cloud normals only on moderately thick clouds, allowing the highest cloud tops to be smooth.
        nrm.xy = (nrm.xy + saturate((cTex.a * 10.0f) - 3.0f) * saturate(((1.0f - cTex.a) * 10.0f) - 1.0f) * (cMicNorm.rg - 0.5f)); // new
#endif

    // Increase normals contrast based on sun-earth angle.
		nrm.xyz = nrm.xyz * (1.0f + (0.5f * dMN));

    // jarmonik: saturate() added as a safety check
    nrm.z = sqrt(1.0f - saturate(nrm.x*nrm.x + nrm.y*nrm.y));

    // Approximate world space normal from local tangent space
    nrm = normalize((vTangent * nrm.x) + (vBiTangent * nrm.y) + (frg.nrmW * nrm.z));

    float dCS = dot(nrm, vSunDir); // Cloud normal sun angle

    // Brighten the lighting model for clouds, based on sun-earth angle. Twice is better.
    // Low sun angles = greater effect. No modulation leads to washed out normals at high sun angles.
    dCS = saturate((1.0f - dMN) * (dCS * (1.0f - dCS)) + dCS);
    dCS = saturate((1.0f - dMN) * (dCS * (1.0f - dCS)) + dCS);

    // jarmonik: With a high sun angle, don't let the dCS go below 0.65f to avoid unnaturally dark edges.
    dCS = lerp(0.2f*dMN, 1.0f, dCS);

    // Effect of normal/sun angle to color
    // Add some brightness (borrowing red channel from sunset attenuation)
    // Adding it to the sun illumination factor, taking care to keep from saturating
    cTex.rgb *= dCS + ((1.0f - dCS) * 0.2f);
  }
#endif

#if defined(_CLOUDMICRO)
    float f = cTex.a;
    float g = lerp(1.0f, cMic.a, frg.fade.y);
    float h = (g + 4.0f)*0.2f;
    cTex.a = saturate(lerp(g, h, f) * f);
#endif

    // Reduce attenuation near terminator (multiply by 3)
    // Change attenuation to be grayscale, not colored (.r not .rgb)
    // Ensure illumination goes as far as possible by borrowing red channel (.r)
    float3 color = cTex.rgb*saturate(frg.atten.r * 3)*fCloudInts;
		// Blend haze without saturating
		color = lerp(color, 1.0f, frg.insca.rgb*vHazeMax);

    return float4(saturate(color + a), cTex.a*saturate(fCloudInts*fCloudInts));
}

And here's an updated pair of microtexture files.
 

Attachments

  • 2020-08-09 cloud microtextures.zip
    2.8 MB · Views: 7

DaveS

Space Shuttle Ultra Project co-developer
Addon Developer
Donator
Beta Tester
Joined
Feb 4, 2008
Messages
8,876
Reaction score
201
Points
153
No complaints here! Looks great from orbit and I'm with that. Here's my latest on Earth atmosphere settings:

Earth.atms.cfg:
Code:
Red = 0.6397
Green = 0.55
Blue = 0.4
RWaveDep = 8
MWaveDep = 2.304
ScaleHeight = 8.11965
DepthClamp = 0.99875
Exposure = 1.1045
TGamma = 1.0128
OutScatter = 0.596748
InScatter = 1.1495
RayleighPhase = 0
MiePower = 0.13005
MiePhase = 0.967558
Aux1 = 0.2073
Aux2 = 1
Aux3 = 0
AGamma = 1.1016
HazeClr = -0.423
HazeIts = 1.6096

Earth.atmo.cfg:
Code:
Red = 0.6397
Green = 0.5692
Blue = 0.5086
RWaveDep = 8
MWaveDep = 0
ScaleHeight = 8.11965
DepthClamp = 1.25
Exposure = 0.9785
TGamma = 0.3
OutScatter = 0.699867
InScatter = 1.1285
RayleighPhase = -0.75
MiePower = 0.133128
MiePhase = 0.8
Aux1 = 0.2286
Aux2 = 0.725904
Aux3 = 0
AGamma = 1.3308
HazeClr = 1.5
HazeIts = 1.6474
 

jarmonik

Addon Developer
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,134
Reaction score
108
Points
63
Website
users.kymp.net
New Builds are out

New builds of the Client are released for Orbiter Beta and 2016.


- Felix24's Implementation of normal mapped clouds is included.
- "Pink"/"Orange" Antarctica should be fixed (at-least reduced)
- Some black lines in the horizon that may have appeared before should be gone.
- Rendering of mesh based objects like "Nix" & "Hydra" should be fixed and vessel shadow should be visible. (but, of course, you can't land there, no physics surface exists).
- Some elevation functions are changed to operate in float basis instead of int16 which should allow rendering of smooth slopes without "staircase" visual effect. But the "staircase" still exists at the physics level as far as I can tell (not confirmed) feedback regarding this issue would be nice.
 

Marg

Active member
Joined
Mar 20, 2008
Messages
399
Reaction score
33
Points
28
Oh yeah, I launched STS flight when a cloud cover was above KSC, oooh, even from 10-15 km altitude, effect is very real, clouds seem like sharp cumulus type of clouds! Huge step (leap!) forwards...
 

DaveS

Space Shuttle Ultra Project co-developer
Addon Developer
Donator
Beta Tester
Joined
Feb 4, 2008
Messages
8,876
Reaction score
201
Points
153
Very nice indeed:
 

Attachments

  • D3D9Client_Beta30_clouds_midwest_US.jpg
    D3D9Client_Beta30_clouds_midwest_US.jpg
    213 KB · Views: 30

Donamy

Addon Developer
Addon Developer
Donator
Beta Tester
Joined
Oct 16, 2007
Messages
6,832
Reaction score
86
Points
123
Location
Cape
Will it be available for non-beta, Or is it not compatible ?
 

kuddel

Donator
Donator
Joined
Apr 1, 2008
Messages
1,579
Reaction score
101
Points
63
The elevation rendering is strange now (In BETA) :(
When you move around with the external camera relatively shallow, all weird things happen (scenario for easy start attached)...
 

Attachments

  • not_ok.scn
    1.3 KB · Views: 2
  • CurrentState.jpg
    CurrentState.jpg
    92.9 KB · Views: 31

kuddel

Donator
Donator
Joined
Apr 1, 2008
Messages
1,579
Reaction score
101
Points
63
...seems to be not an issue in the Orbiter 2016 version though :thumbup:
 

jarmonik

Addon Developer
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,134
Reaction score
108
Points
63
Website
users.kymp.net
The elevation rendering is strange now (In BETA) :(
When you move around with the external camera relatively shallow, all weird things happen (scenario for easy start attached)...


Ok, Thanks. Will look into it. Can't reproduce without high resolution elevation. Downloading now...

---------- Post added at 03:55 ---------- Previous post was at 02:00 ----------

I can see it now. Looks like "cubic" interpolation is broken at least in Beta, so, mean while use "linear" interpolation until the next release is out.
 

DaveS

Space Shuttle Ultra Project co-developer
Addon Developer
Donator
Beta Tester
Joined
Feb 4, 2008
Messages
8,876
Reaction score
201
Points
153
Any idea where to start with getting rid of this weird oily haze around on-orbit sunrises/sunsets? It seems linked to the rayleigh density. It needs to be at the highest setting to get the deep red color seen in this photo series by Bob Behnken during his and Doug Hurley's 62 day stay on the ISS:

[ame]https://twitter.com/AstroBehnken/status/1287741440383242240[/ame]
 

Attachments

  • Oily_haze2.jpg
    Oily_haze2.jpg
    29.6 KB · Views: 23

jarmonik

Addon Developer
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,134
Reaction score
108
Points
63
Website
users.kymp.net
The elevation rendering is strange now (In BETA) :(
When you move around with the external camera relatively shallow, all weird things happen (scenario for easy start attached)...


There is a fix uploaded to trunk. Could you check that the issue is fixed.

---------- Post added at 04:58 ---------- Previous post was at 04:37 ----------

Any idea where to start with getting rid of this weird oily haze around on-orbit sunrises/sunsets? It seems linked to the rayleigh density. It needs to be at the highest setting to get the deep red color seen in this photo series by Bob Behnken during his and Doug Hurley's 62 day stay on the ISS:

The model that we got is simply not accurate enough to give that kind of fine detail as seen in the photo series. Also, the sunset/sunrise conditions at the sea level are broken and there's no point attempting to get a good sunrise because it won't work. The simplified model that we got is pushed to give better orbital and daytime results with the cost of sunset conditions.

The early implementation did give a pretty good sunrise at sea level but the orbital sunrise was also red. It was fixed with an expense of sea level sunrise.

We would need much more accurate model to produce all conditions in finer detail but I don't really have the inspiration to start working on it right now. And there is high number of other things that would need to be done too.

I don't get the "Oily" looking sunrise with default settings. If there is too much color, reduce rayleigh density.
 

80mileshigh

Addon Developer
Addon Developer
Donator
Joined
Feb 18, 2008
Messages
344
Reaction score
175
Points
43
Location
Melbourne
Website
eightymileshigh.wordpress.com
I'm having some issues when landed on outer planet moons, when using R4.6 with Orbiter 2016. On most of the Jovian and Saturnian moons I see bad flickering and jumping of textures.

These scenarios capture the problem for me:

Ganymede:

Code:
BEGIN_DESC
Ganymede surface graphics glitch.
END_DESC

BEGIN_ENVIRONMENT
  System Sol
  Date MJD 52024.8592697715
END_ENVIRONMENT

BEGIN_FOCUS
  Ship GL-01S
END_FOCUS

BEGIN_CAMERA
  TARGET GL-01S
  MODE Extern
  POS 16.337456 -128.901679 -7.734930
  TRACKMODE TargetRelative
  FOV 41.81
END_CAMERA

BEGIN_HUD
  TYPE Surface
END_HUD

BEGIN_MFD Left
  TYPE Surface
  SPDMODE 1
END_MFD

BEGIN_MFD Right
  TYPE Launch
  NAV 0
END_MFD

BEGIN_SHIPS
GL-01S:DG-S
  STATUS Landed Ganymede
  POS 14.0000000 -131.9000000
  HEADING 178.06
  ALT 2.554
  AROT 102.464 46.953 -71.434
  RCSMODE 2
  AFCMODE 7
  PRPLEVEL 0:1.000000 1:1.000000 2:1.000000
  NAVFREQ 434 94 84 114
  XPDR 0
  RCOVER 1.0000 0.0000
  HOVERHOLD 0 1 0.0000e+000 0.0000e+000
  GEAR 1.0000 0.0000
  AAP 0:0 0:0 0:0
  PSNGR 2 3 4
  PANELCOL 4
  TANKCONFIG 1
END
END_SHIPS

Tethys:

Code:
BEGIN_DESC
Tethys surface graphics glitch.
END_DESC

BEGIN_ENVIRONMENT
  System Sol
  Date MJD 52036.3996687836
END_ENVIRONMENT

BEGIN_FOCUS
  Ship GL-01S
END_FOCUS

BEGIN_CAMERA
  TARGET GL-01S
  MODE Extern
  POS 6.399219 -107.636825 -7.465196
  TRACKMODE AbsoluteDirection
  FOV 41.81
END_CAMERA

BEGIN_HUD
  TYPE Surface
END_HUD

BEGIN_MFD Left
  TYPE Surface
  SPDMODE 1
END_MFD

BEGIN_MFD Right
  TYPE Launch
  NAV 0
END_MFD

BEGIN_SHIPS
GL-01S:DG-S
  STATUS Landed Tethys
  POS 14.0000000 -131.9000000
  HEADING 178.06
  ALT 2.568
  AROT 102.433 46.892 -71.456
  RCSMODE 2
  AFCMODE 7
  PRPLEVEL 0:1.000000 1:1.000000 2:1.000000
  NAVFREQ 434 94 84 114
  XPDR 0
  RCOVER 1.0000 0.0000
  HOVERHOLD 0 1 0.0000e+000 0.0000e+000
  GEAR 1.0000 0.0000
  AAP 0:0 0:0 0:0
  PSNGR 2 3 4
  PANELCOL 4
  TANKCONFIG 1
END
END_SHIPS

The moons of Uranus and Neptune appear stable but the DG doesn't cast a shadow.

A couple of Saturn's moons show no problem at all; Mimas, Enceladus.

Hope this is helpful.
 

jarmonik

Addon Developer
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,134
Reaction score
108
Points
63
Website
users.kymp.net
I'm having some issues when landed on outer planet moons, when using R4.6 with Orbiter 2016. On most of the Jovian and Saturnian moons I see bad flickering and jumping of textures.

The moons of Uranus and Neptune appear stable but the DG doesn't cast a shadow.


There is a new build uploaded for Orbiter 2016. Could you check if the texture flickering issue is fixed. There is currently no vessel shadow support for planets/moons using the old tile format. Only the new tile format is fully supported.


Broken clouds of Jupiter/Venus should be fixed.
 

80mileshigh

Addon Developer
Addon Developer
Donator
Joined
Feb 18, 2008
Messages
344
Reaction score
175
Points
43
Location
Melbourne
Website
eightymileshigh.wordpress.com
There is a new build uploaded for Orbiter 2016. Could you check if the texture flickering issue is fixed. There is currently no vessel shadow support for planets/moons using the old tile format. Only the new tile format is fully supported.


Broken clouds of Jupiter/Venus should be fixed.

Yes, fixed - that was fast! :) Thanks.

I do still get the effect, in some places, of the vessel separated from its ground shadow by some small altitude. I gather that's an unavoidable consequence of the way surface elevation is calculated now?
 

jarmonik

Addon Developer
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,134
Reaction score
108
Points
63
Website
users.kymp.net
I do still get the effect, in some places, of the vessel separated from its ground shadow by some small altitude. I gather that's an unavoidable consequence of the way surface elevation is calculated now?


Not really, you can avoid it in most cases by increasing "MaxPatchResolution" from planet/moon config file. "10" should be good enough. It shouldn't have any negative side effects.
 
Top