July 2, 20223 yr Hello, I am thinking about to change the water color in p3dv5 the water in my screenshot looks so weird Anyone know how to change them to normal sea water?
July 2, 20223 yr It certainly looks unusual but for any help you need to provide more information. What is your computer system and what, if any, additional scenery or graphics software are you using. Also, which version of P3D5 are you using and what are your graphics settings? John B
July 2, 20223 yr Can't troubleshoot without some basic information that Biggles asked for. Also, where is this screenshot from. Gigabyte x670 Aorus Elite AX MB; AMD 7800X3D CPU; Deepcool LT520 AIO Cooler; 64 Gb G.Skill Trident Z5 NEO DDR5 6000; Win11 Pro; P3D V5.4; 1 Samsung 990 2Tb NVMe SSD: 1 Crucial 4Tb MX500 SATA SSD; 1 Samsung 860 1Tb SSD; Gigabyte Aorus Extreme 1080ti 11Gb VRAM; Toshiba 43" LED TV @ 4k; Honeycomb Bravo.
July 2, 20223 yr Author 3 hours ago, pgde said: Can't troubleshoot without some basic information that Biggles asked for. Also, where is this screenshot from. 4 hours ago, Biggles2010 said: It certainly looks unusual but for any help you need to provide more information. What is your computer system and what, if any, additional scenery or graphics software are you using. Also, which version of P3D5 are you using and what are your graphics settings? Thanks for reply, i am currently run on a 12900k with 3080 P3dv5.3 is installed this is a clean install with no addon Its a screenshot from VHHH Just check the WC flies, wanna ask if i can replace the inland water with ocean water?
July 2, 20223 yr Have you updated any graphic card drivers recently, I've had 3 mates with issues with drivers in the last week Edited July 2, 20223 yr by fluffyflops
July 2, 20223 yr Author 23 minutes ago, fluffyflops said: Have you updated any graphic card drivers recently, I've had 3 mates with issues with drivers in the last week i tried update the driver, still the same 😞
July 3, 20223 yr 38 minutes ago, tsochun said: i tried update the driver, still the same 😞 What FluffyTop means, is those who have recently updated their NVidia GFX driver will run into problems because there is a known issue with the last couple of NVidia driver releases and as yet the issue has not been resolved by NVidia. https://www.avsim.com/forums/forum/436-the-prepar3d-forum/ Also replacement water textures might help. https://www.togaprojects.com/envtex Water Detailed ocean, inland and tropical water textures with reduced mosaic repetition looking Realistic wave animations I have replacement water textures in my v4.5, Off the NZ South Island East Coast And more tropical textures. Ryzen 5800X clocked to 4.7 Ghz (SMT off), 32 GB ram, Samsung 1 x 1 TB NVMe 970, 2 x 1 TB SSD 850 Pro raided, Asus Tuf 3080Ti P3D 4.5.14, Orbx Global, Vector and more, lotsa planes too. Catch my vids on Oz Sim Pilot, catch my screen pics @ Screenshots and Prepar3D
July 3, 20223 yr I may be wrong, but I think the OP is looking for a solution for the wrong waterclass in that area. Apparently, the lighter colored, tropical-style water near the coast is not correct, but instead should be a darker blue like deep water. You can use SbuilderX or Airport Design Editor to change the waterclass in that area. Dave Simulator: P3Dv6.1 System Specs: Intel i7 13700K CPU, MSI Mag Z790 Tomahawk Motherboard, 32GB DDR5 6000MHz RAM, Nvidia GeForce RTX 4070 Video Card, 3x 1TB Samsung 980 Pro M.2 2280 SSDs, Windows 11 Home OS My website for P3D stuff: https://sites.google.com/view/thep3dfiles/home
July 13, 20223 yr On 7/2/2022 at 8:53 PM, Rogen said: What FluffyTop means, is those who have recently updated their NVidia GFX driver will run into problems because there is a known issue with the last couple of NVidia driver releases and as yet the issue has not been resolved by NVidia. https://www.avsim.com/forums/forum/436-the-prepar3d-forum/ Also replacement water textures might help. https://www.togaprojects.com/envtex Water Detailed ocean, inland and tropical water textures with reduced mosaic repetition looking Realistic wave animations I have replacement water textures in my v4.5, Off the NZ South Island East Coast And more tropical textures. Do you mind sharing your Envtex water settings? Looks great in your screenshots. Also, what clouds are you using? Thanks! Orman
July 14, 20223 yr On 7/13/2022 at 11:17 AM, okupton said: Do you mind sharing your Envtex water settings? Looks great in your screenshots. Also, what clouds are you using? Hey @okupton I don't actually have Envtex. What I do have is "REX 4 Texture Direct with Soft Clouds" and some custom cloud textures. The clouds are a specific look achieived via a custom shader, the thread below has additional info, noting a powerful GFX card is needed. And I've you want to trial the cloud shader itself (for 4.5 HF3) I've included the current updated version in the spoiler, look to the thread for hints on how to use. The shader name is "Cloud.fx", be sure backup your own prior to trialing this one. Cheers https://www.avsim.com/forums/topic/613272-flat-clouds-in-p3d/ Spoiler //--------------------------------------------------------------------------- // Prepar3d - Shader Effect Files // Copyright (c) 2014, Lockheed Martin Corporation //--------------------------------------------------------------------------- //=========================================================================== // TBM have adjusted the following items // static const float SetPSS1 = 0.99 ; // TBM default = 0.75 (Cloud Shadows darkness) 0.99 is max and is good noting values > 0.99 seem to be ignored, TomatoShade value was 1.10. // static const float SetPS90 = 1.42 ; // TBM Default = 1.20*1.35 (calcs to 1.62). This value does have an overall effect on the general cloud brightness - lower value = darker clouds, trialed 1.32 originally. // static const float SetGSS1 = 1.45 ; // TBM default 0.65 (Size of shadow textures, a larger value reduces the shadow size and allows more light shining through) //=========================================================================== #include "ShaderMacros.h" #include "ConstantBuffers.fxh" #include <FuncLibrary.fxh> #include <IRSim.fxh> #include <InstanceIndexing.fxh> #define MAX_COLOR_LEVELS 5 shared Texture2D txBase : REGISTER(t, 0); shared Texture2D txSceneDepth : REGISTER(t,SCENE_DEPTH_TEXTURE_REGISTER); static float FA1 = frac((25+cb_Altitude)/1000) ; static float FA0 = frac((25+cb_Altitude)/100) ; // Variables for test settings. static float fT0 = abs( frac( ( cb_mFog[0].cb_mFogTop + cb_Altitude ) /1000) ) ; static float fB0 = abs( frac( ( cb_mFog[0].cb_mFogBase + cb_Altitude ) /1000) ) ; // static float fT1 = abs( frac( ( cb_mFog[1].cb_mFogTop + cb_Altitude ) /1000) ) ; static float fB1 = abs( frac( ( cb_mFog[1].cb_mFogBase + cb_Altitude ) /1000) ) ; // static float fT2 = abs( frac( ( cb_mFog[2].cb_mFogTop + cb_Altitude ) /1000) ) ; static float fB2 = abs( frac( ( cb_mFog[2].cb_mFogBase + cb_Altitude ) /1000) ) ; // // static float FFz = abs(cb_mViewFacingVector.z) ; static float FF1z = 1-abs(cb_mViewFacingVector.z) ; // // static float FFx = 1-abs(cb_mViewFacingVector.x) ; static float FF1x = 1-abs(cb_mViewFacingVector.x) ; // // (VS) //**************************************************************************************************************************************** // cloud texture size 0.1 ~ 1 static const float SetVS1 = 0.65 ; // 0.75 // The spatial size of the clouds along the X, Y, and Z axes. static const float SetVS2x = 1.3 ; static const float SetVS2y = 0.85 ; static const float SetVS2z = 1.3 ; // // Moving clouds to the horizon at the limit of visibility. static const float SetVS3 = 1 ; // switch - turn off the tweak. 1 - enabled. 0 - disabled // lift height. m // Distance of thrust ~ = visibility range*0.9. m // routine of lowering¤. static const float SetVS3H = 3000 ; static const float SetVS3D = 170000 ; static const float SetVS3S = 0.00008 ; // //=================================================================================================================================================== // (VGB) //=================================================================================================================================================== // Minimum gradient steepness (for clouds of maximum thickness) static const float SetVS10 = 1.5 ; // // maximum steepness of the gradient (for clouds of minimum thickness) static const float SetVS11 = 35 ; // // cloud vertical gradient pattern static const float SetVS12 = 8 ; // // General offset correction of cloud vertical gradient static const float SetVS13 = -0.0 ; // // "General" correction of the steepness of the vertical gradient of clouds static const float SetVS14 = 1.0 ; // // additional enhancement of the detail of the base vertical cloud gradient static const float SetVS15 = 0.22 ; // // "Initial minimum coefficient of ¤solar brightness at low altitudes" clouds ( ~< 1.5 km ) static const float SetVS20 = 0.55 ; // // "Initial minimum coefficient of ¤solar brightness at high altitudes" clouds ( ~> 5.5 km ) static const float SetVS21 = 0.77 ; // // Initial maximum vertex brightness static const float SetVS22 = 1.45 ; // // The initial maximum brightness factor of the vertices at a low position - the sun at the solar opposition static const float SetVS22o = 1.80 ; // // minimum base detail level based on fIntensity static const float SetVS23 = 0.25 ; // // (EG) // The initial minimum brightness coefficient of the shadow areas of the cloud. static const float SetVS30 = 0.00 ; // // minimum base shadow detail level based on fIntensity static const float SetVS31 = 0.35 ; // // ”brightness level of the illuminated areas at the maximum position — the sun at its zenith. static const float SetVS32 = 1.50 ; // // "brightness level of illuminated areas at a very low position - the sun. (side lighting) static const float SetVS33 = 2.00 ; // // "level of brightness of the illuminated areas at a low position - the sun at the solar opposition static const float SetVS33o = 2.30 ; // // Coefficient of additional brightness of the illuminated areas on the direction - the sun at a very low position - the sun. static const float SetVS340 = 0.80 ; static const float SetVS34A = 0.65 ; // at low altitudes // at high altitudes // additional gain level of side lighting at a low position - the sun. static const float SetVS35 = 0.00 ; // // √gamma coefficient of the difference between the illuminated-shadow areas of the ScatterDueToNormal function when the sun is at its zenith. static const float SetVS36 = 1.0 ; // // √gamma coefficient of the difference between the illuminated-shadow areas of the ScatterDueToNormal function at a very low position - the sun. static const float SetVS37 = 1.45 ; // // Additional gamma coefficient of the ScatterDueToNormal function at a very low position - the sun. static const float SetVS38 = 1.3 ; // // Additional (negative) coefficient of fall¤ of the brightness of illuminated areas after sunset - the sun. static const float SetVS39 = -0.30 ; // // "Position" of the center of the tangentoid at which the change in the incidence of the "brightness" of the illuminated areas is 50% static const float SetVS40t = -0.040 ; // TBM Default = -0.040 // Rhythm of the tangent of incidence¤ ¤brightness of the illuminated areas. static const float SetVS41t = 53 ; // // Final Gradient Contrast Settings // "the level of contrast changes" by changing the brightness of the vertices that have the maximum brightness at some fixed level of dark tones // Pre-processing (colorVGB) // contrast depending on the position of the sun // -the sun is at its zenith // —the sun is not very low above the horizon // —the sun is on the horizon (sunset/sunrise) static const float SetVS51a = 1.0 ; static const float SetVS51e = 1.0 ; static const float SetVS51s = 1.0 ; // TBM Default = 1.0 ; 1.0 ; 1.0 // Minimum Convergence Convergence Level. static const float SetVS51M = 0.50 ; // TBM Default = 0.50 // "pre-processing" (ColorE) // contrast depending on the position of the sun // —sun at zenith // —sun not very low above the horizon // —sun on the horizon (sunset/sunrise) static const float SetVS52a = 1.05 ; static const float SetVS52e = 1.15 ; static const float SetVS52s = 1.10 ; // ”Minimum Convergence Convergence Level. static const float SetVS52M = 0.50 ; // Final color processing (BcolorFinal) // contrast depending on the position of the sun at low altitudes ~< 1000 m // —sun at zenith // —sun not very low above the horizon // —sun on the horizon (sunset/sunrise) static const float SetVS53a = 1.0 ; static const float SetVS53e = 1.0 ; static const float SetVS53s = 1.15 ; // contrast depending on the position of the sun at high altitudes ~> 5000 m static const float SetVS80a = 1.0 ; static const float SetVS80e = 1.0 ; static const float SetVS80s = 1.15 ; // Minimum Convergence Convergence Level. static const float SetVS53M = 0.50 ; // the level of shadow detail at the maximum position - the sun at its zenith. static const float SetVS55 = 0.45 ; // 0.35*0 // level of overall shadow detail at very low position - the sun. (side lighting) static const float SetVS56 = 0.65 ; // Enables the function to transition from shadow detail to additional vertical detail at a very low position - the sun. // “additional enhancement level” of the basic vertical cloud gradient detail when the sun is on the horizon. static const float SetVS57 = 0.0 ; // routineness of transition characteristics to additional vertical detailing static const float SetVS58 = 0.9 ; // Correction of brightness (additional coefficient) on the solar opposition at a low position - the sun. static const float SetVS60 = 0.25 ; // correction brightness (correction factor) on the solar opposition at the position of the sun on the horizon. static const float SetVS60s = -0.1 ; // interpolation between standard and alternative cloud illumination calculation model based on puff groups. 0 - alternative¤ model. 1 - standard¤. // —sun at zenith // —sun not very low above the horizon // —sun on the horizon (sunset/sunrise) static const float SetVS61a = 1.00 ; static const float SetVS61e = 0.8 ; static const float SetVS61s = 0.90 ; // in the solar sector at low altitudes ~< 1000 m static const float SetVS62a = 1.00 ; static const float SetVS62e = 0.09 ; static const float SetVS62s = 0.09 ; // in the solar sector at high altitudes ~> 5000 m static const float SetVS63a = 1.00 ; static const float SetVS63e = 0.09 ; static const float SetVS63s = 0.09 ; // The general highlighting factor on the directional is the sun by the RedDueToN function static const float SetVS65 = 0.50 ; // actor of rotation to the observer of illuminated textures (in immediate proximity to the -sun) of the RedDueToN function static const float SetVS66 = 1.0 ; // The effect of additional highlighting of the tops and soles on the sun direction (fcolorGSs). // Overall coefficient of lightness and thickness static const float SetVS71 = 1.55 ; // TBM default 1.55 // Center Brightness Compensation static const float SetVS73 = 0.0 ; // TBM default 0.0 // ћmaximum displacement range¤ of the gradient // under the sun // above the sun (lower backlight) static const float SetVS74 = -0.55 ; static const float SetVS75 = -0.25 ; // TBM default -0.55 ; -0.25 // edge width and contrast actor // at the middle position - the sun // at the low position - the sun static const float SetVS76 = 1.15 ; static const float SetVS77 = 1.20 ; // routine delimitation of the backlight vector static const float SetVS78 = 25 ; // TBM default 25 // final brightness correction (diffuse) static const float SetVS99 = 1.20 ; // TBM default 1.20 //------------------------------------------------------------------------------------------------------------------------------- // Size of shadow textures static const float SetGSS1 = 1.45 ; // TBM default 0.65 // Shadow intensity static const float SetPSS1 = 0.99 ; // TBM default 0.75 (Cloud Shadows darkness) // Haze Toning Adjustment static const float SetFog = 0.90 ; // TBM default 0.90 // (PS) //******************************************************************************************************************************* // Level of texture detail per RGB channel static const float SetPS00 = 0.55 ; // "Pre-adjustment" of "brightness" and "gamma" before the fabric filter // Auxiliary Color Preliminary Gamma (M1) static const float SetPS01 = 0.90 ; // TBM default 1.00 // Secondary Color Pre-Luminance (M1) static const float SetPS02 = 0.65 ; // TBM default 0.75 // Preliminary gamut of the main color (M2) static const float SetPS03 = 0.70 ; // TBM default 0.80 // Color synthesis settings // Initial level (—the sun at its zenith) of the general color interpolation of clouds (coloring) static const float SetPS14 = 0.10 ; // TBM default 0.10 // end base points of color interpolation // components g, b for vertices static const float SetPS15g = 0.57 ; // // initial g-factor static const float SetPS16g = 0.22 ; // // additional g-factor for¤ middle position¤ —sun static const float SetPS15b = 0.08 ; // // initial b-factor // Components g, b for the lower part static const float SetPS17g = 0.55 ; static const float SetPS17b = 0.08 ; // correction GB-component of the color filter to vertices // Initial correction factor static const float SetPS18 = 1 ; // // correction factor at a low position - the sun. static const float SetPS19 = 0.7 ; // // Additional final correction factor after sunset static const float SetPS20 = 1.1 ; // // Remote settings // "General level of reddening" of clouds at long distances static const float SetPS21 = 0.3 ; // // TBM default 0.3 // Overall color index at long distances static const float SetPS22 = 0.2 ; // // maximum color corrective interpolators for long distances static const float SetPS22r = 1.2 ; static const float SetPS22g = 0.6 ; static const float SetPS22b = 0.6 ; // "Saturation of illuminated areas at different heights" of the cloud. // saturation factor at high altitudes of cloud location ( ~> 5.5 km ) static const float SetPS40 = 1 ; // // saturation factor at high cloud heights ( ~> 5.5 km ) at low sun position static const float SetPS41 = 0.75 ; // // Saturation coefficient at low cloud heights ( ~< 1.5 km ) static const float SetPS42 = 1.15 ; // // coefficient of additional saturation of the brightest areas // sun at zenith // —sun not very low above the horizon // —sun on the horizon (sunset/sunrise) static const float SetPS47a = 0.1 ; static const float SetPS47e = 0.2 ; static const float SetPS47s = 0.2 ; // ”saturation level of the final color of the synthesis before the fabric filter // —sun at zenith // —sun not very low above the horizon // —sun on the horizon (sunset/sunrise) static const float SetPS48a = 0.80 ; static const float SetPS48e = 0.65 ; static const float SetPS48s = 0.75 ; // "functions" to remove red halos along the contour of clouds static const float SetPS49 = 0.5 ; //---------------------------------------------------------------------------------------------------------------------------------------------- // Smoothing shadow filter settings // Shadow Filter Total Level Correction Factor static const float SetPS54 = 1.38*0.7 ; // shadow filter level in days // - the sun is at its zenith // - the sun is not very low above the horizon // - the sun is on the horizon (sunset/sunrise) static const float SetPS55a = 1.00 ; static const float SetPS55e = 0.70 ; static const float SetPS55s = 0.55 ; // - early twilight // Late twilight and night static const float SetPS55d = 0.70 ; static const float SetPS55n = 1.00 ; // shadow filter brightness compensation factor in days // —олнце в зените // —олнце не очень низко над горизонтом // —олнце на горизонте ( закат/восход ) static const float SetPS56a = 1 ; static const float SetPS56e = 1 ; static const float SetPS56s = 1 ; // –анние сумерки // ѕоздние сумерки и Ќочь static const float SetPS56d = 1 ; static const float SetPS56n = 1 ; // ÷ветова¤ гамма фильтра. Ѕазовые уровни цветовых компонентов. // расный // «елЄный // —иний static const float SetPS57r = 0.20 ; static const float SetPS57g = 0.28 ; static const float SetPS57b = 0.30 ; // ”ровень цветовой насыщенности фильтра. static const float SetPS58 = 0.30 ; // // ќсновна¤ крутизна фильтра. static const float SetPS59 = 2.50 ; // // Ќастройка смещени¤ порогов фильтра // ѕокомпонентна¤ коррекци¤ смещени¤ порогов фильтра // расный // «елЄный // —иний static const float SetPS61r = 1.90 ; static const float SetPS61g = 1.50 ; static const float SetPS61b = 1.50 ; // ќбща¤ насыщенность облаков до подсинивани¤ static const float SetPS79 = 1.00 ; // // ”ровень общего подсинивани¤ финального цвета static const float SetPS80 = 0.65 ; // // ”ровень подсинивани¤ на ближних дистанци¤х в дол¤х от общего уровн¤ static const float SetPS81 = 0.00 ; // // Ќастройка цвета подсинивани¤.(настройка компонентов rgb умножающими коэффициентами) // красный // зеленый // синий static const float SetPS82r = 0.65 ; static const float SetPS82g = 0.85 ; static const float SetPS82b = 1.00 ; // ”ровень эффекта дополнительного подсвечивани¤ контуров текстур.(„резмерный эффект делает более выраженую гранул¤цию по силуэту облака) static const float SetPS10 = 0.00 ; // ƒанный эффект расчитан на применение со специальными текстурами, в случае с обычными текстурами эффект должен = 0. // некомпенсированна¤ настройка предварительной ¤ркости под теневой фильтр // —олнце в зените // —олнце не очень низко над горизонтом // —олнце на горизонте ( закат/восход ) static const float SetPS04a = 1.00 ; static const float SetPS04e = 0.50 ; static const float SetPS04s = 0.40 ; // –анние сумерки // ѕоздние сумерки и Ќочь static const float SetPS04d = 0.35 ; static const float SetPS04n = 0.40*1.5 ; // ќбща¤ настройка предварительной ¤ркости под теневой фильтр static const float SetPS05 = 0.65 ; // 0.65 // Setting the brightness drop compensation for the output of the shadow and color filter for general stabilization of the brightness at the output // normalization of the compensating coefficient of brightness static const float SetPS06 = 0.35 ; // // brightness drop compensation level at the filter output // =0 - brightness compensation is completely absent. =1 - full¤ compensation¤. static const float SetPS07 = 0.0 ; // // steepness of change¤ of brightness compensation at the filter output static const float SetPS08 = 0.5 ; // // lower threshold for limiting compensation for brightness at the filter output static const float SetPS09 = 0.1 ; // // Gamma correction in the solar sector at sunset and after sunset (additional factor) static const float SetPS85 = 0.3 ; // correction¤ ¤brightness in the solar sector at sunset and after sunset (additional factor) static const float SetPS86 = 0.00 ; // // total daytime ¤output cloud brightness static const float SetPS90 = 1.42 ; // TBM Default = 1.20*1.35 (calcs to 1.62) This value does have an overall effect on the general cloud brightness // General night cloud brightness at output static const float SetPS91 = 0.025 ; // // Correction of the brightness of the clouds at the output in days // —sun at zenith // —sun not very low above the horizon // —sun on the horizon (sunset/sunrise) static const float SetPS93a = 0.80 ; static const float SetPS93e = 1.10 ; static const float SetPS93s = 1.37 ; // –early twilight // Late twilight and night static const float SetPS93d = 1.50 ; static const float SetPS93n = 0.70 ; // “General” cloud saturation at the output static const float SetPS94 = 0.99 ; // TBM Default = 0.99 // Alpha channel settings // Transparency of clouds at short distances static const float SetPS97 = 1.00 ; // // Cloud Transparency at Long Distances (Junty Popcorn) static const float SetPS98 = 0.55 ; // // anti-aliasing routine¤ alpha channel static const float SetPS99 = 1.70 ; // // –Reserve ================================================================================================================= // —displacement of darkening height¤ of the base and lower part of the clouds m static const float SetC11 = 200 ; // TBM Default = 200 // Minimum brightness of the outsole and clipping strength of the minimum brightness of the lower parts. static const float SetC12 = 0.480 ; // TBM Default = 0.480 //*************************************************************************************************************************************** //*************************************************************************************************************************************** static const float Sundy = cb_mSun.mDirection.y ; // static const float Sundx = cb_mSun.mDirection.x ; // static const float Sundz = cb_mSun.mDirection.z ; // static const float Moondy = cb_mMoon.mDirection.y ; // static const float Moondx = cb_mMoon.mDirection.x ; // static const float Moondz = cb_mMoon.mDirection.z ; // static const float ALtit1 = cb_Altitude/10000 ; float FAcorrP( float xAltHmax, float Sc ) { return saturate(1-step(0, -(ALtit1-xAltHmax))*pow(abs((ALtit1-xAltHmax)/xAltHmax), Sc)) ; } float FAexpP( float xWa, float Sc ) { return 1-exp(-pow(abs( xWa *ALtit1 ), Sc )) ; } static const float HAoffset = step( 0, ALtit1)*(0.051*exp(log(abs(ALtit1))/1.77)-0.0022*exp(log(abs(ALtit1))/1.1)) ; static const float VisSunOn = saturate((Sundy+HAoffset+0.04 )*15 ) ; static const float fAcorr22 = FAcorrP( 2.0, 2.0 ); static const float fAcorr_22 = 1-fAcorr22 ; static const float fAcorr23 = FAcorrP( 2.0, 3.0 ); static const float fAcorr_23 = 1-fAcorr23 ; static const float fAcorr24 = FAcorrP( 2.0, 4.0 ); static const float fAcorr_24 = 1-fAcorr24 ; static const float fAcorr26 = FAcorrP( 2.0, 6.0 ); static const float fAcorr_26 = 1-fAcorr26 ; static const float fAcorr28 = FAcorrP( 2.0, 8.0 ); static const float fAcorr_28 = 1-fAcorr28 ; static const float fAexp23 = FAexpP( 2, 3 ) ; static const float fAexp24 = FAexpP( 2, 4 ) ; static const float fAexp33 = FAexpP( 3, 3 ) ; static const float fAexp34 = FAexpP( 3, 4 ) ; static const float fAexp43 = FAexpP( 4, 3 ) ; static const float fAexp44 = FAexpP( 4, 4 ) ; static const float fAexp53 = FAexpP( 5, 3 ) ; static const float fAexp84 = FAexpP( 8, 4 ) ; static const float fAexp83 = FAexpP( 8, 3 ) ; static const float FACorE1 = fAexp53*fAexp53 ; static const float FACorR4 = saturate( tanh(2.8*ALtit1) ) ; static const float FACorR_4 = 1-FACorR4 ; // static const float FACorR1 = saturate(1-exp(-3.0*ALtit1)) ; static const float FACorR_1 = 1-FACorR1 ; // static const float ProcessDE0 = saturate(0.5+0.5*tanh(5*(Sundy-0.50 ))) ; static const float Process_DE0 = 1-ProcessDE0 ; static const float ProcessDE1 = saturate(0.5+0.5*tanh(7*(Sundy-0.50 ))) ; static const float Process_DE1 = 1-ProcessDE1 ; static const float ProcessDE2 = saturate(0.5+0.5*tanh(8*(Sundy-0.33 ))) ; static const float Process_DE2 = 1-ProcessDE2 ; static const float ProcessDE5 = saturate(0.5+0.5*tanh(35*(Sundy-0.15 ))) ; static const float Process_DE5 = 1-ProcessDE5 ; static const float ProcessD_E5 = saturate((0.5+0.5*tanh(-12*(Sundy-0.65 )))*1.03) ; static const float Process_D_E5 = 1-ProcessD_E5 ; static const float ProcessDT1 = saturate( tanh(11*Sundy )) ; static const float ProcessDT_1 = 1-ProcessDT1 ; static const float ProcessSF1 = ProcessDE5*ProcessD_E5 ; static const float ProcessSn1 = saturate(1- (1- pow(abs( (Sundy- 1 )/(1-0.35)), 2 ))*(1-exp(-pow(abs( 5.5 *(Sundy-0.35)), 2)))) ; static const float ProcessDES = saturate(1.021*(0.5+0.5*tanh( 35*( Sundy - 0.06 )))-0.02) ; static const float Process_DES = 1-ProcessDES ; static const float PReProcessE = saturate(1.025*(0.5+0.5*tanh(20*(Sundy-0.11 )))-0.02) ; // static const float PReProcess_E = 1-PReProcessE ; static const float PReProcessE2 = saturate( 1.01* ( 1-exp(-pow(abs( 8 *Sundy ), 2.5 )) )*tanh( 4*Sundy)) ; static const float PReProcess_E2 = 1-PReProcessE2 ;// static const float PReProcessEDES = lerp(ProcessDE2, ProcessDES, SetVS58 ) ; static const float PReProcess_EDES = 1-PReProcessEDES ; static const float PReProcessEE = saturate(tanh( 11 * Sundy)*((0.5+0.5*tanh( -7 *(Sundy- 0.50 )))*1.05-0.02) ) ; static const float PReProcessES1 = saturate(1-pow(abs((Sundy-0.1)/0.1), 3)*step(0, -(Sundy-0.1)) ) ; static const float PReProcessEt = saturate(1.025*(0.5+0.5*tanh(20*(Sundy-0.11 )))-0.02) ; static const float PReProcess_Et = 1-PReProcessEt ; static const float PReProcessEGt = saturate( 1.003*(1-exp(-pow(abs( 18 *(Sundy+0.03)), 3 )))*exp(-pow(abs( (5-2)*(Sundy+0.03)), 3 )))*step(0, (Sundy+0.03)) ; static const float PReProcessEG = saturate( 1.003*(1-exp(-pow(abs( 18 *(Sundy+0.03)), 3 )))*exp(-pow(abs( (5-2)*(Sundy+0.03)), 3 )))*step(0, (Sundy+0.03)) ; static const float PReProcessEG1 = saturate(tanh( 11 * Sundy)* exp(-pow(abs( 8 *(Sundy - 0.35)), 2.5 ))) ; static const float Sxoffs1 = 0.10 ; static const float SfDy = Sundy-Sxoffs1 ; static const float ScEs = 4 ; static const float ScWea = 2.3 ; static const float PReProcessEG2 = step(0, -SfDy)*saturate(1-pow(abs(SfDy/Sxoffs1), ScEs)) + step(0, SfDy)* exp(-pow(abs(ScWea *SfDy), 3 )) ; static const float POstProcessD0 = saturate(0.5+0.5*tanh(28*(Sundy+0.08 ))) ; static const float POstProcess_D0 = 1-POstProcessD0 ; static const float POstProcessD1 = saturate(1.0* (0.5+0.5*tanh(35*(Sundy+0.085)))) ; static const float POstProcess_D1 = 1-POstProcessD1 ; static const float POstProcessB0 = saturate(0.5+0.5*tanh(35*(Sundy+0.095 ))) ; static const float POstProcess_B0 = 1-POstProcessB0 ; static const float POstProcessB1 = saturate(0.5+0.5*tanh(33*(Sundy+0.15 ))) ; static const float POstProcess_B1 = 1-POstProcessB1 ; static const float POstProcessS1 = saturate(1*(0.5+0.5*tanh(50*(Sundy+0.050)))) ; static const float POstProcess_S1 = 1-POstProcessS1 ; static const float POstProcessS2 = saturate(0.5+0.5*tanh(55*(Sundy-0.05 ))) ; static const float POstProcess_S2 = 1-POstProcessS2 ; static const float POstProcessS3 = saturate(0.5+0.5*tanh(53*(Sundy-SetVS40t ))) ; static const float POstProcess_S3 = 1-POstProcessS3 ; float FProcessF(in float xDA, in float xEG, in float xSU ) { return lerp(lerp( xSU, xDA, PReProcessE ), xEG, PReProcessEG) ; } static const float aSetC9H = lerp(SetVS3H, 0, FACorE1 ) ; static const float cSetVS61 = lerp(FProcessF( SetVS61a, SetVS61e, SetVS61s ), 1, POstProcess_S3 ) ; static const float cSetVS620 = lerp(FProcessF( SetVS62a, SetVS62e, SetVS62s ), 1, POstProcess_S3 ) ; static const float cSetVS63A = lerp(FProcessF( SetVS63a, SetVS63e, SetVS63s ), 1, POstProcess_S3 ) ; static const float cSetVS62 = lerp(cSetVS620, cSetVS63A, fAcorr28 ) ; static const float cSetPS55 = lerp(lerp(FProcessF( SetPS55a, SetPS55e, SetPS55s ), SetPS55d, POstProcess_S1), SetPS55n, POstProcess_B1) ; static const float cSetPS56 = lerp(lerp(FProcessF( SetPS56a, SetPS56e, SetPS56s ), SetPS56d, POstProcess_S1), SetPS56n, POstProcess_B1) ; static const float cSetPS04 = lerp(lerp(FProcessF( SetPS04a, SetPS04e, SetPS04s ), SetPS04d, POstProcess_S1), SetPS04n, POstProcess_B1) ; static const float cSetPS93 = lerp(lerp(FProcessF( SetPS93a, SetPS93e, SetPS93s ), SetPS93d, POstProcess_S1), SetPS93n, POstProcess_B1) ; float RIntGc( float fIntGB ) { const float Sud = 4 ; // const float IntSud = 0.0 ; // const float IntLc = 0.5 ; // const float IntTn0 = 3 ; // float UpScf = saturate(1-pow(abs(fIntGB-1), Sud) ) ; float DwScf = saturate( pow(abs(fIntGB), 1/Sud) ) ; return fIntGB - IntLc*(saturate(tanh(IntTn0*fIntGB)) *(lerp(UpScf, DwScf, IntSud)-fIntGB)) ; } //perObject shared cbuffer cbPerObjectCloudData : REGISTER(b,PER_MATERIAL_CB_REGISTER) { float fAlpha : packoffset(c0.x); float fAlphaEdges : packoffset(c0.y); float fRadius : packoffset(c0.z); float fCloudExpandScale : packoffset(c0.w); float fCloudExpandDistance : packoffset(c1.x); float fCloudFadeDistanceInverse : packoffset(c1.y); float fCloudFadeDistance : packoffset(c1.z); float ColorLevelHeightLow : packoffset(c1.w); float ColorLevelHeightMediumLow : packoffset(c2.x); float ColorLevelHeightMedium : packoffset(c2.y); float ColorLevelHeightMediumHigh : packoffset(c2.z); float ColorLevelHeightHigh : packoffset(c2.w); float fCloudEndFadeDistance : packoffset(c3.x); float fCloudExpandSizeScale : packoffset(c3.y); float fFiller0 : packoffset(c3.z); float fFiller1 : packoffset(c3.w); float4 ColorLevelColors[MAX_COLOR_LEVELS] : packoffset(c4); }; struct VS_OUTPUT { float4x4 position : POSITION; float4x4 diffuse : COLORS; float4 uv : TEXCOORD; float fFogDistance : FOG; float4 mAlt : ALTITUDE; }; struct GS_OUTPUT { float4 position : SV_POSITION; float2 uv : TEXCOORD; float2 localUV : TEXCOORD2; #if defined(SHD_VIEW_SHADOW) float z : SHADOWZ; #else float mAlt : ALTITUDE; float4 diffuse : COLOR; float fFogDistance : FOG; #endif #if defined(SHD_GS_INSTANCING) uint RTIndex : SV_RenderTargetArrayIndex; #endif }; struct PS_INPUT { float4 position : SV_POSITION; float2 uv : TEXCOORD; float2 localUV : TEXCOORD2; float mAlt : ALTITUDE; float4 diffuse : COLOR; float fFogDistance : FOG; }; void GetScreenQuadPositions( out float4x3 output, in float width, in float height ) { float halfWidth = width; float halfHeight = height; /// VALUE // Quadrant output[0].x = -halfWidth; //-1 output[0].y = -halfHeight; //-1 output[0].z = 0; output[1].x = halfWidth; // 1 output[1].y = -halfHeight; //-1 output[1].z = 0; output[2].x = -halfWidth; // -1 output[2].y = halfHeight; // 1 output[2].z = 0; output[3].x = halfWidth; // 1 output[3].y = halfHeight; // 1 output[3].z = 0; } float ComputeScatterFactor(float3 vNormal, float3 cameraDir, float3 lightDirection, float fViewDependency) { //vNormal = -vNormal; // how much is the camera looking into the light source? float fBackContribution = (dot(-cameraDir, lightDirection) + 1.0) * 0.5; // compute the result to get the right falloff fBackContribution *= fBackContribution; fBackContribution *= fBackContribution; // use the reverse normal to compute scatter float fScatterDueToNormal = (dot(-lightDirection, -vNormal) + 1.0) * 0.5; // choose between scatter and back contribution based on artist-controlled parameter float fScatterFactor = lerp(fScatterDueToNormal, fBackContribution, fViewDependency); // back it off based on how much cloud is in the way float fReductionDueToNormal = (dot(-cameraDir, vNormal) + 1.0) * 0.5; fScatterFactor *= fReductionDueToNormal; return fScatterFactor; } void ComputeFarAndNearFade(in out float4 position, in out float4 diffuse) { // Calculate fade distance and alpha float fFadeDistance = position.w; fFadeDistance = min(fFadeDistance, fCloudFadeDistance); fFadeDistance -= fCloudEndFadeDistance; float fOneOverRange = rcp(fCloudFadeDistance - fCloudEndFadeDistance); float fAlphaFade = fFadeDistance * fOneOverRange; /// Apply fading at the far clip. This prevents clouds popping in/out at the far clip #if defined(SHD_FADE_AT_FAR_CLIP) fAlphaFade = FarClipAlphaFade(position.w, fAlphaFade); #endif /// Apply a distance fade relative to the camera diffuse.w *= fAlphaFade; bool bOverrideZ = (position.w < cb_NearClip); bOverrideZ = bOverrideZ && (position.w > fCloudEndFadeDistance); position.z *= !bOverrideZ; float fUseNear = cb_NearClip * bOverrideZ; position.w = position.w * !bOverrideZ + fUseNear; } void GetPointDiffuse( out float4 diffuse, in float3 corner, in float3 fvNormal, in float3 fvPosition, in float cloudDistance, in float3 facingDir, in float3 nPosition1, in float3 nPosition2, in float3 nPosition3, in float3 VecEx , in matrix matWorld2 ) { // float3 nPosition1 = normalize(Position1) ; float3 nPosition2 = normalize(Position2) ; float3 nPosition3 = normalize(Position3) ; const float fExp32 = saturate(exp( SetVS3S* (cloudDistance - SetVS3D*0.9 ))); const float MdistFac = 0.5*1.5*cloudDistance/200000 ; const float fExp_P = saturate(1-exp(-pow(abs(0.7*1.8*( MdistFac-1)), 5)))*step(0, -( MdistFac-1)) ; // saturate(1-pow(abs(MdistFac), 1 ) ) const float fExpP = 1-fExp_P ; float4 RotAzProj = mul( float4(VecEx,1.0), matWorld2 ) ; // float3 AngPosVec = normalize( RotAzProj.xyz ) ; // float3 AngWSAVec = normalize( float3(RotAzProj.x, RotAzProj.y+ cb_Altitude, RotAzProj.z )) ; // const float fAngY1 = saturate(pow(abs(AngPosVec.y), 0.5 ) ) ; const float fAng_Y1 = 1 - fAngY1 ; const float P_i = 3.1415926536 ; const float PiU2 = 6.2831853072 ; const float Pi_2 = 1.5707963268 ; float AzRDx = (step(0, AngPosVec.z)*step(0, AngPosVec.x)* 0.25* atan(abs(( AngPosVec.x )/( AngPosVec.z )) )/Pi_2 + step(0, -AngPosVec.z)*step(0, AngPosVec.x)*( 0.25*atan(abs(( AngPosVec.z )/( AngPosVec.x )) )/Pi_2+0.25 ) + step(0, -AngPosVec.z)*step(0, -AngPosVec.x)*( 0.25*atan(abs(( AngPosVec.x )/( AngPosVec.z )) )/Pi_2+0.5 ) + step(0, AngPosVec.z)*step(0, -AngPosVec.x)*( 0.25*atan(abs(( AngPosVec.z )/( AngPosVec.x )) )/Pi_2+0.75 )) ; // float SundirX = (round(Sundx*100000)+0.1)/100000 ; float MoondirX = (round(Moondx*100000)+0.1)/100000 ; float AangleSUN = 1-(step(0, Sundz)*step(0, -Sundx) +0.5*step(0, Sundx) +atan(Sundz/SundirX )/PiU2)-0.25 ; float AangleMoon = 1-(step(0, Moondz)*step(0, -Moondx) +0.5*step(0, Moondx) +atan(Moondz/MoondirX )/PiU2)-0.25 ; float AngleSC = (AangleSUN+0.5)*2*P_i ; float ASsin = sin(AngleSC) ; float AScos = cos(AngleSC) ; const float asun = AzRDx - AangleSUN ; const float amoon = AzRDx - AangleMoon ; // const float asun1 = asun+1 ; const float asun_1 = asun-1 ; const float asunO1 = asun+0.5 ; const float asun_O1 = asun-0.5 ; const float angsunY = AngPosVec.y - cb_mSun.mDirection.y ; float TempSUNYZ = 1-exp(-pow(abs( 2.5*(AngPosVec.y -1)), 2.5 )) ; float TempSUNY1 = exp(-pow(abs( 3.5*angsunY), 2 )) ; float TempSUNYm = exp(-pow(abs( 11*angsunY), 1.5 )) ; float TempSUNR1 = (1-(1-exp(-pow(abs( 11*asun), 3)) )*(1-exp(-pow(abs( 11*asun1), 3)) )*(1-exp(-pow(abs( 11*asun_1), 3) ) )) ; float TempSUNR2 = (1-(1-exp(-pow(abs( 8*asun), 3)) )*(1-exp(-pow(abs( 8*asun1), 3)) )*(1-exp(-pow(abs( 8*asun_1), 3) ) )) ; float TempSUNR3 = (1-(1-exp(-pow(abs( 3*asun), 3)) )*(1-exp(-pow(abs( 3*asun1), 3)) )*(1-exp(-pow(abs( 3*asun_1), 3) ) )) ; float TempSUNR4 = (1-(1-exp(-pow(abs( 5*asun), 4)) )*(1-exp(-pow(abs( 5*asun1), 4)) )*(1-exp(-pow(abs( 5*asun_1), 4) ) )) ; float TempSUNRm = (1-(1-exp(-pow(abs( 17*asun), 1.7)) )*(1-exp(-pow(abs( 17*asun1), 1.7)) )*(1-exp(-pow(abs( 17*asun_1), 1.7) ) )) ; float TempSUNR_O1 = (1-exp(-pow(abs( 3*asunO1), 3)) )*(1-exp(-pow(abs( 3*asun_O1), 3)) ) ; float TempSUNRO1 = 1-saturate(TempSUNR_O1) ; float TempSUNR_O2 = (1-exp(-pow(abs( 7*asunO1), 2)) )*(1-exp(-pow(abs( 7*asun_O1), 2)) ) ; float TempSUNRO2 = 1-saturate(TempSUNR_O2) ; float TempFullS1 = TempSUNY1*TempSUNR1 ; // float TempFullSm = TempSUNYm*TempSUNRm ; // float TempAngHY1 = saturate( exp(-11*AngWSAVec.y)) ; float Roxz1 = nPosition1.x*ASsin + nPosition1.z*AScos ; // float Roxz2 = nPosition2.x*ASsin + nPosition2.z*AScos ; // float Roxz3 = nPosition3.x*ASsin + nPosition3.z*AScos ; // float kSoff1 = lerp( 0.4, 0.2, fAcorr28 ) ; float kSoff2 = lerp( 0.45, 0.25, fAcorr28 ) ; float fSoffset = kSoff1-kSoff2*TempSUNRO1 -0.25*TempSUNR3*(1-exp(-5*abs(AngPosVec.y-saturate(Sundy)))) ; // float TempXZ1 = saturate(0.5+0.5*tanh( -5* (Roxz1 + fSoffset ))) ; // saturate( saturate(1- nPosition1.y)-fA0 ) * float TempXZ2 = saturate(0.5+0.5*tanh(2* (Roxz2 + 1 ))) ; // saturate(pow(abs(0.5+0.5*Roxz2), 2 )) float HAcompY = RotAzProj.y+ cb_Altitude +3100*pow(abs(cloudDistance/200000), 2 ) +1.1*aSetC9H*SetVS3*fExp32 ; float hCAltitudeY1 = HAcompY/10000 ; float fIntAltCorr1 = (1-exp(-pow(abs( 4 * hCAltitudeY1), 3.5)))*saturate(tanh( 2.2 *hCAltitudeY1)) ; float3 groupCenter = lerp( fvNormal, fvPosition, lerp(cSetVS61, cSetVS62, 0.2*TempSUNR2 ) ) ; //----------------------------------------------------------------------------------------------------------------------------------------------- // Sun lighting // See bglfp.cpp, g2d_LightCloudFromNormal() - KEEP SHADER IN SYNC! float3 ActiveLightDirectionSM = lerp(cb_mSun.mDirection, cb_mMoon.mDirection, POstProcess_B1) ; float3 cloudGroupNormal = normalize( corner.xyz - groupCenter + float3(0, fExp32*0.9*aSetC9H, 0) ); float3 facingDirection = cross( cloudGroupNormal, float3( 0, 1, 0 ) ); float3 lightDirection = float3(ActiveLightDirectionSM.x, saturate(ActiveLightDirectionSM.y), ActiveLightDirectionSM.z) ; float fIntensity = -1.0f * max(dot(lightDirection, cloudGroupNormal), dot(lightDirection, facingDirection)); if (fIntensity < -cb_mMedianLine) { // The "1.0001" in the line above is a hack to fix a bug // observed on some hardware. Even though the else branch // of this if/else was taken a divide by zero in this // branch (when cb_mMedianLine is 1.0) caused the whole // shader to go crazy. fIntensity = cb_mMinIntensity + ((cb_mMedianIntensity - cb_mMinIntensity) * ((1 + fIntensity) / (1.0001 - cb_mMedianLine))); } else { fIntensity = cb_mMedianIntensity +(1 - cb_mMedianIntensity) *(fIntensity + cb_mMedianLine) / (1 + cb_mMedianLine); } // Height band lighting/coloring // See SwarmCloud.cpp, GetColor() - KEEP SHADER IN SYNC! float height = corner.y ; // float4 baseColor; float4 topColor; float baseHeight; float topHeight; float height2 = height ; // - fofss2 + ShDizx*100 + 1.2*aSetC9H*SetVS3*fExp32 if (height2 <= ColorLevelHeightLow) { baseColor = ColorLevelColors[0]; topColor = ColorLevelColors[0]; baseHeight = ColorLevelHeightLow; topHeight = ColorLevelHeightLow + 1 ; } // +1 to avoid division by zero below else if (height2 <= ColorLevelHeightMediumLow) { baseColor = ColorLevelColors[0]; topColor = ColorLevelColors[1]; baseHeight = ColorLevelHeightLow; topHeight = ColorLevelHeightMediumLow; } else if (height2 <= ColorLevelHeightMedium) { baseColor = ColorLevelColors[1]; topColor = ColorLevelColors[2]; baseHeight = ColorLevelHeightMediumLow; topHeight = ColorLevelHeightMedium; } else if (height2 <= ColorLevelHeightMediumHigh) { baseColor = ColorLevelColors[2]; topColor = ColorLevelColors[3]; baseHeight = ColorLevelHeightMedium; topHeight = ColorLevelHeightMediumHigh; } else if (height2 <= ColorLevelHeightHigh) { baseColor = 1.0*ColorLevelColors[3]; topColor = ColorLevelColors[4]; baseHeight = ColorLevelHeightMediumHigh; topHeight = ColorLevelHeightHigh; } else { baseColor = ColorLevelColors[4]; topColor = ColorLevelColors[4]; baseHeight = ColorLevelHeightHigh; topHeight = ColorLevelHeightHigh + 1 ; } // +1 to avoid division by zero below float heightE = nPosition2.y ; // float baseHeightE; float topHeightE; if (heightE <= ColorLevelHeightLow) { baseHeightE = ColorLevelHeightLow ; topHeightE = ColorLevelHeightLow + 100 ; } // +1 to avoid division by zero below else if (heightE <= ColorLevelHeightMediumLow) { baseHeightE = ColorLevelHeightLow ; topHeightE = ColorLevelHeightMediumLow; } else if (heightE <= ColorLevelHeightMedium) { baseHeightE = ColorLevelHeightMediumLow ; topHeightE = ColorLevelHeightMedium; } else if (heightE <= ColorLevelHeightMediumHigh) { baseHeightE = ColorLevelHeightMedium ; topHeightE = ColorLevelHeightMediumHigh; } else if (heightE <= ColorLevelHeightHigh) { baseHeightE = ColorLevelHeightMediumHigh ; topHeightE = ColorLevelHeightHigh; } else { baseHeightE = ColorLevelHeightHigh; topHeightE = ColorLevelHeightHigh + 1000 ; } // +1 to avoid division by zero below float VthicknessE = (topHeightE - baseHeightE ) ; float Vthickness = (topHeight - baseHeight ) ; float ofsBasTop = 0.5 ; // float st = saturate( (height2 - baseHeight) / Vthickness - ofsBasTop ) ; float s = saturate( (height2 - baseHeight) / Vthickness) ; float colorA = lerp( baseColor.a, topColor.a, s ); // 1.002* //--------------------------------------------------------------------------------------------------------------------------------------------- const float fCcolorBase = 1*lerp(1, 1, fAngY1 ) ; const float fCcolorTop = 4 ; // const float fcolorC = 1.8 ; baseColor.rgb = fCcolorBase*pow(abs(baseColor.rgb), 1.0 ) ; // *float3(1, 1, 1 ) topColor.rgb = fCcolorTop *pow(abs( topColor.rgb), 1.0 ) ; // *float3(1, 1, 1 ) float colorB = lerp( baseColor.r, topColor.r, pow(abs(st), 2 ) ); // colorB = pow(abs(colorB), 2 ) ; // float TrA = step(0, 0.1*baseHeight+1000*0.28) ; // расчет ограничени¤ потемнени¤ подошвы, и текстур ниже подошвы (дополнительно по альфа-каналу : colorA = colorA*TrA ; ) colorB = fcolorC*clamp(colorB , SetC12, 5) ; // ограничение потемнени¤ подошвы, и текстур ниже подошвы //---------------------------------------------------------------------------------------------------------------------------------------- // Fade in/out alpha float distance_from_center = length(corner); float alpha = 1.0f; if (fAlpha > 0) { // Fading in from or out to the edges float fMagnitude = 1.3f * fRadius - distance_from_center; fMagnitude = max(0, fMagnitude); alpha = fAlpha - fAlphaEdges * (fMagnitude / fRadius); } else { // Fading out to the core alpha = -fAlpha - fAlphaEdges * (distance_from_center / fRadius); } const float fExp = saturate(exp(-cloudDistance * cloudDistance * 0.00000000077)); float tempHYc = 1-saturate(exp(-44* abs( AngWSAVec.y ))) ; // AngPosVec.y float AngRCs = SetVS66*TempFullSm ; float3 facingDirE = float3(facingDir.z, facingDir.y, facingDir.x ) ; float RedDueToNs = saturate((dot(-facingDir, cloudGroupNormal) + 1) * 0.5 -0.1) ; float RedDueToNr = lerp( RedDueToNs, saturate((dot(-facingDirE, cloudGroupNormal) + 1) * 0.5 -0.2), AngRCs ) ; float RedDueToNp = lerp( RedDueToNs, saturate((dot( facingDirE, cloudGroupNormal) + 1) * 0.5 -0.2), AngRCs ) ; float RedDueToN = RedDueToNr*step(0, -facingDir.z ) + RedDueToNp*step(0, facingDir.z ) ; RedDueToN = pow(abs(RedDueToN), 2 ) ; RedDueToNs = pow(abs(RedDueToNs), 3 ) ; RedDueToN = SetVS65*( 0.8* RedDueToN*TempFullSm + 0.2* RedDueToNs*TempFullS1 )*lerp(1, saturate(nPosition2.y), 0.2 ) *POstProcessS2*tempHYc ; // float ScatterDueToNormal = saturate( (dot(-lightDirection, -cloudGroupNormal ) + 1.0 )*0.50 ) ; // use the reverse normal to compute scatter ScatterDueToNormal = pow(abs(ScatterDueToNormal), lerp( SetVS36, SetVS37, TempSUNRO1*Process_DE0)+TempSUNR3*SetVS38*Process_DE0 ) ; // saturate float ctBrL = SetVS14*lerp( SetVS10, SetVS11, saturate(exp( -SetVS12* (VthicknessE-80)/1000 ))) ; // коэффициент крутизны градиента от толщины облачности float corrDistH = saturate(0.7*SetVS3H/5000) ; float fIntHVint1 = saturate(tanh( ctBrL *(nPosition1.y + corrDistH*fExp32 ) )) ; // float fIntHVint2 = saturate(tanh( ctBrL *(nPosition2.y + corrDistH*fExp32 ) )) ; // float fIntHVint = lerp( fIntHVint2, fIntHVint1, lerp(SetVS15, SetVS57, SetVS57*PReProcess_EDES ) ) ; // fIntHVint = pow( abs(fIntHVint), 1+11*TempFullS1 )+ SetVS13 + 0.3*fIntAltCorr1 -0.2*SetVS57*POstProcess_S3-0.2*PReProcess_E ; float vecSune = saturate(0.5+0.5*tanh(SetVS78 *(AngPosVec.y - Sundy ))) ; // float fIntHVint3 = saturate(tanh( ctBrL *( (nPosition2.y + nPosition1.y) + corrDistH*fExp32 ) ))+lerp( SetVS75, SetVS74, vecSune ) ; // pow(abs( 1*ctBrL *( nPosition1.y+nPosition2.y + corrDistH*fExp32 +1-2*fA0 ) ), 2.0 ) float fcolorGSs = fIntHVint3*2*SetVS71 ; float LBcolor = lerp(SetVS20, SetVS21, fIntAltCorr1) ; float HTcolor = lerp(SetVS22, SetVS22o, TempSUNRO2*Process_DE2*ProcessDES ) ; float cIntcolor = SetVS23 ; float fCTcolor = 1.3 *saturate(HTcolor - LBcolor ) ; float colorVGB = LBcolor + fCTcolor* fIntHVint2*lerp(1, saturate(1 *fIntensity), cIntcolor ) ; // (1 - fA0* (1-saturate(fIntensity))) float corrMsp = 1+ 0.5*cSetVS61 ; float ColorE = SetVS30 + (1+SetVS39* POstProcess_S3)*ScatterDueToNormal*corrMsp *lerp(lerp(SetVS33, SetVS33o, TempSUNRO2*Process_DE2*ProcessDES ), SetVS32, ProcessDE0) *(1+ lerp(SetVS340, SetVS34A, fAexp83)* TempSUNR2*Process_DE0 ) + SetVS31*saturate(fIntensity) ; // *TempXZ1*1.5 lerp( 1.3, 0.4, TempXZ1 ) ScatterDueToNormal colorVGB *ScatterDueToNormal*1.0 float ColorSD = SetVS35 *PReProcessEG2*TempXZ1 ; // float ContrD = FProcessF( SetVS51a, SetVS51e, SetVS51s ) ; float minLevD = SetVS51M ; colorVGB = 1*(saturate(minLevD)+saturate(1-(minLevD))*pow(abs(ContrD), 3))*(1-ContrD*(1-colorVGB)) ; // float ContrE = FProcessF( SetVS52a, SetVS52e, SetVS52s ) ; float minLevE = SetVS52M ; ColorE = 1*(saturate(minLevE)+saturate(1-(minLevE))*pow(abs(ContrE), 3))*(1-ContrE*(1-ColorE)) ; // float fIntEDDu = lerp(lerp( 1-lerp(saturate(SetVS56), 0, PReProcess_EDES*SetVS57 ), 1-saturate(SetVS55), ProcessDE0 ), 1, 0.2*TempSUNRO2*Process_DE0 ) ; float ContrSv = lerp( SetVS77, SetVS76, pow(abs(saturate(Sundy)), 0.5 )) ; fcolorGSs = (saturate(0.35)+saturate(1-0.35)*pow(abs(ContrSv), 3))*(1-ContrSv*(1-fcolorGSs)) ; // float BcolorFinal = lerp( ColorE, colorVGB, lerp(fIntEDDu, 1, PReProcess_EDES*SetVS57) )+ RedDueToN + ColorSD ; // float ContrF0 = FProcessF( SetVS53a, SetVS53e, SetVS53s ) ; float ContrFA = FProcessF( SetVS80a, SetVS80e, SetVS80s ) ; float ContrF = lerp( ContrF0, ContrFA, fAcorr28 ) ; float minLevF = SetVS53M ; float AddVCSn2 = fcolorGSs*TempSUNR2*TempSUNYZ*(1+SetVS73*TempSUNR1)*(1+0.0 *TempFullSm )*POstProcessS1*ProcessSn1*(1-0.1*Process_DES) ; // BcolorFinal = (1- (0.5*TempFullSm + 0.50*TempSUNR2*TempSUNYZ* Process_DE1 )*POstProcessB1 ) *(saturate(minLevF)+saturate(1-minLevF)*pow(abs(ContrF), 3))*(1-ContrF*(1-BcolorFinal)) + 1.0*AddVCSn2 ; // diffuse.r = SetVS99 *BcolorFinal*(1+TempSUNRO2*Process_DE2*fIntAltCorr1*lerp( SetVS60, SetVS60s, Process_DES) ) ; // diffuse.g = TempSUNR2 ; // TempSUNR2 colorVGB fcolorGSs PReProcessEG2 diffuse.b = TempFullSm ; // diffuse.a = colorA*saturate(alpha) ; } // void GetPointDiffuse // Generate a rotation matrix based on the bank, with 0 pitch and heading float3x3 GenerateBankMatrix(in float b) { float sin_b = sin(b); float cos_b = cos(b); float3x3 matRot; matRot[0].x = cos_b; matRot[1].x = -sin_b; matRot[2].x = 0; matRot[0].y = sin_b; matRot[1].y = cos_b; matRot[2].y = 0; matRot[0].z = 0; matRot[1].z = 0; matRot[2].z = 1; return matRot; } VS_OUTPUT VS(VS_INPUT In) { VS_OUTPUT Out = (VS_OUTPUT)0; float4 spriteCenter = In.vPosition; float3 groupCenter = In.vNormal.xyz; float4 packedUV = In.cColor; float2 packedCorner = In.Tex; float bankRadian = In.fRBias[0]; float puffRadius = In.fRBias[1]; GeoidTranform geoTrans = GetGeoidTranform(In.mInstanceIndex); // Get round world matrix matrix matWorld = ComputeRoundWorldMatrix(geoTrans, cb_ViewOrigin); // Set UV Out.uv = packedUV; // Offset the spritecenter with cluster offset. The cluster is a group of sprite to make up // a cloud. This is needed b/c sometime we draw one cluster at a time to do sorting float4 clusterOffset = GetCloudClusterOffset(In.mInstanceIndex); float3x3 rotationMatrix; #if defined(SHD_VIEW_SHADOW) float3 shadowFacingVector = normalize(cb_mShadowLightDirection); rotationMatrix[2] = shadowFacingVector; rotationMatrix[0] = normalize(cross(rotationMatrix[2], float3(0, 1.0f, 0))); rotationMatrix[1] = normalize(-cross(rotationMatrix[2], rotationMatrix[0])); #elif defined(SHD_VIEW_CUBEMAP) || defined(SHD_CLOUD_ALWAYS_CAMERA_FACE) // We baked a value [0 or 1] into the w component to tell us if this draw call is per puff int IsPuffDraw = saturate(clusterOffset.w); clusterOffset.w = 0.0; //----------------------------------------------------------------------------------------------------------------------------------- // float3 positionVector = -mul(spriteCenter - clusterOffset, matWorld).xyz; // float3 cameraFacingVector = normalize(positionVector); float3 positionVector = -mul(spriteCenter - clusterOffset, matWorld).xyz; float cvcCFVi = 1 ; // =================================================== // float3 cameraFacingVector = normalize(positionVector); //---------------------------------------------- float cloudDistance = length(positionVector); float cloudDistanceR = length(positionVector.xz); float3 cameraFacingVector1 = normalize(positionVector); float3 cameraFacingVector = positionVector / cloudDistance; //+++++++++++++++++++++++++++++++++++++++++++++ float3 PosOVec1 ; //------------------------------------------------------------------------------------------------------------------------------------ rotationMatrix[2] = normalize(cameraFacingVector); rotationMatrix[0] = normalize(cross(rotationMatrix[2], float3(0, 1, 0))); rotationMatrix[1] = normalize(-cross(rotationMatrix[2], rotationMatrix[0])); #else // We baked a value [0 or 1] into the w component to tell us if this draw call is per puff int IsPuffDraw = saturate(clusterOffset.w); clusterOffset.w = 0.0; //------------------------------------------------------------------------------------------------------------------------------------ float3 positionVector = -mul(spriteCenter - clusterOffset, matWorld).xyz; // float3 cameraFacingVector = normalize(positionVector); // -------------------------------------------------------- float3 screenFacingVector = normalize(-cb_mInverseView[2].xyz); float cloudDistance = length(positionVector); float cloudDistanceR = length(positionVector.xz); float3 cameraFacingVector1 = normalize(positionVector); float3 cameraFacingVector = positionVector / cloudDistance; //+++++++++++++++++++++++++++++++++++++++++++++ float3 PosOVec1 ; //------------------------------------------------------------------------------------------------------------------------------------- float blendDistance = 3000; // Clouds will be fully volumize from 3000 meters, reducing to 0 at 6000 float facingBlend = saturate(((blendDistance - cloudDistance) / blendDistance) * IsPuffDraw); rotationMatrix[2] = normalize(lerp(cameraFacingVector, screenFacingVector, facingBlend)); rotationMatrix[0] = normalize(cross(rotationMatrix[2], float3(0, 1, 0))); rotationMatrix[1] = normalize(-cross(rotationMatrix[2], rotationMatrix[0])); #endif #if !defined(SHD_GS_INSTANCING) matrix worldView = mul(matWorld, cb_mViewToDevice); #if defined(SHD_NO_NEAR_CLIP) matrix worldViewProj = mul(worldView, cb_mNoNearProj); #elif defined(SHD_NO_FAR_CLIP) matrix worldViewProj = mul(worldView, cb_mNoFarProj); #else matrix worldViewProj = mul(worldView, cb_mProjToDevice); #endif #endif //-------------------------------------------------------------------------------------------------------- float3 positionVector2 = -mul(spriteCenter - clusterOffset, matWorld).xyz; float cloudDistance2 = length(positionVector2); float cloudDistance2R = length(positionVector2.xz); const float fExp2 = saturate(exp(-cloudDistance2 * cloudDistance2 * 0.00000000077 )); const float fExp3 = saturate(exp( SetVS3S* ( cloudDistance2 - SetVS3D*0.9 ))); // const float kSizeC = saturate(SetVS1) ; // //---------------------------------------------------------------------------------------------------------- //Apply the sprite bank rotation. rotationMatrix = mul(GenerateBankMatrix(bankRadian), rotationMatrix); Out.diffuse = (float4x4)0; float4x3 quad = (float4x3)0; float height = packedCorner.y; float width = packedCorner.x; GetScreenQuadPositions(quad, width*kSizeC, height*kSizeC ); const float fExpR = exp(-pow(abs( 0.1*50*cloudDistance2R/200000), 2)) ; // float iSetC8x = lerp(0.8*SetVS2x, 2, fExpR) ; float iSetC8z = lerp(2*SetVS2z, 1, fExpR) ; float iSetC8x = lerp(1*SetVS2x, 1, fExpR) ; float iSetC8z = lerp(1*SetVS2z, 1, fExpR) ; [unroll]for(int i = 0; i < 4; i++) { // Perform rotation float3 position = mul(quad.xyz, rotationMatrix )*float3( iSetC8x, SetVS2y, iSetC8z )+float3( 0, -aSetC9H*SetVS3*fExp3, 0 ) ; // /// Add the sprite center without scale to keep the diffuse color calculation identicle float3 position1 = normalize(position) ; // position = (spriteCenter.xyz + position ) ; // float3 position2 = normalize(position) ; // float3 position3 = normalize(spriteCenter.xyz) ; // #if defined(SHD_VIEW_SHADOW) position = -clusterOffset.xyz + position; Out.position = mul(float4(position, saturate(SetGSS1) ), matWorld); }#elif defined(SHD_GS_INSTANCING) /// Calculate the lighting of the clouds based on position of each corner// GetPointDiffuse(Out.diffuse, position, spriteCenter.xyz, rotationMatrix[2]); PosOVec1 = 0 ; // position - clusterOffset.xyz GetPointDiffuse(Out.diffuse, position, In.vNormal.xyz, In.vPosition.xyz, cloudDistance, rotationMatrix[2], position1, position2, position3, PosOVec1, matWorld ); position -= clusterOffset.xyz; Out.position = mul(float4(position, 1.0), matWorld); }#else /// Calculate the lighting of the clouds based on position of each corner// GetPointDiffuse( Out.diffuse, position, spriteCenter.xyz, rotationMatrix[2]); PosOVec1 = position - clusterOffset.xyz ; // GetPointDiffuse(Out.diffuse, position, In.vNormal.xyz, In.vPosition.xyz, cloudDistance, rotationMatrix[2], position1, position2, position3, PosOVec1, matWorld ); /// Apply cluster offset and scale factor position -= clusterOffset.xyz; float4 worldPos = mul( float4(position,1.0), matWorld ); Out.mAlt = worldPos.y; Out.position = mul( float4(position,1.0), worldViewProj ); //Compute far and near fade for the position and diffuse. ComputeFarAndNearFade(Out.position, Out.diffuse); }#endif #if !defined(SHD_VIEW_SHADOW) // Compute fog float3 vSpriteCenter = spriteCenter.xyz - clusterOffset.xyz; Out.fFogDistance = FogVS(float4(vSpriteCenter, 1), matWorld, float4(cb_mEyePoint.xyz, 1)); #endif return Out;} #if defined(SHD_GS_INSTANCING)[instance(SHD_GS_INSTANCE_COUNT)]#endif[maxvertexcount(4)]void GS(point VS_OUTPUT input[1], inout TriangleStream<GS_OUTPUT> SpriteStream, uint InstanceID : SV_GSInstanceID){ GS_OUTPUT output; float2 lowerleft = input[0].uv.xy; float2 upperright = input[0].uv.zw; #if defined(SHD_VIEW_SHADOW) output.RTIndex = InstanceID; // Bottom left output.position = mul(input[0].position[0], cb_mTranslucentViewProjection[InstanceID]); output.z = output.position.z; // pass down real z to PS output.position.z *= saturate(output.position.z); // pancake just in case output.uv.x = lowerleft.x; output.uv.y = lowerleft.y; output.localUV.x = -1; output.localUV.y = 1; SpriteStream.Append(output); // Bottom right output.position = mul(input[0].position[2], cb_mTranslucentViewProjection[InstanceID]); output.z = output.position.z; // pass down real z to PS output.position.z *= saturate(output.position.z); // pancake just in case output.uv.x = lowerleft.x; output.uv.y = upperright.y; output.localUV.x = 1; output.localUV.y = 1; SpriteStream.Append(output); // Top Left output.position = mul(input[0].position[1], cb_mTranslucentViewProjection[InstanceID]); output.z = output.position.z; // pass down real z to PS output.position.z *= saturate(output.position.z); // pancake just in case output.uv.x = upperright.x; output.uv.y = lowerleft.y; output.localUV.x = -1; output.localUV.y = -1; SpriteStream.Append(output); // Top right output.position = mul(input[0].position[3], cb_mTranslucentViewProjection[InstanceID]); output.z = output.position.z; // pass down real z to PS output.position.z *= saturate(output.position.z); // pancake just in case output.uv.x = upperright.x; output.uv.y = upperright.y; output.localUV.x = 1; output.localUV.y = -1; SpriteStream.Append(output); SpriteStream.RestartStrip(); #elif defined(SHD_GS_INSTANCING) output.RTIndex = InstanceID; #if defined(SHD_VIEW_CUBEMAP)#if defined(SHD_NO_NEAR_CLIP) matrix viewProj = mul(cb_mViewCubemap[InstanceID], cb_mNoNearProj);#elif defined(SHD_NO_FAR_CLIP) matrix viewProj = mul(cb_mViewCubemap[InstanceID], cb_mNoFarProj);#else matrix viewProj = mul(cb_mViewCubemap[InstanceID], cb_mProjToDevice);#endif#else#if defined(SHD_NO_NEAR_CLIP) matrix viewProj = mul(cb_mViewInstance[InstanceID], cb_mNoNearProj);#elif defined(SHD_NO_FAR_CLIP) matrix viewProj = mul(cb_mViewInstance[InstanceID], cb_mNoFarProj);#else matrix viewProj = mul(cb_mViewInstance[InstanceID], cb_mProjToDevice);#endif#endif output.fFogDistance = input[0].fFogDistance; output.mAlt = input[0].position[0].y; // Bottom left output.position = mul(input[0].position[0], viewProj); output.diffuse = input[0].diffuse[0]; #if !defined(SHD_VIEW_CUBEMAP) ComputeFarAndNearFade(output.position, output.diffuse); #endif output.uv.x = lowerleft.x; output.uv.y = lowerleft.y; output.localUV.x = -1; output.localUV.y = 1; SpriteStream.Append(output); // Bottom right output.position = mul(input[0].position[2], viewProj); output.diffuse = input[0].diffuse[2]; #if !defined(SHD_VIEW_CUBEMAP) ComputeFarAndNearFade(output.position, output.diffuse); #endif output.uv.x = lowerleft.x; output.uv.y = upperright.y; output.localUV.x = 1; output.localUV.y = 1; SpriteStream.Append(output); // Top Left output.position = mul(input[0].position[1], viewProj); output.diffuse = input[0].diffuse[1]; #if !defined(SHD_VIEW_CUBEMAP) ComputeFarAndNearFade(output.position, output.diffuse); #endif output.uv.x = upperright.x; output.uv.y = lowerleft.y; output.localUV.x = -1; output.localUV.y = -1; SpriteStream.Append(output); // Top right output.position = mul(input[0].position[3], viewProj); output.diffuse = input[0].diffuse[3]; #if !defined(SHD_VIEW_CUBEMAP) ComputeFarAndNearFade(output.position, output.diffuse); #endif output.uv.x = upperright.x; output.uv.y = upperright.y; output.localUV.x = 1; output.localUV.y = -1; SpriteStream.Append(output); SpriteStream.RestartStrip(); #else output.fFogDistance = input[0].fFogDistance; output.mAlt = input[0].mAlt.y; // Bottom left output.position = input[0].position[0]; output.diffuse = input[0].diffuse[0]; output.uv.x = lowerleft.x; output.uv.y = lowerleft.y; output.localUV.x = -1; output.localUV.y = 1; SpriteStream.Append(output); // Bottom right output.position = input[0].position[2]; output.diffuse = input[0].diffuse[2]; output.uv.x = lowerleft.x; output.uv.y = upperright.y; output.localUV.x = 1; output.localUV.y = 1; SpriteStream.Append(output); // Top Left output.position = input[0].position[1]; output.diffuse = input[0].diffuse[1]; output.uv.x = upperright.x; output.uv.y = lowerleft.y; output.localUV.x = -1; output.localUV.y = -1; SpriteStream.Append(output); // Top right output.position = input[0].position[3]; output.diffuse = input[0].diffuse[3]; output.uv.x = upperright.x; output.uv.y = upperright.y; output.localUV.x = 1; output.localUV.y = -1; SpriteStream.Append(output); SpriteStream.RestartStrip(); #endif} // TBM 29/04/2022 Test darkening the cloud shadows//#if defined(SHD_VIEW_SHADOW)//float2 PS(GS_OUTPUT In): SV_TARGET//{// float4 cColor = txBase.Sample( samWrap, In.uv );// return float2(1.0f-cColor.a * SetPSS1,In.z);//} // TBM 29/04/2022 Original code, increase SetPSS1 value from the default of 0.75 to increase shadow darkness.#if defined(SHD_VIEW_SHADOW)float2 PS(GS_OUTPUT In): SV_TARGET{ float4 cColor = txBase.Sample( samWrap, In.uv ); return float2( 1.0f-cColor.a*saturate(SetPSS1), In.z);// return float2(1.0f-cColor.a * SetPSS1,In.z);} #else float4 PS(#if defined(SHD_GS_INSTANCING) GS_OUTPUT In#else PS_INPUT In#endif) : SV_TARGET{ float fAngY = In.mAlt/(In.fFogDistance+1) ; float fAngYh = (In.mAlt + 2*cb_Altitude )/(In.fFogDistance+1) ; float TempAngY1 = exp(-pow(abs( 4*fAngY), 3 )) * (1-exp(-pow(abs( 3*In.fFogDistance/10000 ), 2 ))) ; float TempExH1 = saturate( exp( -11*fAngYh )) ; float tempHYc = 1-saturate(exp(-11* abs( fAngYh ))) ; float tempZv = 1-saturate(exp(-pow( abs(8* ( fAngYh-1 ) ), 3))) ; float fExp32 = saturate(exp( SetVS3S* (In.fFogDistance - SetVS3D*0.9 ))); float HAcompY = In.mAlt+ cb_Altitude +3100*pow(abs(In.fFogDistance/200000), 2 ) +1.1*aSetC9H*SetVS3*fExp32 ; float hCAltitudeY1 = HAcompY/10000 ; float fIntAltCorr1 = (1-exp(-pow(abs( 4 * hCAltitudeY1), 3.5)))*saturate(tanh( 2.2 *hCAltitudeY1)) ; float cfIntAltTR = lerp(lerp(0.55, 1, fIntAltCorr1), 0.0, FACorE1) ;// float fIntAlt = pow(abs(saturate( 1*((In.mAlt + cb_Altitude )/10000) )), 1.2 ) ; // 1-exp( -pow(abs( 3*((In.mAlt + cb_Altitude )/10000)), 2.8 )) float fIntAlt = saturate( tanh(1*((In.mAlt + cb_Altitude )/10000)) ) ; float fIntAlt2 = saturate( (In.mAlt + cb_Altitude )/10000 ) ; const float BLSu1 = 0.900 ; // уровень ¤ркости в точке восхода/заката const float BposD1 = -0.27 ; // позици¤ минимума до восхода/после заката. (начало нелинейного процесса нижн. ветки) const float BscD1 = 4.0 ; // крутизна нарастани¤/падени¤ ¤ркости до восхода/после заката. (нижн. ветка) const float BposL1 = -0.40 ; // позици¤ минимума линейного процесса до восхода/после заката. const float BLdSu1 = 0.12 ; // уровень линейного процесса в точке восхода/заката const float BFIw1 = -22 ; // ширина интерпол¤ции веток с центром в точке восхода/заката float FGBrSkyD1 = saturate( -(BLdSu1/BposL1)*(Sundy-BposL1) // линейный директионал +(BLSu1-BLdSu1)*pow( abs((Sundy-BposD1)/BposD1), BscD1 )*step(0, (Sundy-BposD1))) ; // нижн¤¤ ветка float GBrSky1 = saturate( FGBrSkyD1) ; // float GBrSky_1 = saturate(1-GBrSky1) ; // float GBrSkyd = saturate(1.2*(cb_mCloudDirectional.r+cb_mCloudDirectional.g +cb_mCloudDirectional.b)/3) ; float4 Rdiffuse = float4(In.diffuse.r, In.diffuse.r, In.diffuse.r, In.diffuse.a ) ; float4 RCcColor = txBase.Sample(samWrap, In.uv); float CanallsRGB = 1 - SetPS00*saturate(1-RCcColor.r) ; // RCcColor.r float4 ColorM0 = Rdiffuse*float4(CanallsRGB, CanallsRGB, CanallsRGB, RCcColor.a ) ; // RCcColor.r const float fExp = saturate(exp(-In.fFogDistance * In.fFogDistance * 0.00000000077)); float fDistP1 = pow(abs(1-1*saturate(In.fFogDistance/(1000000* 0.1) )), 5 ) ; float fDistP1_1 = 1-fDistP1 ; float fDistP1_2 = 1-fDistP1*POstProcessS2*(1-fAexp83) ; float fDistP1_3 = 1-fDistP1*POstProcessS2* fAexp83 ; float LbSc = 0.7 ; float Scfdb = 2 ; float offsSdy = 0.3 ; float Scfd = 5 ; float fxoffsSdy = Sundy-offsSdy ; float ProcessRGBc = saturate( LbSc*pow(abs(Sundy-1), Scfdb) +(1-LbSc)* step(0, -fxoffsSdy )*pow(abs(fxoffsSdy/offsSdy), Scfd ) ) ; float Process_RGBc = 1-ProcessRGBc ; float addSunGc = SetPS10*In.diffuse.b*RCcColor.b*tempHYc*VisSunOn ; float3 ColorM1 = SetPS02*pow(abs(ColorM0.rgb), SetPS01 ) + addSunGc ; float colorFErgb = (ColorM1.r+ColorM1.g+ColorM1.b)/3 ; float alfaFG1 = saturate(pow(abs( 1.0* ( 1-ColorM0.a)), 3 )) ; float colorInv = saturate(1-2*RCcColor.b) ; // ѕредварительна¤ настройка ¤ркости и гаммы перед теневым фильтром // lerp(SetPS04s, SetPS04z, (0.7*ProcessDE1 + 0.3*saturate(Sundy)) ) float FPBrC = cSetPS04*SetPS05 ; // некомпенсированна¤ настройка предварительной ¤ркости под теневой фильтр// Ќастройка компенсации падени¤ ¤ркости на выходе теневого и цветового фильтра дл¤ общей стабилизации ¤ркости на выходе float blBrC = clamp(FPBrC/SetPS06, 0.0001, 100000) ; // результирующий коэффициент ¤ркости под теневой фильтр float LCompFBr = SetPS07 ; // уровень компенсации падени¤ ¤ркости на выходе фильтра // =0 - компенсаци¤ ¤ркости полностью отсутствует. =1 - полна¤ компенсаци¤. float LSpFBr = SetPS08 ; // крутизна изменени¤ компенсации ¤ркости на выходе фильтра float TLBrmin = SetPS09 ; // нижний порог ограничени¤ компенсации ¤ркости на выходе фильтра float K_blBrCFin = pow(abs(lerp( 1, pow(abs(blBrC), LSpFBr )+TLBrmin, LCompFBr )), 3 ) ; float3 ColorM2 = FPBrC*pow(abs(ColorM0.rgb), SetPS03 ) + addSunGc ; // 0*clamp( pow(abs( 1*(colorFErgb-fA0)), 3) , 0, 10 ) + float3 ColorMcf = ColorM2*(1+ 0*In.diffuse.g ) ; // float fCFint1 = 0.99*exp(-pow(abs( 0.70 *colorFErgb), 3 )) ; // интерпол¤тор ¤ркостного градиента тела обл. float fCFint2_1 = clamp((colorFErgb- 0.5 )* 1, 0, 10 ) ; //1 - exp(-pow(abs( 3 *colorFErgb), 3 )) + step(0, colorFErgb-0.4 )*pow(abs((colorFErgb- 0.4 )* 1 ), 2 ) float fCFintR = exp(-pow(abs( 0.8 *colorFErgb), 3 )) ; // интерпол¤тор ¤ркостного градиента R. float fCGint1 = 0*PReProcessEG1*clamp((colorFErgb- 2*0.50 )* (0.5+1), 0, 10 ) ; // интерпол¤тор ¤ркостного градиента тела обл. float fDistP1eff = fDistP1_1*SetPS21 ; float infIntGB = lerp(lerp(lerp( 0, SetPS22, fDistP1eff ), 1, ProcessRGBc ), 1, SetPS14 ) ; float infIntGB_A = infIntGB*lerp(SetPS18, SetPS19, PReProcessEG2 )*lerp(SetPS20, 1, POstProcessS3) ; float infIntGB_B = infIntGB ;// онечные цветовые точки цветовой интерпол¤ции float FintCAg = SetPS15g+SetPS16g*PReProcess_E2*PReProcessEG2 ; // g - компонент дл¤ вершин. float FintCAb = SetPS15b ; // b - компонент дл¤ вершин. float FintCBg = SetPS17g ; // g - компонент дл¤ нижней части . float FintCBb = SetPS17b ; // b - компонент дл¤ нижней части . float SatGnC = POstProcessB0 ; // реверс интерпол¤ции после захода float fIntAbovG = lerp( 1, lerp(1, FintCAg, RIntGc(infIntGB_A) ), SatGnC ) ; // RIntGc(infIntGB_A) float fIntAbovB = lerp( 1, lerp(1, FintCAb, infIntGB_A ), SatGnC ) ; // float fIntButtG = lerp( 1, lerp(1, FintCBg, RIntGc(infIntGB_B) ), SatGnC ) ; // RIntGc(infIntGB_B) float fIntButtB = lerp( 1, lerp(1, FintCBb, infIntGB_B ), SatGnC ) ; // float CorrGc = 1- 0.15*POstProcessD1*ProcessDT_1 ; ColorMcf.r *= lerp(1, 1, fIntAlt )*lerp( 1, SetPS22r, fDistP1eff )/(1+ 0.3*fCGint1) ; ColorMcf.g *= lerp(fIntButtG, fIntAbovG, fIntAlt )*lerp(1, SetPS22g, fDistP1eff )*CorrGc/(1+ 0.35*fCGint1) ; // ColorMcf.b *= lerp(1, 1, fIntAlt )*lerp(fIntButtB, 1*fIntAbovB, fIntAlt )*lerp(1, SetPS22b, fDistP1eff )/(1+ 0.65*fCGint1) ; // float GsatBr = lerp( SetPS42, lerp(SetPS40, SetPS41, POstProcessS3*PReProcess_E2), fIntAlt) ; float addsatBr = FProcessF( SetPS47a, SetPS47e, SetPS47s ) ; // коэффициент добавочной насыщенности самых ¤рких участков ColorMcf = lerp(dot(ColorMcf, float3(0.299f, 0.587f, 0.114f )), ColorMcf, GsatBr*(1+ addsatBr*fCFint2_1) ) ; // tempZv* lerp(1, 0.5*pow(abs(colorFErgb ), 0.8 ), 0.9 ) ColorMcf = lerp(dot(ColorMcf, float3(0.299f, 0.587f, 0.114f )), ColorMcf, POstProcessS1*FProcessF( SetPS48a, SetPS48e, SetPS48s ) ) ; ColorMcf = lerp(ColorMcf, ColorMcf*float3((1- 0.8*alfaFG1), (1+ 0.3*alfaFG1), (1+ 0.8*alfaFG1) ), SetPS49 ) *(1+0.0*fIntAlt2) ; /// *lerp( 1, float3( 1, 0.50 , 0.50 ), 0.7*(1-fExp)*PReProcessE2 ) float CompBrRGB = ((ColorM2.r-ColorMcf.r)+(ColorM2.g-ColorMcf.g)+(ColorM2.b-ColorMcf.b))/3 ; float3 ColorMF = ColorMcf*(1 + 0.0*CompBrRGB+ 0.0* (1-fExp)*PReProcessE2)*(1+ 0.2*POstProcess_S1) ; // ColorM2 ; float fLevL = cSetPS55*SetPS54 ; // ќсновной абсолютный уровень фильтра// омпенсаци¤ ¤ркости дл¤ стабилизации ¤ркости теневых участков при регулировке уровн¤ теневого фильтра float CompBrF = cSetPS56 ; // ”ровень компенсации ¤ркости цвета на выходе при регулировке теневого фильтра float sFlev = SetPS59 ; // ќсновна¤ крутизна фильтра float andSunLft0 = 1+ 0.5*ProcessSn1*lerp(1, ProcessDE5, 1 )*In.diffuse.g ; // float andSunLft1 = lerp(andSunLft0, 1, 0 ) ;// общий коеффициент порога нижнего(теневого) уровн¤ ограничени¤.(сглаживание и обрезание детализации) ‘инальный компонент. float gLovTrDet = fLevL*1.7*(1+0.1*TempExH1)*andSunLft0*lerp(0.9, 1-0.5*POstProcess_D1*POstProcessB1, TempAngY1) ; // покомпонентные пороги теневого ограничени¤ детализации. float CLovTrR = SetPS57r ; float CLovTrG = SetPS57g ; float CLovTrB = SetPS57b ; float3 CLovTrRGB = float3(CLovTrR, CLovTrG, CLovTrB) ; CLovTrRGB = lerp(dot(CLovTrRGB, float3(0.2126f, 0.7152f, 0.0722f)), CLovTrRGB, SetPS58 ) ;// покомпонентные коэффициенты финальной коррекци¤ переходных порогов float corrTrR = SetPS61r ; float corrTrG = SetPS61g ; float corrTrB = SetPS61b ; float LovTrDetR = CLovTrRGB.r*gLovTrDet ; float LovTrDetG = CLovTrRGB.g*gLovTrDet ; float LovTrDetB = CLovTrRGB.b*gLovTrDet ; ColorMF.r = lerp( ColorMF.r, LovTrDetR, saturate(0.5+0.5*tanh( -sFlev* ( ColorMF.r-LovTrDetR*corrTrR ) )) ) ; // 1+0.*0.5 ColorMF.g = lerp( ColorMF.g, LovTrDetG, saturate(0.5+0.5*tanh( -sFlev* ( ColorMF.g-LovTrDetG*corrTrG ) )) ) ; // 1+0.5*0.1 ColorMF.b = lerp( ColorMF.b, LovTrDetB, saturate(0.5+0.5*tanh( -sFlev* ( ColorMF.b-LovTrDetB*corrTrB ) )) ) ; ColorMF = 1*lerp(dot(ColorMF, float3(0.2126f, 0.7152f, 0.0722f)), ColorMF, SetPS79 ) ; // float3 ColorM3 = 1.0*(1+ 0*In.diffuse.g)*lerp( ColorM1 , ColorM2, 0 ) ; float4 cColor ; cColor.a = ColorM0.a ; cColor.rgb = ColorMF*lerp( 1, CompBrF, fLevL)/K_blBrCFin ; // cColor.rgb = lerp( cColor.rgb, 0.07*float3(0.65, 0.85, 1), 0.0 )*(1+ 0.10*In.diffuse.g*PReProcessEG )/andSunLft1 ; // ProcessSn1*ProcessDE5* cColor.rgb *= lerp(float3(SetPS82r, SetPS82g, SetPS82b), float3(1, 1, 1), lerp(1, lerp( 0,saturate(1-SetPS81), fDistP1), SetPS80) ) ; // подсинивание cColor.rgb = pow(abs(cColor.rgb), 1+SetPS85*In.diffuse.b )*(1+SetPS86*POstProcessS2*In.diffuse.b) *lerp(SetPS91, SetPS90, GBrSky1) *lerp(1.0, 0.38, TempAngY1*(1-In.diffuse.b)*POstProcess_D1*POstProcessB1 ) ; // cColor.rgb = 1.1*cSetPS93*lerp(dot(cColor.rgb, float3(0.2126f, 0.7152f, 0.0722f)), cColor.rgb, SetPS94 ) ; cColor.a *= lerp( 1.05, 0.80, fIntAlt) ; // *float3(1.3, 0.83, 1 ) cColor.a = lerp( SetPS98, SetPS97, fDistP1 )*pow(abs(cColor.a), SetPS99 ) ; // Apply IR if active #if defined(SHD_IR_ACTIVE) cColor = ApplyIr(cColor); cColor = FogIR(cColor, In.fFogDistance); #if defined(SHD_IR_BLACK_HOT) cColor.rgb = 1.0f - cColor.rgb;#endif return cColor; #endif //SHD_IR_ACTIVE //Soft edges. #if defined(SHD_CLOUD_FADE_AT_Z) #endif #if !defined(SHD_NO_FOG) && !defined(SHD_VIEW_CUBEMAP) //Compute fog contribution. #if defined(SHD_VOLUMETRIC_FOG) cColor = VolumetricFogPS( In.mAlt, cColor, In.fFogDistance / 2.0, cb_mFogDensity, cb_mFogColor.xyz); #else cColor = float4( FogPS( cColor.xyz, In.fFogDistance / 2.0, cb_mFogDensity, cb_mFogColor.xyz ), cColor.a ); #endif //SHD_VOLUMETRIC_FOG #endif //!SHD_NO_FOG DEBUG_MARK(cColor) return cColor;}#endif You can end up with some pretty nice clouds. Edited July 14, 20223 yr by Rogen Ryzen 5800X clocked to 4.7 Ghz (SMT off), 32 GB ram, Samsung 1 x 1 TB NVMe 970, 2 x 1 TB SSD 850 Pro raided, Asus Tuf 3080Ti P3D 4.5.14, Orbx Global, Vector and more, lotsa planes too. Catch my vids on Oz Sim Pilot, catch my screen pics @ Screenshots and Prepar3D
Archived
This topic is now archived and is closed to further replies.