/*Fragment Shader*/
struct vertout
{
float4 HP : POSITION;
float2 UV : TEXCOORD0;
float3 N : TEXCOORD1;
float3 T : TEXCOORD4;
float3 B : TEXCOORD2;
float3 V : TEXCOORD3;
};
float4 main( vertout IN,
uniform float Kr,
uniform float3 coloration,
uniform sampler2D normalMap,
uniform samplerCUBE envMap
) : COLOR
{
float3 NObj = 2.0*tex2D(normalMap, IN.UV).xyz - 1.0;
float3 NWorld = normalize( NObj.x * IN.T + NObj.y * IN.B + NObj.z * IN.N );
float3 refl = reflect(-IN.V, NWorld);
float4 fresnel = texCUBE( envMap, refl.xyz ) * Kr;
fresnel.xyz = fresnel.xyz * coloration;
fresnel.a = 1;
return fresnel;
}
struct vertout
{
float4 HP : POSITION;
float2 UV : TEXCOORD0;
float3 N : TEXCOORD1;
float3 T : TEXCOORD4;
float3 B : TEXCOORD2;
float3 V : TEXCOORD3;
};
float4 main( vertout IN,
uniform float Kr,
uniform float3 coloration,
uniform sampler2D normalMap,
uniform samplerCUBE envMap
) : COLOR
{
float3 NObj = 2.0*tex2D(normalMap, IN.UV).xyz - 1.0;
float3 NWorld = normalize( NObj.x * IN.T + NObj.y * IN.B + NObj.z * IN.N );
float3 refl = reflect(-IN.V, NWorld);
float4 fresnel = texCUBE( envMap, refl.xyz ) * Kr;
fresnel.xyz = fresnel.xyz * coloration;
fresnel.a = 1;
return fresnel;
}
Author: fredzhang
Submitted: 2005-10-05 08:19:56 UTC
Tags:
Software: Maya
Views: 234,695
Related Items
-
Dinning chair and table 3D Model
$20.00 (USD) -
Quick and dirty medium/low res 45. Smith and Wesson handgun 3D Model
$25.00 (USD) -
Quill pen and ink bottle 3D Model
$20.00 (USD) -
Tire and Rim 3D Model
$9.00 (USD) -
Blonde woman in jeans and sweater - aXYZ design - AWom0004-CS / Rigged for 3D Max + Character Studio 3D Model
$49.00 (USD) -
Chairs and Table 3D Model
$30.00 (USD) -
Luxury Home and Grounds 195 3D Model
$100.00 (USD) -
Building Modern Day and Night 216 3D Model
$150.00 (USD) -
Cityscape with Bridge and Water 417 3D Model
$150.00 (USD)