![]() |
SUBSIM: The Web's #1 resource for all submarine & naval simulations since 1997 |
03-24-10, 11:31 AM
|
#10 | |
|
Pacific Aces Dev Team
![]() |
Quote:
and EnvColors_xxx.cfg's (\Silent Hunter 5\data\Env\) Code:
// 1. base gradient, from top to bottom float heightRatio = pow(In.eyeDir.w / 992.0, g_skyBottomColor.w); color = lerp(g_skyBottomColor.rgb, g_skyTopColor.rgb, heightRatio); Now in the above pixel shader code for each pixel the virtual camera eye is directed on, the color value will be calculated with a linear interpolation (x*(1-s) + y*s) between top- and bottom-color. This is done by the HLSL lerp() function. You can now implement a different algorithm for example with smoothstep() functions which calculate a smoother intepolation based on the Hermite Interpolation instead of linear interpolation but this can cause lower framerates if alot of smoothstep's are used.
__________________
-- Vapor-ware is always easier to sell because there's no limit what it can do! |
|
|
|
| Thread Tools | |
| Display Modes | |
|
|
