Sign in to follow this  
david w

asm cloud shader

Recommended Posts

I have this asm cloud shader and if it were hlsl I wouldn't be having such as problem. The shader works as expected, the problem is the output is to dim. Its not bright enough. I was wondering if anyone could have a look at the pixel shader part and see where I am going wrong. I need to output a brighter image.

[font="Consolas"][size="2"][font="Consolas"][size="2"]//--------------------------------------------------------------//

// Pixel Shader

//--------------------------------------------------------------//

PixelShader Atmospheric_Effects_CloudsEffect_ASM_Single_Pass_Pixel_Shader_ = asm

{

ps.1.4

def c0, 0.0f, 1.5f, 1.0f, 2.0f
def c1, -0.157f, 0.13f, 0.0f, 0.02f
def c2, 0.525f, 0.421f, 0.712f, 0.698f
def c3, 0.05f, -0.085f, 0.0f, 0.02f
def c4, 0.293f, 0.231f, 0.795f, 0.348f
def c5, 0.871f, 0.532f, 0.0863f, 0.77f

texld r0, t1
texld r1, t1
texcrd r2.rgb, t0
texcrd r3.rgb, t2


mad r0.rgb, c1, r0_bx2, r2 ; perturb base map coords by cloud coords
mad r1.rgb, c3, r1_bx2, r3 ; perturb base map coords by cloud coords
phase

texld r0, r0
texld r1, r1
texld r2, t4


mov_x2 r3.rgb, r2.a ; alpha of horizon (glow map)
+mul_sat r3.a, 1-r0.a, 1-r1.a ; mask edges for cloud glow

mad_sat r0.rgb, 1-r0.a, c2, c2.a ; scale and bias inverted clouds layer 0
+mov_x2_sat r0.a, r0.a ; boost cloud alpha 0

mad_sat r1.rgb, 1-r1.a, c4, c4.a ; scale and bias inverted clouds layer 1
+mov_x2_sat r1.a, r1.a ; boost cloud alpha 1

lrp r0.rgb, r1.a, r1, r0 ; combine cloud layers
+mov r4.a, c5.a ; ...

mul_x2 r3, r3.a, r3 ; multiply glow by edges of clouds
mad_x2 r3, r3, c5, r4.a ; scale and bias glowing sections of clouds

mul r0.rgb, r3, r0 ; multiply glow by combination of cloud layers
+add_d2_sat r0.a, r0.a, r1.a ; add alphas of cloud layers

lrp_sat r0, r0.a, r0, r2 ; lerp between clouds and horizon

};





Thanks for any help.

[/size][/font][/size][/font]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this