Tesi Robotica V+ Sim: Interprete Command Language e... | Page 106

// Calculate lighting outVertex.LightDiffuse = Ambient + LightColor * max(0, dot(-LightDirection, normal)); return outVertex; } float4 PixelShader(float3 lightDiffuse : COLOR0, float4 texCoord : TEXCOORD0) : COLOR { // Look up the base color and blend amount float4 diffuse = tex2D(DiffuseSampler, texCoord); // Blend the base color with the target color by the amount of the diffuse alpha float3 color = lerp(diffuse.rgb, TargetColor, diffuse.a); // Apply lighting color *= lightDiffuse; // Always return a full opaque color return float4(color, 1); } technique Viper { pass p0 { 105