Files
Client/GameTools/WORLDCREATOR/Shader/Dot3x2EmbMap_SrcAlpha.psh
LGram16 dd97ddec92 Restructure repository to include all source folders
Move git root from Client/ to src/ to track all source code:
- Client: Game client source (moved to Client/Client/)
- Server: Game server source
- GameTools: Development tools
- CryptoSource: Encryption utilities
- database: Database scripts
- Script: Game scripts
- rylCoder_16.02.2008_src: Legacy coder tools
- GMFont, Game: Additional resources

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 20:17:20 +09:00

68 lines
1.4 KiB
Plaintext

// Declare pixel shader version
ps.1.1
// Define c[PCN_RED_MASK] as RGBA = (scale, 0, 0, 0)
// Where scale [0,1] is applied to reduce the magnitude
// of the s axis component of the normal.
// Define c[PCN_GREEN_MASK] similarly to affect the
// t axis component
// blue mask for r axis component (blue = up out of texture)
//@@def c4, 0.0, 0.0, 1.0, 1.0
def c2, 0.5, 0.5, 0.0, 0.0
def c1, 1.0, 1.0, 0.0, 0.0
def c3, 0.0, 0.0, 1.0, 0.0
// Get colors from all 4 texture stages
// These are the neighbor samples used to calculate slopes
// for the surface displacements
// t0 = -s, 0
// t1 = +s, 0
// t2 = 0, +t
// t3 = 0, -t
tex t0
tex t1
tex t2
tex t3
// Source height from texture alpha! This is to allow for packing
// other data into the .rgb fields.
sub_x4 r0.a, t0, t1 // (t0 - t1)*4 : 4 for higher scale
mul t0.rgb, r0.a, c[5] // t0 = s result in red only
+ sub_x4 r1.a, t3, t2 // r1 = t result in alpha
mad r0, r1.a, c[6], t0 // r0 = red,green for s and t result
//////
//@@@@@ the red and green masks may scale down the displacements.
// they are subsequently scaled up below. This looses precision, so
// this should be re-coded to use mask values of 1.0 and scale
// the result after.
////////////////////////////////
// increase scale
// bases displacement about center 0.5 0.5
add_x2 r0, r0, r0
add r0, r0, c2 // bias red,green to 0.5
add r0, r0, c3 // add blue = 1.0