Halo glow. help a nubie

Posted By: r00tsh3ll

Halo glow. help a nubie - 07/28/04 06:27

Hi,
I have this (old but working ) glow shader.
I was wandering if someone is willing to tudor me how to rewrite it for GS.
Any help typed here is wellcomed. Please talk to me like Im 3 years old since shaders are really strangers to me.

Here is teh shader:

Code:
 #include "Constants.h"

// v0 -- position
// v1 -- normal
// CV_SCALING = (edgesize, 0.0f, 0.0f, 0.0f)

vs.1.0

mul r4, v1, c[CV_SCALING].xxxy
add r4, v0, r4

// transform position
dp4 oPos.x, r4, c[CV_WORLDVIEWPROJ_0]
dp4 oPos.y, r4, c[CV_WORLDVIEWPROJ_1]
dp4 oPos.z, r4, c[CV_WORLDVIEWPROJ_2]
dp4 oPos.w, r4, c[CV_WORLDVIEWPROJ_3]

// transform normal
dp3 r0.x, v1, c[CV_WORLD_IT_0]
dp3 r0.y, v1, c[CV_WORLD_IT_1]
dp3 r0.z, v1, c[CV_WORLD_IT_2]

// normalize normal
dp3 r0.w, r0, r0
rsq r0.w, r0.w
mul r0, r0, r0.w

// compute world space position
dp4 r1.x, r4, c[CV_WORLD_0]
dp4 r1.y, r4, c[CV_WORLD_1]
dp4 r1.z, r4, c[CV_WORLD_2]

// vector from point to eye
add r2.xyz, c[CV_EYE], -r1

// normalize e
dp3 r2.w, r2, r2
rsq r2.w, r2.w
mul r2, r2, r2.w

//alpha value
dp3 oD0.w, r0, r2
mov oD0.xyz, c[CV_COLOR]



constants file:

Code:
 #define CV_WORLDVIEWPROJ_0 0
#define CV_WORLDVIEWPROJ_1 1
#define CV_WORLDVIEWPROJ_2 2
#define CV_WORLDVIEWPROJ_3 3

#define CV_LIGHT_DIRECTION 4

#define CV_WORLD_IT_0 5
#define CV_WORLD_IT_1 6
#define CV_WORLD_IT_2 7
#define CV_WORLD_IT_3 8

#define CV_CONSTANTS 9

#define CV_EYE 10

#define CV_WORLD_0 11
#define CV_WORLD_1 12
#define CV_WORLD_2 13
#define CV_WORLD_3 14

#define CV_SCALING 15
#define CV_COLOR 16



its from nvidia effectsBrowser.
Posted By: Buluen

Re: Halo glow. help a nubie - 07/28/04 10:28

so is the shader like a glow as on geometry (bump ,env mapping?) or like the glow from the sun ?
Posted By: MMike

Re: Halo glow. help a nubie - 07/28/04 10:42

if its like sun ..it woul be very useful.. i love that halo sun effect...
Posted By: Bird

Re: Halo glow. help a nubie - 07/29/04 01:50

can you post a picture? amt i can't try the code self, because i'm in holiday!
© 2024 lite-C Forums