|
Re: Slin's Water Shader
[Re: Steempipe]
#179578
01/25/08 00:35
01/25/08 00:35
|
Joined: Nov 2007
Posts: 1,143 United Kingdom
DJBMASTER
OP
Serious User
|
OP
Serious User
Joined: Nov 2007
Posts: 1,143
United Kingdom
|
K, tried it in the action >> no luck, lol...
Ok, well it seems the only way i'm going to solve this is to learn part of FFP shaders. Am i on the right tracks>>>???
Texture mtlSkin2; Texture[2] = <mtlSkin2>; TexCoordIndex[2] = 1;
ColorOp[2] = Add; // add the .tga alpha map to the shader ColorArg1[2] = Texture; ColorArg2[2] = Current;
TextureTransformFlags[2] = count3 | projected; TextureTransform[2] = { 0.8, 0.0, 0.0, 0.0, // u-scale of alpha 0.0, 1.0, 0.0, 0.0, // v-scale of alpha 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 };
Then in my material WDL I define a BMAP>>
bmap alphamap = "bm_alpha.tga";
and add skin2=alphamap; to my material.
Any errors or code i should be aware of?
Thanks
Last edited by DJBMASTER; 01/25/08 00:36.
|
|
|
Re: Slin's Water Shader
[Re: DJBMASTER]
#179580
02/02/08 13:01
02/02/08 13:01
|
Joined: Dec 2003
Posts: 1,097 Maryland, USA
Steempipe
Serious User
|
Serious User
Joined: Dec 2003
Posts: 1,097
Maryland, USA
|
Hi, I'm lazy . so could you PM me a link to a build with just your water portion?? I'll see what I can do for you.
|
|
|
Re: Slin's Water Shader
[Re: Steempipe]
#179581
02/02/08 19:21
02/02/08 19:21
|
Joined: Jan 2006
Posts: 2,157 Connecticut, USA
Blink
Expert
|
Expert
Joined: Jan 2006
Posts: 2,157
Connecticut, USA
|
Steempipe, you are truly a master at water shaders, slin is awesome as well. can you help me understand how to get them to work? i cant use r2t for some reason. what should i be using? my card supports shader model 2.0.
My Famous Quotes: "Hip hop is like a virus, infecting everyone and everything around it. Every form of media has some way,shape or form, assimilated hip hop into it." It has also mutated into other strains like, trip hop, house, rap, gangster, and conscious forms. Once you are infected with it, its with you for life."
|
|
|
Re: Slin's Water Shader
[Re: Blink]
#179582
02/04/08 22:18
02/04/08 22:18
|
Joined: Dec 2003
Posts: 1,097 Maryland, USA
Steempipe
Serious User
|
Serious User
Joined: Dec 2003
Posts: 1,097
Maryland, USA
|
Quote:
Steempipe, you are truly a master at water shaders, slin is awesome as well. can you help me understand how to get them to work? i cant use r2t for some reason. what should i be using? my card supports shader model 2.0.
Funny thing is this: The DLL does not seem to render correctly on my setup as well. At least not with the "water for everyone" level. I'll have to spend a bit more time with this. Hmmmm.
|
|
|
Re: Slin's Water Shader
[Re: Steempipe]
#179583
02/05/08 02:16
02/05/08 02:16
|
Joined: Jan 2006
Posts: 2,157 Connecticut, USA
Blink
Expert
|
Expert
Joined: Jan 2006
Posts: 2,157
Connecticut, USA
|
which one do you recommend for water shaders? sylex opens for me, but my ocean is huge, i always get a size error, and the shader wont work.
My Famous Quotes: "Hip hop is like a virus, infecting everyone and everything around it. Every form of media has some way,shape or form, assimilated hip hop into it." It has also mutated into other strains like, trip hop, house, rap, gangster, and conscious forms. Once you are infected with it, its with you for life."
|
|
|
Re: Slin's Water Shader
[Re: Blink]
#179584
02/06/08 09:44
02/06/08 09:44
|
Joined: Jul 2004
Posts: 4,206 Innsbruck, Austria
sPlKe
Expert
|
Expert
Joined: Jul 2004
Posts: 4,206
Innsbruck, Austria
|
i got it to run. here is the fx file code and the shader.wdl code: FX file Code:
//////////////////////////////////////////////////////// // Environment Mapping Bump Mapping Water // // Version 2 // // Eric Hendrickson-Lambert (Steempipe) // ////////////////////////////////////////////////////////
matrix matMtl; texture mtlSkin1; texture mtlSkin2;
technique makewater2 { pass p0 { AlphaBlendEnable=true; Zenable = True; ZwriteEnable = True;
BlendOp=Add; Lighting=True;
Texture[0] = <mtlSkin1>; Texture[1] = <mtlSkin2>; magFilter[0] = linear; minFilter[0] = linear; mipFilter[0] = linear; COLOROP[0] = BumpEnvMap; COLORARG1[0] = Texture; COLORARG2[0] = Current; TexCoordIndex[0] = 1; TextureTransformFlags[0] = Count2; TextureTransform[0] = <matMtl>; magFilter[1] = Linear; minFilter[1] = Linear; mipFilter[1] = Linear; AddressU[1] = Clamp; AddressV[1] = Clamp; ColorOp[1] = Modulate; //Modulate/AddSigned/Modulate2x/Modulate4x/Add <----------This looks all okay ColorArg1[1] = Texture; ColorArg2[1] = Current; texcoordindex[1] = cameraspaceposition | 1; // For cubemap use: cameraspacereflectionvector TextureTransformFlags[1] = count3 | projected; TextureTransform[1] = { 0.8, 0.0, 0.0, 0.0,//u-scale of lake rgb texture CHANGE THIS TO YOUR NEEDS! 0.0, 1.0, 0.0, 0.0,//v-scale of lake rgb texture CHANGE THIS TO YOUR NEEDS! 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 }; } }
//technique fallback { pass p0 { } } shader.wdl Code:
//use Render2Texture Dll by ChrisB plugindir "Plugins"; dllfunction r2T_eventSky(); dllfunction r2T_eventEntities(); render_sky = r2T_eventSky; render_entities = r2T_eventEntities; //
bmap waterbump = <waves2.tga>; //bmap envspec = <sky.tga>;
function mtl_ffpwater_event();
material mtl_ffpwater { skin1=waterbump; // skin2=envspec;
event = mtl_ffpwater_event; effect = "water.fx"; }
function mtl_ffpwater_event() { while(1) { //Lets make it scroll in some direction mtl_ffpwater.skill1 += 0.3*time_step; //Move the water along the x axis with the given speed mtl_ffpwater.skill2 += 0.1*time_step; //Move the water along the y axis with the given speed mtl_ffpwater.matrix31 = floatd(sin(mtl_ffpwater.skill1)*100000,40000); mtl_ffpwater.matrix32 = floatd(cos(mtl_ffpwater.skill2)*100000,40000); wait(1); } }
VIEW view_mirror { layer = -1; }; // render mirror view before camera view BMAP* bmap_mirrortarget; //panel rtt{flags = visible;} var water_height;
function fx_mirror() { // do nothing if mirror is already running if (bmap_mirrortarget) { return; }
bmap_mirrortarget = bmap_createblack(512,512,888); mtl_ffpwater.skin2 = bmap_mirrortarget; view_mirror.bmap = bmap_mirrortarget; view_mirror.size_x = bmap_width(bmap_mirrortarget); view_mirror.size_y = bmap_height(bmap_mirrortarget); // rtt.bmap = bmap_mirrortarget; // vec_set(view_mirror.portal_x,my.x); // vec_add(view_mirror.portal_x,vector(0,0,0)); // vec_set(view_mirror.pnormal_x,vector(0,0,1.0)); // reflect upwards // view_mirror.portalclip = on; // clip at portal plane
view_mirror.noshadow = on; // suppress shadows in the mirror // view_mirror.nocull = on; // view through walls view_mirror.noparticle = on; // view_mirror.noshader = on; view_mirror.visible = on;
while (bmap_mirrortarget) { proc_late(); // camera must be moved and mtlfx_mirrorvisible set before // view_mirror.aspect = 1;//1024/768; // screen aspect, independent of render target view_mirror.arc = camera.arc; view_mirror.fog_start = camera.fog_start; view_mirror.fog_end = camera.fog_end; view_mirror.clip_far = camera.clip_far; view_mirror.clip_near = camera.clip_near; view_mirror.x = camera.x; view_mirror.y = camera.y; view_mirror.z = 2*water_height-camera.z;//view_mirror.portal_z-camera.z; // move the camera at its mirror position view_mirror.pan = camera.pan; view_mirror.tilt = -camera.tilt; // flip the vertical camera angle view_mirror.roll = -camera.roll; wait(1); } }
action Water { water_height=my.z; mtl_ffpwater.matrix11 = float(100); //Tilefactor of the Bumpmap in x direction mtl_ffpwater.matrix22 = float(10); //Tilefactor of the Bumpmap in y direction
bmap_to_mipmap(mtl_ffpwater.skin1); // bmap_to_mipmap(mtl_ffpwater.skin2); my.transparent=on; my.alpha=50; my.material = mtl_ffpwater; } i testd it with skinc and it works flawlessy, however i dont know how it reacts if you change any value. i tested it with ym A6.com and render to texture plugin and it works fine, so i think it should work with any other version above A6.60 com... hope that helps, if not, i am sorry
|
|
|
Re: Slin's Water Shader
[Re: xXxGuitar511]
#179585
02/09/08 01:34
02/09/08 01:34
|
Joined: Dec 2003
Posts: 1,097 Maryland, USA
Steempipe
Serious User
|
Serious User
Joined: Dec 2003
Posts: 1,097
Maryland, USA
|
Now we go back to your original posted code. Try adding as indicated. Then... in your action, go back to attempting to use <my.transparent = on;> and <my.alpha = 50;>. Good Luck!! Code:
////////////////////////////////////////////////////////
matrix matMtl;
texture mtlSkin1; texture mtlSkin2;
technique makewater2 { pass p0 { AlphaBlendEnable = True; // <------- Set to True Zenable = True; ZwriteEnable = True;
// BlendOp=Add; <------- Comment out Lighting=True; srcBlend = srcColor; // <------- Add this destBlend = destColor; // <------- Add this
Texture[0] = <mtlSkin1>; Texture[1] = <mtlSkin2>;
magFilter[0] = linear; minFilter[0] = linear; mipFilter[0] = linear;
COLOROP[0] = BumpEnvMap; COLORARG1[0] = Texture; COLORARG2[0] = Current;
TexCoordIndex[0] = 1; TextureTransformFlags[0] = Count2; TextureTransform[0] = <matMtl>;
magFilter[1] = Linear; minFilter[1] = Linear; mipFilter[1] = Linear;
AddressU[1] = Clamp; AddressV[1] = Clamp;
ColorOp[1] = Modulate2x; //Modulate/AddSigned/Modulate2x/Modulate4x/Add <----------This looks all okay ColorArg1[1] = Texture; ColorArg2[1] = Current;
texcoordindex[1] = cameraspaceposition | 1; // For cubemap use: cameraspacereflectionvector TextureTransformFlags[1] = count3 | projected; TextureTransform[1] = { 0.8, 0.0, 0.0, 0.0,//u-scale of lake rgb texture CHANGE THIS TO YOUR NEEDS! 0.0, 1.0, 0.0, 0.0,//v-scale of lake rgb texture CHANGE THIS TO YOUR NEEDS! 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 }; } }
//technique fallback { pass p0 { } }
EDIT: Well, adding the my.transparent stuff does not do anythinng!. I'll chew on it a little more.
Last edited by Steempipe; 02/09/08 01:46.
|
|
|
|