Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //hlsl ps_1_1
- #include "pixel_program/include/pixel_shader_constants.inc"
- #include "pixel_program/include/functions.inc"
- sampler diffuseMap : register(s0);
- sampler specularMap : register(s1);
- sampler envMap : register(s2);
- float4 main
- (
- in float3 vertexDiffuse : COLOR0,
- in float3 vertexSpecular : COLOR1,
- in float2 tcs_MAIN : TEXCOORD0,
- in float2 tcs_SPEC : TEXCOORD1,
- in float2 tcs_ENVM : TEXCOORD2
- )
- : COLOR
- {
- float4 result;
- // Sample color map and env mask
- float3 diffuseColor;
- float envMask;
- {
- float4 sample = tex2D(diffuseMap, tcs_MAIN);
- diffuseColor = sample.rgb;
- envMask = sample.a;
- }
- float specularMask = tex2D(specularMap, tcs_SPEC).a;
- // sample environment map
- float3 envColor = tex2D(envMap, tcs_ENVM);
- // apply lighting
- float3 diffuseLitSurface = diffuseColor * vertexDiffuse;
- // lerp masked environment back on after lighting and add specular
- result.rgb = lerp(diffuseLitSurface, envColor, envMask) + (vertexSpecular * specularMask);
- result.a = alphaFadeOpacity;
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement