Hey look, everybody's favourite Ninja is back!
So, after digging through the forums/internet for a nice way of doing a stroke, I decided that the only ways I was seeing to do it nice would be too long to render and ended up finding that PrestonC made a cel shader that did a very quick way of making the stroke...very slight modification and it gives me about the effect I'm looking for. Thank you PrestonC!
Now, on to the next shader I'd like to try using. RenderMonkey has an excellent sky effect called CloudsEffect_ASM. Here it is:
//**************************************************************//
// Effect File exported by RenderMonkey 1.6
//
// - Although many improvements were made to RenderMonkey FX
// file export, there are still situations that may cause
// compilation problems once the file is exported, such as
// occasional naming conflicts for methods, since FX format
// does not support any notions of name spaces. You need to
// try to create workspaces in such a way as to minimize
// potential naming conflicts on export.
//
// - Note that to minimize resulting name collisions in the FX
// file, RenderMonkey will mangle names for passes, shaders
// and function names as necessary to reduce name conflicts.
//**************************************************************//
//--------------------------------------------------------------//
// Atmospheric Effects
//--------------------------------------------------------------//
//--------------------------------------------------------------//
// CloudsEffect_ASM
//--------------------------------------------------------------//
//--------------------------------------------------------------//
// Single Pass
//--------------------------------------------------------------//
string Atmospheric_Effects_CloudsEffect_ASM_Single_Pass_Screen_Aligned_Quad : ModelData = "../../../Program Files/ATI Research Inc/RenderMonkey 1.6/Examples/Media/Models/ScreenAlignedQuad.3ds";
//--------------------------------------------------------------//
// Vertex Shader
//--------------------------------------------------------------//
VertexShader Atmospheric_Effects_CloudsEffect_ASM_Single_Pass_Vertex_Shader_ = asm
{
vs.1.1
dcl_position v0
dcl_normal v1
dcl_texcoord v2
mov r0, v0 // align the quad with the screen
mov r0.w, c0.z
mov r0.z, c0.x
mov oPos, r0
mov r4, v2 // output base tex coord
mov oT4, r4
mov r0, c1.xxxx // (time*cloud0vel)
mul r1, c9.xyxy, r0
mul r2, c9.zwzw, r0 // (time*cloud0disvel)
mad oT0, r4.yx, c10.xyxy, r1.xy
mad oT1, r4.yx, c10.zwzw, r2.xy
mul r1, c11.xyxy, r0 // (time*cloud1vel)
mul r2, c11.zwzw, r0 // (time*cloud1disvel)
mad oT2, r4.yx, c12.xyxy, r1.xy
mad oT3, r4.yx, c12.zwzw, r2.xy
};
//--------------------------------------------------------------//
// Pixel Shader
//--------------------------------------------------------------//
PixelShader Atmospheric_Effects_CloudsEffect_ASM_Single_Pass_Pixel_Shader_ = asm
{
ps.1.4
texld r0, t1
texld r1, t3
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
};
//--------------------------------------------------------------//
// Technique Section for Atmospheric Effects
//--------------------------------------------------------------//
technique CloudsEffect_ASM
{
pass Single_Pass
{
ZENABLE = TRUE;
FILLMODE = SOLID;
SHADEMODE = GOURAUD;
ZWRITEENABLE = TRUE;
ALPHATESTENABLE = FALSE;
LASTPIXEL = TRUE;
SRCBLEND = ONE;
DESTBLEND = ZERO;
CULLMODE = NONE;
ALPHAREF = 0x0;
ALPHAFUNC = LESS;
DITHERENABLE = FALSE;
ALPHABLENDENABLE = FALSE;
FOGENABLE = FALSE;
SPECULARENABLE = FALSE;
FOGCOLOR = 0xFFFFFFFF;
FOGTABLEMODE = NONE;
FOGSTART = 0.000000;
FOGEND = 0.000000;
FOGDENSITY = 0.000000;
STENCILENABLE = FALSE;
STENCILFAIL = KEEP;
STENCILZFAIL = KEEP;
STENCILPASS = KEEP;
STENCILFUNC = ALWAYS;
STENCILREF = 0x0;
STENCILMASK = 0xffffffff;
STENCILWRITEMASK = 0xffffffff;
TEXTUREFACTOR = 0x0;
WRAP0 = 0;
WRAP1 = 0;
WRAP2 = 0;
WRAP3 = 0;
WRAP4 = 0;
WRAP5 = 0;
WRAP6 = 0;
WRAP7 = 0;
CLIPPING = FALSE;
LIGHTING = FALSE;
AMBIENT = 0x11111111;
FOGVERTEXMODE = NONE;
COLORVERTEX = TRUE;
LOCALVIEWER = TRUE;
NORMALIZENORMALS = FALSE;
DIFFUSEMATERIALSOURCE = COLOR1;
SPECULARMATERIALSOURCE = COLOR2;
AMBIENTMATERIALSOURCE = COLOR2;
EMISSIVEMATERIALSOURCE = COLOR2;
VERTEXBLEND = DISABLE;
CLIPPLANEENABLE = 0;
POINTSIZE = 0.000000;
POINTSIZE_MIN = 0.000000;
POINTSPRITEENABLE = FALSE;
POINTSCALEENABLE = FALSE;
POINTSCALE_A = 0.000000;
POINTSCALE_B = 0.000000;
POINTSCALE_C = 0.000000;
MULTISAMPLEANTIALIAS = TRUE;
MULTISAMPLEMASK = 0xffffffff;
COLORWRITEENABLE = RED | GREEN | BLUE | ALPHA;
TWEENFACTOR = 0.000000;
BLENDOP = ADD;
POSITIONDEGREE = CUBIC;
NORMALDEGREE = LINEAR;
ZFUNC = ALWAYS;
VertexShader = (Atmospheric_Effects_CloudsEffect_ASM_Single_Pass_Vertex_Shader_);
PixelShader = (Atmospheric_Effects_CloudsEffect_ASM_Single_Pass_Pixel_Shader_);
}
}
Now, there's probably multiple issues with getting this one working in DBPro easily, but the one thing that it seems was an issue was the object itself. I tried converting the object into a .X and telling it where to load it, doing a checklist for effect values would usually give a 0, but after the changes it gave a 1. But it made the object completely disappear. Since this one seems to be locking itself to the camera, I don't really know if I should see the object at all when the shader is applied. One way or another, does anyone know how to make this shader work in DBPro? I'm trying to learn about shaders, so if you can explain why it wasn't working as well, that would be great.