ps.1.4

texld    r0,     t0                  // Read from microflake noise map to get perturbed normals
texld    r1,     t1                  // Environment map reflection vector lookup ( for the gloss coat)
texcrd   r3.rgb, t2                  // Inverse tangent space base vector 0 ( tan X )
texcrd   r4.rgb, t3                  // Inverse tangent space base vector 1 ( tan Y )
texcrd   r5.rgb, t4                  // Inverse tangent space base vector 2 ( ten Z )
texcrd   r2.rgb, t5                  // The view vector 

lrp      r0.rgb, c5.a, r0_bx2, c5    // Increase the microflake perturbed normal a bit

mul      r3.rgb, r0.r, r3         
mad      r3.rgb, r0.g, r4, r3
mad      r3.rgb, r0.b, r5, r3        // Convert the perturbed normal from 
dp3_sat  r4, r2, r3                  // Nbw.Vw

mad      r3.rgb, r3_x2, r4, -r2      // Compute Rw = 2N(V.N)-V

mul_x8   r1.rgb, r1, r1.a            // Brighten  up the luminosity by 8
mov      r5, r1

phase
texld    r0, t0                      // Load the second microflake normal from the microflake                       
texld    r1, r3                      // noise map to simulate second layer of metallic flakes

mul_sat   r1.rgb, r1, r1.a           // Increase the 2nd microflake layer normal 
+mad_sat  r0.a, 1-v0.b, 1-v0.b, c1.a // Compute (1-N.V)^2

lrp       r4.rgb, c3, r4, v0.b       // Simulate color scattering
mul       r4.rgb, r4_x2, c4          // Combine resulting color with base color
mul       r1.rgb, r1, r0             // Add microflakes color 
mad       r1.rgb, r1, r5, r4         // Combine sparkles with base color gradient
lrp       r0.rgb, r0.a, r5, r1       // Add reflections from the environment map

mul       r0.a, r1.a, c2.a          // Final color composite

