Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualMedo3337

Posted 17 July 2013 - 03:45 PM

Okay, so I have the following Pixel Shader for terrain texturing, unfortunately, it seems that I can't apply another shader (light shader) using LPD3DXEFFECT.

 

How do I apply effect file (light.fx) to the terrain as well for light?

ps_1_4

////////////////////////////////
// r0: alphamaps
// r1 - r4: textures
// r5: detail map
////////////////////////////////

// Sample textures
texld r0, t0 // scale 1
texld r1, t1 // scale 2
texld r2, t2 // scale 2
texld r3, t3 // scale 2
texld r4, t4 // scale 2
texld r5, t5 // scale 16

mul r1, r1, r0.x // multiply 1st tex with blendmap (red channel) and store result in 1st
lrp r2, r0.y, r2, r1 // lerp 2nd with 1st (blendmap green channel as factor) and store in 2nd
lrp r3, r0.z, r3, r2 // lerp 3rd with 2nd (blendmap blue channel as factor) and store in 3rd
lrp r0, r0.w, r4, r3 // lerp 4th with 3rd (blendmap alpha channel as factor) and store result in blendmap
mul r0, r5, r0 // multiply detail...

 


#1Medo3337

Posted 17 July 2013 - 03:43 PM

Okay, so I have the following Pixel Shader for terrain texturing, unfortunately, it seems that I can't apply light shader using LPD3DXEFFECT.

 

How do I apply effect file to the terrain as well for light?

ps_1_4

////////////////////////////////
// r0: alphamaps
// r1 - r4: textures
// r5: detail map
////////////////////////////////

// Sample textures
texld r0, t0 // scale 1
texld r1, t1 // scale 2
texld r2, t2 // scale 2
texld r3, t3 // scale 2
texld r4, t4 // scale 2
texld r5, t5 // scale 16

mul r1, r1, r0.x // multiply 1st tex with blendmap (red channel) and store result in 1st
lrp r2, r0.y, r2, r1 // lerp 2nd with 1st (blendmap green channel as factor) and store in 2nd
lrp r3, r0.z, r3, r2 // lerp 3rd with 2nd (blendmap blue channel as factor) and store in 3rd
lrp r0, r0.w, r4, r3 // lerp 4th with 3rd (blendmap alpha channel as factor) and store result in blendmap
mul r0, r5, r0 // multiply detail...

 


PARTNERS