hi all,
i recently updated form 6.3 to 6.4.
now, the cubemap shader isn't working any more as it should. somehow, it seems that the cube has been turned to the left, over one side, and is now lying on one side, at least that is it what my water reflections tell me. sceenie:



see, where the arrow is? that's the sun... look down on the surfac, there it is not. instead, the brown ground is visible.

code:

wdl
Code:

function mtl_water_init()
{

bmap_to_cubemap(bmap_to_mipmap(mtl.skin2));
bmap_to_mipmap(mtl.Skin1);

}


material water_fx {

skin1=water_bump;
skin2=water_cube;

flags=tangent;

event = mtl_water_init;

}

var ShaderCount;


Action WaterShader
{
my.material = water_fx;

my.transparent=on;
my.alpha=99;
my.nofog = off;


while(1)
{
my.skill41=float(ShaderCount);
my.skill42=float(0);
my.skill43=float(0);
my.skill44=float(0);

ShaderCount += 0.001;

wait(1);
}
}

function load_water_fx() {

if (d3d_shaderversion >= 1111)
{
effect_load(water_fx,"watershader.fx");
wait(5);
return;
}
else
{
wait(5);
exit;
}

}



fx-file

Code:

/******************************************************
Water Shader for 3DGameStudio

By: Eric Hendrickson-Lambert (Steempipe)

v11.08.04.1
******************************************************/

float4x4 matWorldViewProj;
float4x4 matWorld;
float4x4 matWorldView;

float3 vecViewPos;
float3 vecSkill41;
float4 vecFog;

float RippleScale = 0.3;

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 SC1 = {0.3};
float SC2 = {0.3};
float cos_x = cos(RippleScale * vecSkill41.x *SC1);
float sin_y = sin(RippleScale * vecSkill41.x *SC1);
Out.Bump = float2(IN.Bump.x+cos_x, IN.Bump.y-sin_y);
////////////////////////////////////////////////////////////////////////////////


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.90}; // 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

};
}
}



thanks in advance.

Last edited by DaBro0zar; 06/26/06 18:14.