I'd really like to use a shader solution for this since I can't get it working in c-script, my math is just too weak. I found something I think may help.
I was browsing through a games files and ran across a shader that sounded interesting.
Vertex Shader:
Code:
#define maxTextureCoordinate 0
#define vTextureCoordinateSetMAIN vTextureCoordinateSet0
dcl_position0 vPosition
dcl_normal vNormal
//-- transform the normal into world space
m3x3 r0.xyz, vNormal, cObjectWorldMatrix
//-- compute direction to eye
m4x3 r1.xyz, vPosition, cObjectWorldMatrix
sub r2.xyz, cCameraPosition, r1
//-- normalize direction to eye
dp3 r2.w, r2, r2
rsq r2.w, r2.w
mul r2.xyz, r2, r2.w
//-- compute texture coordinates for low angle fade
dp3 oT1.x, r0, r2
mov oT1.y, c0_0
mov oT0, vTextureCoordinateSetMAIN
By the comments, that sounds like just the sort of thing I'm looking for. But I know absolutely nothing when it comes to shaders, so I can't edit it myself or anything, but I figured maybe someone here could make sense of it and write up something I could use. Then again, someone who knows shader asm can see what it's doing, and could probably tell me the c-script alternative. That'd be awesome too! The comments almost tell me enough to write a c-script version, but my math is extremely weak and I just don't know how to use the vec_* commands well enough to do what it says it's doing.
Anyway, there is also a pixel shader that goes with it, but the file appears to be corrupt so I'm not sure if any important parts are missing:
Pixel Shader:
Code:
// sample diffuse texture map
tex t0
tex t1
//fade at low angles
mul r0, r0, t1.a // *corrupt looking text here that wont paste*
I don't know if thats of any use to you guys, but if it is, I would be VERY grateful if someone could put it together for me. My nebula's would look so much better if I could eliminate the sharp hard looking effect you get when looking at a sprite from the 'side'.