Bucic Posted December 8, 2010 Posted December 8, 2010 (edited) The answer is in the text. You can take a screenshot (like you did), pick a probe of RGB values of the current color and compute the coefficients to multiply the output with. 1 in shader = 255, 0 in shader = 0. You must have yourself a goal not to answer my question directly :D OK then, I'm on it and I'll post the results (if I get to that point) later. Edit: So I guess generally RGB_desired = RGB_original * coefficient What I did: sky_basic.dat: mov oD0,r0 changed to: def c23, 1.67, 1.25, 0.9, 1 mul r0, r0, c23 mov oD0,r0 sky_new.dat: mul oD0,r0, c22 mov oD0, r0 changed to: mul oD0,r0, c22 def c23, 1.67, 1.25, 0.9, 1 mul r0, r0, c23 mov oD0, r0 Effect: black sky = error, same with sky_new.dat: mul oD0,r0, c22 mov oD0, r0 changed to: def c23, 1.67, 1.25, 0.9, 1 mul r0, r0, c23 mov oD0, r0 (spaces removed) BTW, What is w in the coefficient definition? In the meantime I chose the right colors for the first tests Edited December 9, 2010 by Bucic F-5E simpit cockpit dimensions and flight controls Kill the Bloom - shader glow mod Poor audio Doppler effect in DCS [bug] Trees - huge performance hit especially up close
SilentEagle Posted December 8, 2010 Author Posted December 8, 2010 To be honest Bucic, I had absolutely no clue what I was doing. I tried for days to figure out what this pixel shader color coding was about and just went with plain luck and trial & error. I'm not completely satisfied with the sky color Blaze and I have come up with, but until we figure out how to get exactly what we want, that's our best effort. Thanks to DarkWanderer for the information! Not sure it helps me convert rgb to code though. We'll see.
aaron886 Posted December 9, 2010 Posted December 9, 2010 Confusing as all get out. I'm no programmer, but I dabble with "higher-level" languages and no doubt I look at your explanation with a stupid look on my face, DarkWanderer.
Bucic Posted December 9, 2010 Posted December 9, 2010 (edited) Confusing as all get out. I'm no programmer, but I dabble with "higher-level" languages and no doubt I look at your explanation with a stupid look on my face, DarkWanderer. That's because, and I'm not being grumpy here, DarkWanderer's explanation is not sufficient in a technical sense. Take the w value of the coefficient for example. Anyway, I think I got the whole coefficient multiply thing right, I've set up a spreadsheet for quick calculations of desired coefficients. This theoretically should allow me to precisely and deliberately control sky color. The only problem is that after the modifications I mentioned before I got black sky which usually indicates a syntax error in the shader, e.g. when you use a previously undeclared constant (coefficient). Edited December 9, 2010 by Bucic F-5E simpit cockpit dimensions and flight controls Kill the Bloom - shader glow mod Poor audio Doppler effect in DCS [bug] Trees - huge performance hit especially up close
DarkWanderer Posted December 9, 2010 Posted December 9, 2010 (edited) That's because, and I'm not being grumpy here, DarkWanderer's explanation is not sufficient in a technical sense. Take the w value of the coefficient for example. Sure, it's always someone else who is at fault... Here's a code with simple change: vs.1.1 dcl_position v0 ; ; Constants: ; ; c0-c3 - View*Projection ; c4-c6 - inverted View ; c7 - C0.x, C0.y, SpanX, SpanY ; c8 - (-2*h),1/R,Cz,(-4*(h^2-R^2) ; c9 - 0.0,0.5,1.0,h ; c10-c12- RGB conversion ; c13 - LumA,LumB,LumC,LumD ; c14 - LumE,Ax,Bx ; c15 - Cx,Dx,Ex,Ay ; c16 - By,Cy,Dy,Ey ; c17 - 1/zenith_rad,1/x_rad_zenith,1/y_rad_zenith,0.3 ; c18 - lightVector ; c19 - acos1,acos2,acos3,acos4 ; c20 - acos5,pi/2,log2(e),alt_adjust def c22, 0.85, 0.85, 1.00, 1.00 ; ;Set position in cam space: mad r0.x,v0.x,c7.z,c7.x mad r0.y,v0.y,c7.w,c7.y mov r0.z,c8.z ;transform position to world space dp3 r1.x,r0,c4 dp3 r1.y,r0,c5 dp3 r1.z,r0,c6 mov r1.w,c9.z ;normalize position: dp3 r0.w,r1,r1 rsq r2.w,r0.w mul r0,r1,r2.w ;;mov r0.w,c9.z ;1.0 ;calc distance to sphere mul r1.w,c8.x,r0.y ;-2h*p.y mad r1.x,r1.w,r1.w,c8.w ;^2-4*(h^2-R^2) mov r1.y,r1.x rsq r1.x,r1.x mul r1.y,r1.y,r1.x add r1.w,r1.w,r1.y mul r1.w,r1.w,c9.y ;get sphere point in world space mul r2,r0,r1.w mov r2.w,c9.z ;;transform and output dp4 oPos.x, r2, c0 dp4 oPos.y, r2, c1 dp4 oPos.z, r2, c2 dp4 oPos.w, r2, c3 ;---------------------------------------- ;normalize world pos dp3 r0.w,r2,r2 rsq r0.w,r0.w mul r4,r2,r0.w ;r4=normalized world pos max r4.y,r4.y,c9.x ; ;cos gamma dp3 r0.w,r4,c18 ;*************************************** ;acos gamma ;get |gamma| mul r1.w,r0.w,r0.w mov r2.w,r1.w rsq r2.w,r2.w mul r1.w,r1.w,r2.w ;r1.w=|gamma| ;calc z for |gamma|<0.5 mul r0.x,r0.w,r0.w ;r0.x=z for |gamma|<0.5 ;calc z for |gamma|>0.5 add r0.y,c9.z,-r1.w mul r0.y,r0.y,c9.y ;r0.y=z for |gamma|>0.5 ;calc x for |gamma|>0.5 mov r1.x,r0.y rsq r1.x,r1.x mul r0.z,r0.y,r1.x ;r0.z=x for |gamma|>0.5 ;set r1.x to 1 if |gamma|>=0.5 sge r1.x,r1.w,c9.y ;if (r1.x==1) r2.z=r0.y; else r2.z=r0.x //r2.z=r0.y*r1.x+(1-r1.x)*r0.x <=> r1.x*(r0.y-r0.x)+r0.x add r1.y,r0.y,-r0.x mad r2.z,r1.x,r1.y,r0.x ;if (r1.x==1) r2.x=r0.z;else r2.x=r1.w //r2.x=r0.z*r1.x+(1-r1.x)*r1.w <=> r1.x*(r0.z-r1.w)+r1.w add r1.y,r0.z,-r1.w mad r2.x,r1.x,r1.y,r1.w ;main_run(gamma)=(((( 4.2163199048E-2 * z+ 2.4181311049E-2) ; * z+ 4.5470025998E-2) ; * z+ 7.4953002686E-2) ; * z+ 1.6666752422E-1) ; * z ; * x+ x mad r3.z,r2.z,c19.x,c19.y mad r3.z,r3.z,r2.z,c19.z mad r3.z,r3.z,r2.z,c19.w mad r3.z,r3.z,r2.z,c20.x mul r3.z,r3.z,r2.z mad r3.z,r3.z,r2.x,r2.x ;;if (|gamma|>0.5) asin(|gamma|)=pi/2-2*r3.z; else asin(|gamma|)=r3.z add r3.w,r3.z,r3.z add r3.w,c20.y,-r3.w ;r3.w=pi/2-2*r3.z ;if (r1.x==1) r3.x=r3.w; else r3.x=r3.z //r3.x=r3.w*r1.x+(1-r1.x)*r3.z <=> r1.x*(r3.w-r3.z)+r3.z add r1.y,r3.w,-r3.z mad r3.x,r1.x,r1.y,r3.z ;if (gamma<0) r1.y=-1;else r1.y=+1 slt r1.y,r0.w,c9.x ;0 if >=0, 1 if <0 slt r1.z,-r0.w,c9.x ;1 if >0,0 if <=0 add r1.y,r1.z,-r1.y ;1-0, 0-1 mul r3.x,r3.x,r1.y add r3.x,c20.y,-r3.x ;r3.x=acos(gamma) in 30 commands ;************************************************** ; ;radiance = (1.0f+A*exp(B/Cos_theta)*(1.0f+C*exp(D*gamma)+E*cos_gamma*cos_gamma); ;e^y=2^(y*log2(e)) ;-------------------- ;r1.x=b/cos_theta mul r1.y,r4.y,c20.w ;verpos.y*alt_adjust rcp r1.x,r1.y mul r1.x,r1.x,c13.y ;b/(verpos.y*alt_adjust) ;e^r1.x=expp(r1.x*c20.z) mov r2.x,c9.z mul r7.w,r1.x,c20.z expp r7,r7.w mad r1.x,r7.z,c13.x,r2.x ;add r1.x,r1.x,c9.z ;r1.x=(lumA*exp(B/cos_theta)+1) ;;;D*0.3*gamma mul r1.y,r3.x,c17.w mul r1.y,r1.y,c13.w mul r7.w,r1.y,c20.z expp r7,r7.w mul r1.y,r7.z,c13.z ;r1.y=lumC*exp(D*0.3*gamma) ;;E*cos_gamma*cos_gamma mul r1.z,r0.w,r0.w mad r1.z,r1.z,c14.x,r2.x ;add r1.z,r1.z,c9.z ;r1.z=lumE*cos_gamma*cos_gamma+1 add r1.y,r1.y,r1.z mul r1.x,r1.x,r1.y mul r1.y,r1.x,c17.x ;r1.y=luminance ;----------------------------------------- ;r5.x=b/cos_theta rcp r5.x,r4.y mul r5.x,r5.x,c14.z ;Bx/verpos.y ;e^r5.x=expp(r5.x*c20.z) mul r7.w,r5.x,c20.z expp r7,r7.w mad r5.x,r7.z,c14.y,r2.x ;r5.x=(Ax*exp(Bx/cos_theta)+1) ;;;Dx*gamma mul r5.y,r3.x,c15.y mul r7.w,r5.y,c20.z expp r7,r7.w mul r5.y,r7.z,c15.x ;r5.y=Cx*exp(Dx*gamma) ;;Ex*cos_gamma*cos_gamma mul r5.z,r0.w,r0.w mad r5.z,r5.z,c15.z,r2.x ;r5.z=Ex*cos_gamma*cos_gamma+1 add r5.y,r5.y,r5.z mul r5.x,r5.x,r5.y mul r5.x,r5.x,c17.y ;r5.x=CIE_x ;---------------------------------------- ;----------------------------------------- ;r6.x=b/cos_theta rcp r6.x,r4.y mul r6.x,r6.x,c16.x ;By/verpos.y ;e^r5.x=expp(r5.x*c20.z) mul r7.w,r6.x,c20.z expp r7,r7.w mad r6.x,r7.z,c15.w,r2.x ;r6.x=(Ay*exp(Bx/cos_theta)+1) ;;;Dy*gamma mul r6.y,r3.x,c16.z mul r7.w,r6.y,c20.z expp r7,r7.w mul r6.y,r7.z,c16.y ;r6.y=Cy*exp(Dy*gamma) ;;Ey*cos_gamma*cos_gamma mul r6.z,r0.w,r0.w mad r6.z,r6.z,c16.w,r2.x ;r6.z=Ey*cos_gamma*cos_gamma+1 add r6.y,r6.y,r6.z mul r6.x,r6.x,r6.y mul r6.x,r6.x,c17.z ;r6.x=CIE_y ;----------------------------------------- rcp r1.w,r6.x mul r1.x,r1.w,r5.x mul r1.x,r1.x,r1.y add r1.z,c9.z,-r5.x add r1.z,r1.z,-r6.x mul r1.z,r1.z,r1.w mul r1.z,r1.z,r1.y dp3 r0.x,r1,c10 dp3 r0.y,r1,c11 dp3 r0.z,r1,c12 min r0,r0,c9.z mov r0.w,c9.x ;---------------------------------------- mul oD0, r0, c22 Here's the result: P.S. W component is alpha-channel and is not used in LO sky shaders. Edited December 9, 2010 by DarkWanderer 1 You want the best? Here i am...
Bucic Posted December 9, 2010 Posted December 9, 2010 Sure, it's always someone else who is at fault... . . . P.S. W component is alpha-channel and is not used in LO sky shaders. You misunderstood me. It's not to be considered in 'who's fault was it' category. You're making us a huge favor by helping us getting rid of cartoonish sky and maybe you'll even become a community hero :) You just have your way of taking some things for granted others (even with C/C++ programming basics) couldn't possibly know. It generates more posts and I'm just afraid you'll quit on the subject leaving us to fail, when we are so close to the solution. That's why I'm so pressing to get to the solution and I'm sorry if you felt urged by me. Anyway, I'm off to test what you posted and I hope you'll bear with me just a little longer. F-5E simpit cockpit dimensions and flight controls Kill the Bloom - shader glow mod Poor audio Doppler effect in DCS [bug] Trees - huge performance hit especially up close
Bucic Posted December 9, 2010 Posted December 9, 2010 (edited) OK, I've checked it out. I see that the only thing you've modified is def c22, 0.57, 0.57, 0.6, 0.57 -> def c22, 0.85, 0.85, 1.00, 1.00 I'll try to get a nice orange sky to confirm that it works as intended and that we're not in number guessing game again. EDIT: Success!!! And the shot below is an actual in-game shot Check this one out for comparison Unfortunately I can't resolve this problem with skycolor near the horrizon. I get white/yellow color for some reason :( As you can see the yelowish part is not affected by skyfog_b and skyfog_v which is reddish here. Edited December 9, 2010 by Bucic F-5E simpit cockpit dimensions and flight controls Kill the Bloom - shader glow mod Poor audio Doppler effect in DCS [bug] Trees - huge performance hit especially up close
aaron886 Posted December 9, 2010 Posted December 9, 2010 Woahhh now we're talking! Keep it up DW and Bucic... don't give up on it! The sky color looks fantastic, if you can fix the horizon and "haze!"
Boberro Posted December 9, 2010 Posted December 9, 2010 Honestly I think I like it as is without fixing white-yellow ;) Reminder: Fighter pilots make movies. Bomber pilots make... HISTORY! :D | Also to be remembered: FRENCH TANKS HAVE ONE GEAR FORWARD AND FIVE BACKWARD :D ಠ_ಠ ツ
aaron886 Posted December 9, 2010 Posted December 9, 2010 I find the blood-red horizon a little disturbing. :D EDIT: Darkwanderer, I noticed at the end, you removed "mov oD0, r0." (No idea what that actually would do of course...)
Viper101 Posted December 9, 2010 Posted December 9, 2010 The quest for the perfect sky color... Great work, keep it up!:thumbup: [sIGPIC][/sIGPIC]
Bucic Posted December 9, 2010 Posted December 9, 2010 The sky color will never be perfect because the graphics engine has gimmicks instead of solid foundations. We will tweak one thing and something will brake in other places. But as you could see before I will gladly take even plain white sky with nice blue haze just to never look at that default cartoonish blue sky ever again. F-5E simpit cockpit dimensions and flight controls Kill the Bloom - shader glow mod Poor audio Doppler effect in DCS [bug] Trees - huge performance hit especially up close
DarkWanderer Posted December 10, 2010 Posted December 10, 2010 Bucic, could you post your current sky and fog shaders? I'll check it out. You want the best? Here i am...
Bucic Posted December 10, 2010 Posted December 10, 2010 (edited) OK, I'll post them today, evening.sky_basic.txtsky_new.txt Edited December 10, 2010 by Bucic F-5E simpit cockpit dimensions and flight controls Kill the Bloom - shader glow mod Poor audio Doppler effect in DCS [bug] Trees - huge performance hit especially up close
Bucic Posted December 14, 2010 Posted December 14, 2010 Here's the latest version if someone is not repulsed by the yellowish horizon. http://www.mediafire.com/file/lzqn4xwax3nagwk/SKY_3_dec14_bcc.7z I have to wait for DW's response before attempting any further tests. F-5E simpit cockpit dimensions and flight controls Kill the Bloom - shader glow mod Poor audio Doppler effect in DCS [bug] Trees - huge performance hit especially up close
LawnDart Posted December 14, 2010 Posted December 14, 2010 It would be neat if someone was able to create a shuffle/random skycolor mod (not sure exactly how you'd do that though). The sky never looks the same in the real world every day, and many of these sky color mods are good representations of various skies - but there's obviously never going to be a perfect match since it's an ever changing environment out there. [sigpic]http://www.virtualthunderbirds.com/Signatures/sig_LD.jpg[/sigpic] Virtual Thunderbirds, LLC | Sponsored by Thrustmaster Corsair 750D Case | Corsair RM850i PSU | ASUS ROG MAXIMUS X CODE | 32GB Corsair DDR4 3200 | Intel i7-8086K | Corsair Hydro H100i v2 Cooler | EVGA GTX 1080 Ti FTW | Oculus Rift | X-Fi Titanium Fatal1ty | Samsung SSD 970 EVO 1TB NVMe | Samsung SSD 850 EVO 1TB | WD Caviar Black 2 x 1TB | TM HOTAS Warthog | TM Pendular Rudder | TM MFD Cougar Pack | 40" LG 1080p LED | Win10 |
SilentEagle Posted December 14, 2010 Author Posted December 14, 2010 Nice work! Couple questions... 1) Is that a slightly blue haze? If so, awesome! 2) Are you still working on how to change the horizon? 3) Why did you include so many files? Did you make modifications to all of these?
Bucic Posted December 14, 2010 Posted December 14, 2010 (edited) It would be neat if someone was able to create a shuffle/random skycolor mod (not sure exactly how you'd do that though). The sky never looks the same in the real world every day, and many of these sky color mods are good representations of various skies - but there's obviously never going to be a perfect match since it's an ever changing environment out there. It doesn't look the same with this mod either as it's not with the default one. I just target for a decent looking NOON summer, spring sky. Going after modding it correctly for more than two base conditions without a proper support (never given so far to sky modders) from ED I must say would be a waste of time. If anyone would like to pursue that madness :) be my guest. I'll tell you everything I know but count me out. Nice work! Couple questions... 1) Is that a slightly blue haze? If so, awesome! 2) Are you still working on how to change the horizon? 3) Why did you include so many files? Did you make modifications to all of these? 1) Yes because slightly blue haze is an element made right in the default skyfog_b and skyfog_v, by accident :music_whistling: It's just a default haze and it looks more blue the more white you make the rest of the sky. In fact when DW responds I was planning to increase the blue value of haze/fog so that it looks blueish even when looked at from above, when the ground is in the background. As God intended. I chose the desert setting deliberately. 2) No. I have no leads whatsoever that would allow me to start any deliberate tryouts. I'm waiting for DW's response. 3) You can safely consider I mod only sky_basic.dat and sky_new.dat. I may upload the whole sky folder because that's how I handle it during tests. I juggle the whole folders around and alt tab the game from full screen which causes it to reload shaders. Edited December 14, 2010 by Bucic F-5E simpit cockpit dimensions and flight controls Kill the Bloom - shader glow mod Poor audio Doppler effect in DCS [bug] Trees - huge performance hit especially up close
SilentEagle Posted January 6, 2011 Author Posted January 6, 2011 Any progress or breakthroughs, Bucic? Can't wait to see haze like this!
aaron886 Posted January 6, 2011 Posted January 6, 2011 I would suggest emailing or PM'ing DW... seems he hasn't seen this thread lately. (Or perhaps I'm being too impatient.)
T-Bone Posted January 6, 2011 Posted January 6, 2011 I created a "skyfix" for Falcon 4.0 many moons ago. I'm going to see if I can take a stab at this ;) [sIGPIC][/sIGPIC] Asus G72GX | CPU: Core 2 Duo Overclocked @ 2.9Ghz | Memory 6GB DDR2 | Graphics Card: nVidia GTX 260m 1GB | OS: Windows 7 Home Premium | Monitor: Samsung 32" LCD LOMAC 1.0 to FC 1.12 System RIP (2003-2010) | AMD Athlon 64 3000+ overclocked to 2565MHz | NVidia Geforce 7800 GS AGP 256 MB | 1GB Kingston PC2700 DDR DRAM | Windows 2000 with SP4
aaron886 Posted January 6, 2011 Posted January 6, 2011 Did that involve shader language, T-Bone? I remember your fix... it got some hours on my install. ;)
T-Bone Posted January 6, 2011 Posted January 6, 2011 No... it was some RGB values coded for different times of day. Shaders weren't in games yet back in 1998 LOL Which skyfix did you use? I had the platinum and v1-3, and Gold... yep lets just say I had too much spare time when I was younger ;) I am guessing things are a bit more complicated these days. [sIGPIC][/sIGPIC] Asus G72GX | CPU: Core 2 Duo Overclocked @ 2.9Ghz | Memory 6GB DDR2 | Graphics Card: nVidia GTX 260m 1GB | OS: Windows 7 Home Premium | Monitor: Samsung 32" LCD LOMAC 1.0 to FC 1.12 System RIP (2003-2010) | AMD Athlon 64 3000+ overclocked to 2565MHz | NVidia Geforce 7800 GS AGP 256 MB | 1GB Kingston PC2700 DDR DRAM | Windows 2000 with SP4
aaron886 Posted January 6, 2011 Posted January 6, 2011 Much. I think you could call this lower-level shader programming. I don't remember... but I remember it was one of yours!
lucioperca Posted January 6, 2011 Posted January 6, 2011 I used it too T Bone platinum I presume winXP sp3 i5 3.640ghz duo core 4gig Ram Nvidia Geforce GTS 250 1 gig TIR4 Thrustmaster Cougar
Recommended Posts