Hi, der Shader von Steempipe :
// shader_test.wdl
var video_mode = 7;
var video_depth = 32;
var d3d_mipmapping = 3;
var d3d_anisotropy = 16;
var clip_range = 200000;
var clip_factor = 1;
var clip_size = 0;
var clip_factor= 1;
var fps_max = 70;
var fps_min = 35;
var max_entities = 1000;
var d3d_transform = on;
var move_friction = 0;
var d3d_antialias = 6;
var logo = 0;
var video_screen = 1;
var bumpness = 100;
var speed = 1;
bmap slider_tga = "slider.tga";
bmap mauszeiger_bmp = "mauszeiger.bmp";
bmap slider_box_tga = "slider_box.tga";
PANEL pan_sliders
{
bmap = slider_box_tga;
hslider = 492, 4, 610, slider_tga, 0, 500, bumpness;
hslider = 492, 30, 610, slider_tga, 0, 10, speed;
}
FUNCTION loadfx();
SKY himmel1
{
type = <himmel3+6.tga>;
layer = 3;
flags = cube,visible;
z = 0;
}
VIEW mirror
{
layer = 10;
}
entity* water_ent;
function render_event();
MATERIAL waterfx
{
}
var hoch;
var hoch1 = 3.2;
ACTION water
{
var count;
var count1;
var a = 180;
var b;
water_ent = me;
my.nofog = on;
// my.invisible = on;
my.material = waterfx;
my.scale_x = 40;
my.scale_y = 40;
my.z += 20;
hoch = my.z;
while(1)
{
my.z = hoch;
my.skill41=float(count);
my.skill42=float(count1);
my.skill43=float(0);
my.skill44=float(0);
a += speed*time;
a %= 360;
b += speed*time;
b %= 360;
count = sin(a)+bumpness;
count1 = cos(b)+bumpness;
hoch1 = my.z*0.049;
wait(1);
}
}
STARTER init_water
{
wait(2);
camera.x = -1552;
camera.y = -935;
camera.z = 98;
camera.pan = 43;
camera.tilt = -4;
mirror.size_x = camera.size_x;
mirror.size_y = camera.size_y;
d3d_fogcolor1.red = 128;
d3d_fogcolor1.green = 128;
d3d_fogcolor1.blue = 150;
fog_color = 1;
camera.fog_start = 20;
camera.fog_end = 5000;
mirror.fog_start = 20;
mirror.fog_end = 5000;
camera.clip_near = 0;
mirror.clip_near = 0;
mirror.nocull = on;
/*If you have A6 Pro Version*/
// mirror.bmap = bmap_for_entity(water_ent,1);
// refrview.bmap = bmap_for_entity(water_ent,2);
// mirror.aspect = -1;
// mirror.visible = on;
// refrview.visible = on;
/*If you have A6 Com Version*/
IF(d3d_shaderversion < 2020)
{
pan_sliders.visible = off;
while(1)
{
draw_text("You need a video card with Pixelshader 2.0",screen_size.x-520,screen_size.y-280,vector(0,0,0));
wait(1);
}
}
make_mirror();
mirror.aspect = -1;
mouse_map = mauszeiger_bmp;
proc_late();
while(1)
{
mirror.x = camera.x;
mirror.y = camera.y;
mirror.z = -camera.z+ (2*water_ent.z);
mirror.pan = camera.pan;
mirror.tilt = -camera.tilt;
mouse_pos.x = pointer.x;
mouse_pos.y = pointer.y;
pan_sliders.pos_x = (screen_size.x/2)-800;
pan_sliders.pos_y = screen_size.y-52;
wait(1);
}
}
FUNCTION make_mirror
{
mirror.visible = on;
pan_sliders.visible = off;
mouse_mode = 0;
mirror.size_x = camera.size_x;
mirror.size_y = camera.size_y;
water_ent.visible = off;
wait(1);
bmap_for_screen(bmap_for_entity(water_ent,1),1,0);
mirror.visible = off;
//water_ent.visible = on;
pan_sliders.visible = on;
mouse_mode = 2;
loadfx();
}
MATERIAL terrain_clipping //for clipping the terrain underwater in the mirror view
{
event = render_event();
flags = enable_view;
effect=
"
float4x4 matWorldViewProj: register(c0);
texture entSkin1;
vector vecSkill41;
float1 mtlSkill1;
struct VS_OUTPUT
{
float4 Pos: POSITION;
float2 texCoord: TEXCOORD0;
float3 eyeLinear: TEXCOORD1;
};
VS_OUTPUT VS_p0(float4 Pos1: POSITION, float2 basemap: TEXCOORD0)
{
VS_OUTPUT Out;
Out.Pos = mul(Pos1, matWorldViewProj);
Out.texCoord = basemap;
Out.eyeLinear.x = Pos1.x;
Out.eyeLinear.y = Pos1.y;
Out.eyeLinear.z = Pos1.z;
return Out;
}
sampler BaseMap = sampler_state
{
texture=(entSkin1);
MAGFILTER = LINEAR;
MINFILTER = LINEAR;
MIPFILTER = LINEAR;
};
float4 PS_p0( float2 texCoord: TEXCOORD0,
float3 eyeLinear: TEXCOORD1) : COLOR
{
float4 base = tex2D(BaseMap, texCoord);
clip((eyeLinear.y-vecSkill41)*mtlSkill1);
// Output
return base * 1.2;
}
technique water
{
pass p1
{
VertexShader = compile vs_1_1 VS_p0();
PixelShader = compile ps_2_0 PS_p0();
}
}
";
}
FUNCTION loadfx
{
effect_load(terrain_clipping,"clip.fx");
effect_load(waterfx,"water.fx");
}
ACTION terrainobject
{
IF(d3d_shaderversion < 2020) { return; }
my.material = terrain_clipping;
my.nofog = on;
while(1)
{
my.skill41 = float(hoch1);
wait(1);
}
}
function render_event()
{
if(render_view == camera)
{
mtl.skill1 = float(0);
}
if(render_view == mirror)
{
mtl.skill1 = float(1);
}
}
DIE FX :
float4x4 matWorldViewProj: register(c0);
texture entSkin1;
texture entSkin2;
texture entSkin3;
vector vecSkill41;
float1 mtlSkill1;
struct VS_OUTPUT
{
float4 Pos: POSITION;
float2 texCoord: TEXCOORD0;
float3 eyeLinear: TEXCOORD1;
};
VS_OUTPUT VS_p0(float4 Pos: POSITION)
{
VS_OUTPUT Out;
float4 pos = float4(1 * Pos.x, 1 * Pos.y - 1, 1 * Pos.z, 1);
float4 pPos = mul(float4(pos.xyz,1), matWorldViewProj);
Out.Pos = pPos;
Out.texCoord.x = Pos.x * 0.5;
Out.texCoord.y = Pos.z * 0.5;
Out.eyeLinear.x = 0.5 * (pPos.z + pPos.x);
Out.eyeLinear.y = 0.5 * (pPos.z - pPos.y);
Out.eyeLinear.z = pPos.z * 1;
return Out;
}
sampler BumpMap = sampler_state
{
texture=(entSkin3);
MAGFILTER = LINEAR;
MINFILTER = LINEAR;
MIPFILTER = LINEAR;
};
sampler RefractionMap = sampler_state
{
texture=(entSkin2);
MAGFILTER = LINEAR;
MINFILTER = LINEAR;
MIPFILTER = LINEAR;
};
sampler ReflectionMap = sampler_state
{
texture=(entSkin1);
MAGFILTER = LINEAR;
MINFILTER = LINEAR;
MIPFILTER = LINEAR;
};
float4 PS_p0( float2 texCoord: TEXCOORD0,
float3 eyeLinear: TEXCOORD1) : COLOR
{
// addiere die Geschindigkeit von vecSkill41 hinzu für Wellenbewegung
float2 waterCoord = texCoord.xy * 0.001 * vecSkill41;
// die Bumpmap mit der waterCoord Koordinaten
float4 bump = tex2D(BumpMap, waterCoord) * 2 - 1;
bump = normalize(bump);
float2 mid = eyeLinear.xy / eyeLinear.z + bump.xy * 0.1f ;
// Reflektierte Wasseroberfläche
float4 reflection = tex2D(ReflectionMap, mid);
// Output
return reflection;
}
technique water
{
pass p1
{
VertexShader = compile vs_1_1 VS_p0();
PixelShader = compile ps_2_0 PS_p0();
}
}
Wenn die Engine schon gestartet ist, sagt se : Empty pointer in make_mirror : water_ent.visible = off; usw.
Was machen? Danke für eure Hilfen.