Sign in to follow this  
Burz666

Different resolt (Shader using) on ATI and NVIDIA

Recommended Posts

Burz666    100
The Same shader gives different results on ATI and NVIDIA GPUs. float4x4 view_proj_matrix : ViewProjection; float4 view_position : ViewPosition; struct VS_OUTPUT { float4 Pos: POSITION; float3 normal: TEXCOORD0; float3 viewVec: TEXCOORD1; }; VS_OUTPUT Glass_Effect_Group_ComplexGlass_Object_Vertex_Shader_main(float4 Pos: POSITION, float3 normal: NORMAL) { VS_OUTPUT Out; Out.Pos = mul(view_proj_matrix, Pos); Out.normal = normal; Out.viewVec = view_position - Pos; return Out; } float refractionScale = float( 1.0 ); float4 baseColor = float4( 0.72, 0.70, 0.76, 1.00 ); float ambient = float( 0.20 ); float indexOfRefractionRatio = float( 0.14 ); float reflectionScale = float( 1.0 ); texture Snow_Environment_Tex; sampler Environment = sampler_state { Texture = (Snow_Environment_Tex); ADDRESSU = CLAMP; ADDRESSV = CLAMP; MAGFILTER = LINEAR; MINFILTER = LINEAR; MIPFILTER = LINEAR; }; sampler Rainbow; float4 Glass_Effect_Group_ComplexGlass_Object_Pixel_Shader_main(float3 normal: TEXCOORD0, float3 viewVec: TEXCOORD1) : COLOR { normal = normalize(normal); viewVec = normalize(viewVec); float3 reflVec = reflect(-viewVec, normal); float4 reflection = texCUBE(Environment, reflVec.xyz); float cosine = dot(viewVec, normal); float sine = sqrt(1 - cosine * cosine); float sine2 = saturate(indexOfRefractionRatio * sine); float cosine2 = sqrt(1 - sine2 * sine2); float3 x = -normal; float3 y = normalize(cross(cross(viewVec, normal), normal)); float3 refrVec = x * cosine2 + y * sine2; float4 refraction = texCUBE( Environment,refrVec.xyz); float4 refl = reflectionScale * reflection; float4 refr = refractionScale * refraction * baseColor; return sine * refl + (1 - sine2) * refr + sine2 * ambient; } //--------------------------------------------------------------// // Technique Section for Glass Effect Group //--------------------------------------------------------------// technique ComplexGlass { pass Object { ZENABLE = TRUE; CULLMODE = CCW; VertexShader = compile vs_2_0 Glass_Effect_Group_ComplexGlass_Object_Vertex_Shader_main(); PixelShader = compile ps_2_0 Glass_Effect_Group_ComplexGlass_Object_Pixel_Shader_main(); } } Nvidia result: http://www.gamedev.ru/images/?id=30781 ATI result: http://www.gamedev.ru/images/?id=30782

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this