summaryrefslogtreecommitdiff
path: root/materialsystem/stdshaders/BumpmappedLightmap_OverBright2.psh
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /materialsystem/stdshaders/BumpmappedLightmap_OverBright2.psh
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'materialsystem/stdshaders/BumpmappedLightmap_OverBright2.psh')
-rw-r--r--materialsystem/stdshaders/BumpmappedLightmap_OverBright2.psh43
1 files changed, 43 insertions, 0 deletions
diff --git a/materialsystem/stdshaders/BumpmappedLightmap_OverBright2.psh b/materialsystem/stdshaders/BumpmappedLightmap_OverBright2.psh
new file mode 100644
index 0000000..29d9192
--- /dev/null
+++ b/materialsystem/stdshaders/BumpmappedLightmap_OverBright2.psh
@@ -0,0 +1,43 @@
+ps.1.1
+
+;------------------------------------------------------------------------------
+; Computes the diffuse component of lighting using lightmap + bumpmap
+; t0 - Normalmap
+; t1 - Lightmap1
+; t2 - Lightmap2
+; t3 - Lightmap3
+;
+; The texture coordinates need to be defined as follows:
+; tc0 - Normalmap and lightmap texture coordinates
+; c0, c1, c2 - Axes of the lightmap coordinate system in tangent space
+; c3 = a
+; c4 = b
+; c5 = c in a quadratic approx to pow( 1/2.2 )
+;------------------------------------------------------------------------------
+
+; Get the 3-vector from the normal map
+tex t0
+
+; Sample the lightmaps
+tex t1
+tex t2
+tex t3
+
+; Compute the dot product of axis 1 and the normal
+dp3_sat r1, t0_bx2, c0
+; Modulate the lightmap color by N dot Axis 1
+mul r0, t1, r1
+
+; Do the same for the other two axes
+dp3_sat r1, t0_bx2, c1
+mad r0, r1, t2, r0
+
+dp3_sat r1, t0_bx2, c2
+mad r0, r1, t3, r0
+
+; Do quadratic approximation to pow( x, 1 / 2.2 )
+;mad r1, c3, r0, c4 ; r1 = a*x + b
+;mad_x2_sat r0, r1, r0, c5 ; r0 = r1*x + c = a*x*x + b*x + c
+
+
+