2 registered members (TipmyPip, AndrewAMD),
12,726
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: transparent abschalten
[Re: mk_1]
#60540
12/15/05 21:11
12/15/05 21:11
|
Joined: Aug 2002
Posts: 1,096 germany/Schleßwig-Holstein
PAS
OP
Serious User
|
OP
Serious User
Joined: Aug 2002
Posts: 1,096
germany/Schleßwig-Holstein
|
mh ich weiß leider nicht wlchen ich posten soll, dann nehm ich mal beiden sachen einmal die .wdl und einmal die .fx Code:
bind <watershader.fx>;
var index; var counter;
define amplitude skill1; define water_speed skill25; define number_of_vertices 1089;//(33x33 vertices) amount of vertices in your water-terrain (see AUM 34 how to make a weaving water-terrain, make sure the water-terrain has 2 "empty" skins), http://aum.conitec.net/) var vertex_array [1089];
var d3d_automaterial=1;
function init_detail_mapping() { bmap_to_mipmap(mtl.skin1); d3d_automaterial=2; }
bmap water_cube=<cubemap+6.tga>;//this is the skycube that is reflectet by the water bmap water_bump=<waterbump5.tga>;
function mtl_water_init() { bmap_to_cubemap(bmap_to_mipmap(mtl.skin2)); bmap_to_mipmap(mtl.Skin1); }
///////////////////////////////////////////////////////////////////////////////// // The material definition used in the watershader // material wave1 { skin1=water_bump; skin2=water_cube; flags=tangent; event = mtl_water_init; }
var ShaderCount;
////////////////////////////////////////////////////////////////////////////////// // The action to assign to the water terrain, basically it is the wave code with // the material used in the shader assigned to the water terrain //
Action WaterShader { my.material = wave1; /// **** THIS MAKES THE TERRAIN USE STEEMPIPE'S WATER SHADER CODE, THAT'S ALL THERE WAS TO IT ///
my.scale_x=14; /// **** RESIZE THE WATER TERRRAIN MATRIX IF YOU DESIRE my.scale_y=14;
my.transparent=off; /// **** SEE THRU IT OR NOT WHATEVER
my.nofog = off; /// **** FOG SEEMS TO WORK WITH THIS SHADER IF U WANT IT... COOL
// **** SETTING UP FOR THE WAVES
if (my.amplitude == 0) { my.amplitude = 0.2; // default wave amplitude value }
if (my.water_speed == 0) { my.water_speed =6; // default wave speed value }
while (counter < number_of_vertices) { vertex_array[counter] = random(360); // set random values in vertex_array counter += 1; }
while(1) // **** MAKE WAVES ALL THE TIME { my.skill41=float(ShaderCount); my.skill42=float(0); my.skill43=float(0); my.skill44=float(0);
ShaderCount += 0.00000; // ******* AFFECT SPEED OF WAVE MOVEMENT HERE
index = 0; my.u += 0.05*time; my.v += 0.05*time;
wait (1);
while (index < number_of_vertices) { vec_for_mesh(temp, my, index); // store the vertex coordinates in temp temp.z = sin(counter + vertex_array[index]) * my.amplitude; // change the z component vec_to_mesh(temp, my, index); // deform the terrain entity index += 1; } counter += my.water_speed * time; wait(1); } }
////////////////////////////////////////////////////////////////////////////////////// // **** Load the effect file if pixelshader version // is better then 1.1. // If not, then exit the Engine.
function load_water_fx() { if (d3d_shaderversion >= 1111) { effect_load(wave1,"watershader.fx");//links on the external fx-file wait(5); return; } else { wait(5); exit; }
} und hier die fx datei Code:
/****************************************************** Water Shader for 3DGameStudio
By: Eric Hendrickson-Lambert (Steempipe)
v11.08.04.1
11/08/04: Cleaned up code for release.
Note: Pixelshader1.1 & DX9.00c Runtimes needed.
It will take experimenting with scaling, shifting, etc~ depending on what normalmap is used. The ripple code is still in very early stages.
-See the main WDL for loading the material effect and the d3d_shaderversion function.
If used, credit would be nice... these take alot of time to work out. Thanks. ******************************************************/
float4x4 matWorldViewProj; float4x4 matWorld; float4x4 matWorldView;
float3 vecViewPos; float3 vecSkill41; float4 vecFog;
float RippleScale = 0.20;
Texture mtlSkin1; // Normalmap Texture mtlSkin2; // Cubemap
sampler s_Bump = sampler_state { Texture = (mtlSkin1); MinFilter = LINEAR; MagFilter = LINEAR; MipFilter = LINEAR; AddressU = WRAP; AddressV = WRAP; };
sampler s_Cube = sampler_state { Texture = (mtlSkin2); MinFilter = LINEAR; MagFilter = LINEAR; MipFilter = LINEAR; AddressU = CLAMP; AddressV = CLAMP; AddressW = CLAMP; };
struct VS_IN { float4 Pos: POSITION; float3 Normal: NORMAL; float2 Bump: TEXCOORD0; float3 Tangent : TEXCOORD1; };
struct VS_OUT { float4 Pos: POSITION; float Fog: FOG; float2 Bump: TEXCOORD0; float4 TanToCube0: TEXCOORD1; float4 TanToCube1: TEXCOORD2; float4 TanToCube2: TEXCOORD3; };
VS_OUT WaterBump_VS(VS_IN IN) { VS_OUT Out;
Out.Pos = mul(IN.Pos, matWorldViewProj); //////////////////////////////////////////////////////////////////////////////// // Ripple Test #1 // //Out.Bump= (IN.Bump.xy * RippleScale) + (IN.Bump.xy += (vecSkill41.x * 0.02)); ////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// // Ripple Test #2 // //float cos_x = cos(RippleScale * vecSkill41.x); //float sin_y = sin(RippleScale * vecSkill41.x); //Out.Bump = float2(IN.Bump.x+cos_x, IN.Bump.y-sin_y); ////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// // Ripple Test #3 // float cos_x=cos(vecSkill41); float sin_y = sin(vecSkill41); Out.Bump = (float2(IN.Bump.x+cos_x, IN.Bump.y+sin_y)* RippleScale)*15;
float3x3 ObjToTan; ObjToTan[0] = RippleScale * IN.Tangent; ObjToTan[1] = RippleScale * cross(IN.Tangent, IN.Normal); ObjToTan[2] = IN.Normal;
Out.TanToCube0.xyz = mul(ObjToTan, matWorld[0].xyz); Out.TanToCube1.xyz = mul(ObjToTan, matWorld[1].xyz); Out.TanToCube2.xyz = mul(ObjToTan, matWorld[2].xyz);
float3 PositionWorld = mul(IN.Pos, matWorld); float3 ViewerDir = normalize(vecViewPos - PositionWorld);
Out.TanToCube0.w = ViewerDir.x; Out.TanToCube1.w = ViewerDir.y; Out.TanToCube2.w = ViewerDir.z;
float ofog = 1 - (distance(PositionWorld, vecViewPos) - vecFog.x) * vecFog.z; Out.Fog = ofog; return Out; }
technique WaterBump {
pass One { Sampler[0] = (s_Bump); //Sampler[1] = (s_Cube); //Sampler[2] = (s_Cube); Sampler[3] = (s_Cube); AlphaBlendEnable = True; ZwriteEnable = True; ZEnable = True;
// Main point is that pixelShaderConstant 'W' will control // the alpha tranparency. The XYZ will adjust // some coloring.
PixelShaderConstant[0] = {0.90,0.99,0.99,0.70}; // x, y, z, w
VertexShader = compile vs_1_1 WaterBump_VS();
PixelShader = asm { ps.1.1
tex t0 // Normalmap
texm3x3pad t1, t0_bx2 texm3x3pad t2, t0_bx2 texm3x3vspec t3, t0_bx2
mul r0, t3, c0 }; } } PAS
|
|
|
Re: transparent abschalten
[Re: PAS]
#60541
12/15/05 21:28
12/15/05 21:28
|
Joined: Sep 2002
Posts: 1,604 Deutschland
ChrisB
Serious User
|
Serious User
Joined: Sep 2002
Posts: 1,604
Deutschland
|
Probier mal: Quote:
Code:
/****************************************************** Water Shader for 3DGameStudio
By: Eric Hendrickson-Lambert (Steempipe)
v11.08.04.1
11/08/04: Cleaned up code for release.
Note: Pixelshader1.1 & DX9.00c Runtimes needed.
It will take experimenting with scaling, shifting, etc~ depending on what normalmap is used. The ripple code is still in very early stages.
-See the main WDL for loading the material effect and the d3d_shaderversion function.
If used, credit would be nice... these take alot of time to work out. Thanks. ******************************************************/
float4x4 matWorldViewProj; float4x4 matWorld; float4x4 matWorldView;
float3 vecViewPos; float3 vecSkill41; float4 vecFog;
float RippleScale = 0.20;
Texture mtlSkin1; // Normalmap Texture mtlSkin2; // Cubemap
sampler s_Bump = sampler_state { Texture = (mtlSkin1); MinFilter = LINEAR; MagFilter = LINEAR; MipFilter = LINEAR; AddressU = WRAP; AddressV = WRAP; };
sampler s_Cube = sampler_state { Texture = (mtlSkin2); MinFilter = LINEAR; MagFilter = LINEAR; MipFilter = LINEAR; AddressU = CLAMP; AddressV = CLAMP; AddressW = CLAMP; };
struct VS_IN { float4 Pos: POSITION; float3 Normal: NORMAL; float2 Bump: TEXCOORD0; float3 Tangent : TEXCOORD1; };
struct VS_OUT { float4 Pos: POSITION; float Fog: FOG; float2 Bump: TEXCOORD0; float4 TanToCube0: TEXCOORD1; float4 TanToCube1: TEXCOORD2; float4 TanToCube2: TEXCOORD3; };
VS_OUT WaterBump_VS(VS_IN IN) { VS_OUT Out;
Out.Pos = mul(IN.Pos, matWorldViewProj); //////////////////////////////////////////////////////////////////////////////// // Ripple Test #1 // //Out.Bump= (IN.Bump.xy * RippleScale) + (IN.Bump.xy += (vecSkill41.x * 0.02)); ////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// // Ripple Test #2 // //float cos_x = cos(RippleScale * vecSkill41.x); //float sin_y = sin(RippleScale * vecSkill41.x); //Out.Bump = float2(IN.Bump.x+cos_x, IN.Bump.y-sin_y); ////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// // Ripple Test #3 // float cos_x=cos(vecSkill41); float sin_y = sin(vecSkill41); Out.Bump = (float2(IN.Bump.x+cos_x, IN.Bump.y+sin_y)* RippleScale)*15;
float3x3 ObjToTan; ObjToTan[0] = RippleScale * IN.Tangent; ObjToTan[1] = RippleScale * cross(IN.Tangent, IN.Normal); ObjToTan[2] = IN.Normal;
Out.TanToCube0.xyz = mul(ObjToTan, matWorld[0].xyz); Out.TanToCube1.xyz = mul(ObjToTan, matWorld[1].xyz); Out.TanToCube2.xyz = mul(ObjToTan, matWorld[2].xyz);
float3 PositionWorld = mul(IN.Pos, matWorld); float3 ViewerDir = normalize(vecViewPos - PositionWorld);
Out.TanToCube0.w = ViewerDir.x; Out.TanToCube1.w = ViewerDir.y; Out.TanToCube2.w = ViewerDir.z;
float ofog = 1 - (distance(PositionWorld, vecViewPos) - vecFog.x) * vecFog.z; Out.Fog = ofog; return Out; }
technique WaterBump {
pass One { Sampler[0] = (s_Bump); //Sampler[1] = (s_Cube); //Sampler[2] = (s_Cube); Sampler[3] = (s_Cube); AlphaBlendEnable =False; ZwriteEnable = True; ZEnable = True;
// Main point is that pixelShaderConstant 'W' will control // the alpha tranparency. The XYZ will adjust // some coloring.
PixelShaderConstant[0] = {0.90,0.99,0.99,0.70}; // x, y, z, w
VertexShader = compile vs_1_1 WaterBump_VS();
PixelShader = asm { ps.1.1
tex t0 // Normalmap
texm3x3pad t1, t0_bx2 texm3x3pad t2, t0_bx2 texm3x3vspec t3, t0_bx2
mul r0, t3, c0 }; } }
Da wünscht man sich ein größeres Text feld!
|
|
|
Re: transparent abschalten
[Re: ChrisB]
#60542
12/15/05 21:39
12/15/05 21:39
|
Joined: Nov 2003
Posts: 1,380 Switzerland; Zurich
Sebe
Serious User
|
Serious User
Joined: Nov 2003
Posts: 1,380
Switzerland; Zurich
|
Code:
/****************************************************** Water Shader for 3DGameStudio
By: Eric Hendrickson-Lambert (Steempipe)
v11.08.04.1
11/08/04: Cleaned up code for release.
Note: Pixelshader1.1 & DX9.00c Runtimes needed.
It will take experimenting with scaling, shifting, etc~ depending on what normalmap is used. The ripple code is still in very early stages.
-See the main WDL for loading the material effect and the d3d_shaderversion function.
If used, credit would be nice... these take alot of time to work out. Thanks. ******************************************************/
float4x4 matWorldViewProj; float4x4 matWorld; float4x4 matWorldView;
float3 vecViewPos; float3 vecSkill41; float4 vecFog;
float RippleScale = 0.20;
Texture mtlSkin1; // Normalmap Texture mtlSkin2; // Cubemap
sampler s_Bump = sampler_state { Texture = (mtlSkin1); MinFilter = LINEAR; MagFilter = LINEAR; MipFilter = LINEAR; AddressU = WRAP; AddressV = WRAP; };
sampler s_Cube = sampler_state { Texture = (mtlSkin2); MinFilter = LINEAR; MagFilter = LINEAR; MipFilter = LINEAR; AddressU = CLAMP; AddressV = CLAMP; AddressW = CLAMP; };
struct VS_IN { float4 Pos: POSITION; float3 Normal: NORMAL; float2 Bump: TEXCOORD0; float3 Tangent : TEXCOORD1; };
struct VS_OUT { float4 Pos: POSITION; float Fog: FOG; float2 Bump: TEXCOORD0; float4 TanToCube0: TEXCOORD1; float4 TanToCube1: TEXCOORD2; float4 TanToCube2: TEXCOORD3; };
VS_OUT WaterBump_VS(VS_IN IN) { VS_OUT Out;
Out.Pos = mul(IN.Pos, matWorldViewProj); //////////////////////////////////////////////////////////////////////////////// // Ripple Test #1 // //Out.Bump= (IN.Bump.xy * RippleScale) + (IN.Bump.xy += (vecSkill41.x * 0.02)); ////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// // Ripple Test #2 // //float cos_x = cos(RippleScale * vecSkill41.x); //float sin_y = sin(RippleScale * vecSkill41.x); //Out.Bump = float2(IN.Bump.x+cos_x, IN.Bump.y-sin_y); ////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// // Ripple Test #3 // float cos_x=cos(vecSkill41); float sin_y = sin(vecSkill41); Out.Bump = (float2(IN.Bump.x+cos_x, IN.Bump.y+sin_y)* RippleScale)*15;
float3x3 ObjToTan; ObjToTan[0] = RippleScale * IN.Tangent; ObjToTan[1] = RippleScale * cross(IN.Tangent, IN.Normal); ObjToTan[2] = IN.Normal;
Out.TanToCube0.xyz = mul(ObjToTan, matWorld[0].xyz); Out.TanToCube1.xyz = mul(ObjToTan, matWorld[1].xyz); Out.TanToCube2.xyz = mul(ObjToTan, matWorld[2].xyz);
float3 PositionWorld = mul(IN.Pos, matWorld); float3 ViewerDir = normalize(vecViewPos - PositionWorld);
Out.TanToCube0.w = ViewerDir.x; Out.TanToCube1.w = ViewerDir.y; Out.TanToCube2.w = ViewerDir.z;
float ofog = 1 - (distance(PositionWorld, vecViewPos) - vecFog.x) * vecFog.z; Out.Fog = ofog; return Out; }
technique WaterBump {
pass One { Sampler[0] = (s_Bump); //Sampler[1] = (s_Cube); //Sampler[2] = (s_Cube); Sampler[3] = (s_Cube); AlphaBlendEnable =False; ZwriteEnable = True; ZEnable = True;
// Main point is that pixelShaderConstant 'W' will control // the alpha tranparency. The XYZ will adjust // some coloring.
PixelShaderConstant[0] = {0.90,0.99,0.99,0.70}; // x, y, z, w
VertexShader = compile vs_1_1 WaterBump_VS();
PixelShader = asm { ps.1.1
tex t0 // Normalmap
texm3x3pad t1, t0_bx2 texm3x3pad t2, t0_bx2 texm3x3vspec t3, t0_bx2
mul r0, t3, c0 }; } } Hier kannst du folgende Werte einstellen: Code:
PixelShaderConstant[0] = {R,G,B,TRANSPARENZ};
Steht sogar obendran: Code:
// Main point is that pixelShaderConstant 'W' will control // the alpha tranparency. The XYZ will adjust // some coloring. Einfach den letzten Wert auf 1 stellen, und schon hast du die Undurchsichtbarkeit ^.^
|
|
|
|