#include "def_effect.fx" VSOBJ_NOLIGHT_OUTPUT SkyBox_VS( VSOBJ_INPUT In ) { VSOBJ_NOLIGHT_OUTPUT Out = (VSOBJ_NOLIGHT_OUTPUT) 0; float4 pos = In.position; float3 normal = In.normal; float4 color = In.diffuse; float4 output_pos, pos_world; int b_index = 0; // transform position to screen space before changing it. pos_world = mul( pos, blendMatrices[b_index] ); output_pos = mul( pos_world, view_proj_matrix ); Out.position = output_pos; //apply fog //float distfog = saturate((fFogDistEnd - output_pos.z)/(fFogDistEnd - fFogDistStart)); //float heightfog = saturate((fFogHeightEnd - pos_world.z)/(fFogHeightEnd - fFogHeightStart)); Out.fog = 1;//min(distfog, heightfog); //float3 N = normalize(mul(normal, (float3x3)blendMatrices[b_index])); // normal (view space) //float nLength = length(Light_position - pos_world); //float3 L = normalize(Light_position - pos_world); //float Atten = 1/(1+Light_ambient.a*nLength); // eye-baseÀÇ half-way º¤ÅÍ //float3 light_vector = -Light_direction_forsp; //float3 eye_vector = Camera_position - pos_world; //float3 halfway = normalize(normalize(light_vector) + normalize(eye_vector)); float fValue = (pos_world.z-fSky_Min_height)/(fSky_Max_height-fSky_Min_height); fValue = saturate( fValue ); Out.diffuse = Sky_Light_High * fValue + Sky_Light_Low * (1-fValue);// * ddot * Atten + Light_specular * pow(dotval, 7); // diffuse + ambient Out.diffuse.a = 1; Out.texCoord = In.texCoord; return Out; } VSCLOUD_OUTPUT CloudSpread_VS( VSCLOUD_INPUT In ) { VSOBJ_NOLIGHT_OUTPUT Out = (VSCLOUD_OUTPUT) 0; float4 pos = In.position; float3 normal = In.normal; float4 color = In.diffuse; float4 output_pos, pos_world; int b_index = 0; pos_world = mul( pos, blendMatrices[b_index] ); // pos_world = pos; float dVal = length(float2(pos_world.x, pos_world.y) - float2(CloudSpread_Center.x, CloudSpread_Center.y)); dVal = pow(saturate((CloudSpread_CornerDistance - dVal)/CloudSpread_CornerDistance), 2); pos_world.z -= (1-dVal)*CloudSpread_BalanceHeight; //pos_world.z -= (dVal)*CloudSpread_BalanceHeight; // transform position to screen space before changing it. output_pos = mul( pos_world, view_proj_matrix ); Out.position = output_pos; //apply fog //float distfog = saturate((fFogDistEnd - output_pos.z)/(fFogDistEnd - fFogDistStart)); //float heightfog = saturate((fFogHeightEnd - pos_world.z)/(fFogHeightEnd - fFogHeightStart)); Out.fog = 1;//min(distfog, heightfog); //float3 N = normalize(mul(normal, (float3x3)blendMatrices[b_index])); // normal (view space) //float nLength = length(Light_position - pos_world); //float3 L = normalize(Light_position - pos_world); //float Atten = 1/(1+Light_ambient.a*nLength); // eye-baseÀÇ half-way º¤ÅÍ //float3 light_vector = -Light_direction_forsp; //float3 eye_vector = Camera_position - pos_world; //float3 halfway = normalize(normalize(light_vector) + normalize(eye_vector)); //float ddot = saturate(dot(N, L)); //float sdot = saturate(dot(N, halfway)); //Out.diffuse = colorLight_ambient + max(Light_diffuse * ddot * Atten, Light_specular * pow(sdot, 7)); // diffuse + ambient //Out.diffuse.a = fVisibility; float fValue = (pos_world.z-fSky_Min_height)/(fSky_Max_height-fSky_Min_height); fValue = saturate( fValue ); float4 output_color = Sky_Light_High * fValue + Sky_Light_Low * (1-fValue); Out.diffuse = (1 - fVisibility)*output_color + fVisibility*color; // diffuse + ambient Out.diffuse.a = color.a/255; Out.texCoord1 = In.texCoord1; // [sonador] //Out.texCoord2 = In.texCoord2; // [sonador] //float heightturm = (pos_world.z - fTerrainTextureCenter.z); //float4 litproj = heightturm*float4(L.x, L.y, L.z, L.z);///L.z; //Out.texCoord2 = fTerrain1stTextureScale * (pos_world - fTerrainTextureCenter - litproj); //heightturm = (pos_world.z - fTerrainTextureCenterDusk.z); //litproj = heightturm*float4(L.x, L.y, L.z, L.z);///L.z; //Out.texCoord3 = fTerrain2ndTextureScale * (pos_world - fTerrainTextureCenterDusk - litproj); return Out; } technique SkyBox_Tech { pass P0 { VertexShader = compile vs_1_1 SkyBox_VS(); PixelShader = NULL; } } technique CloudSpread_Tech { pass P0 { VertexShader = compile vs_1_1 CloudSpread_VS(); PixelShader = NULL; } }