Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (degenerate_762, AbrahamR, AndrewAMD, ozgur), 667 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
fx. Datei in nen Material schreiben? #64576
02/17/06 15:58
02/17/06 15:58
Joined: Mar 2003
Posts: 1,095
Germany
nightshade Offline OP
Serious User
nightshade  Offline OP
Serious User

Joined: Mar 2003
Posts: 1,095
Germany
Hi, diese Frage hat mir bisher noch niemand privat antworten können. Nämlich wie ich eine fx Datei in nen Material schreiben kann... So dass ich den Shader nutzen kann, diesen hier :

//--------------------------------------------------------------//
// ComplexGlass
//--------------------------------------------------------------//

float4x4 matWorldViewProj;
float4x4 matWorldView;
float4x4 matWorld;
float4 vecViewPos;
float4 vecFog;
texture mtlSkin1;
texture mtlSkin2;

float refractionScale = 1.0;
float rainbowScale = 0.20;
float rainbowSpread = 0.18;
float4 baseColor = ( 0.72, 0.70, 0.76, 1.00 );
float ambient = 0.05;
float indexOfRefractionRatio = 1.14;
float reflectionScale = 1.0;

sampler Environment = sampler_state
{
Texture = (mtlSkin1);
ADDRESSU = CLAMP;
ADDRESSV = CLAMP;
MAGFILTER = LINEAR;
MINFILTER = LINEAR;
MIPFILTER = LINEAR;
};

sampler Rainbow = sampler_state
{
Texture = (mtlSkin2);
ADDRESSU = CLAMP;
ADDRESSV = CLAMP;
MAGFILTER = LINEAR;
MINFILTER = LINEAR;
MIPFILTER = LINEAR;
};

struct ComplexGlass_VS_OUTPUT {
float4 Pos: POSITION;
float3 normal: TEXCOORD0;
float3 viewVec: TEXCOORD1;
float Fog : FOG;
};

ComplexGlass_VS_OUTPUT ComplexGlass_Object_VS_main(float4 vPos: POSITION, float3 normal: NORMAL){
ComplexGlass_VS_OUTPUT Out;

Out.Pos = mul(vPos,matWorldViewProj);
Out.normal = mul(normal,matWorld);
Out.viewVec = vecViewPos - mul(vPos,matWorld);
float3 PosWorld = mul(vPos, matWorld);
Out.Fog = 1- (distance(PosWorld, vecViewPos) - vecFog.x) * (vecFog.z);

return Out;
}

float4 ComplexGlass_Object_PS_main(float3 normal: TEXCOORD0, float3 viewVec: TEXCOORD1) : COLOR {
normal = normalize(normal);
viewVec = normalize(viewVec);

// Look up the reflection
half3 reflVec = reflect(-viewVec, normal);
half4 reflection = texCUBE(Environment, reflVec.xyz);

// We'll use Snell's refraction law:
// n * sin(theta ) = n * sin(theta )
// i i r r

// sin(theta )
// i
half cosine = dot(viewVec, normal);
half sine = sqrt(1 - cosine * cosine);

// sin(theta )
// r
half sine2 = saturate(indexOfRefractionRatio * sine);
half cosine2 = sqrt(1 - sine2 * sine2);

// Out of the sine and cosine of the angle between the
// refraction vector and the normal we can construct the
// refraction vector itself given two base vectors.
// These two base vectors are the negative normal and
// a tangent vector along the path of the incoming vector
// relative to the surface.
half3 x = -normal;
half3 y = normalize(cross(cross(viewVec, normal), normal));

// Refraction
half3 refrVec = x * cosine2 + y * sine2;
half4 refraction = texCUBE(Environment, refrVec.xyz);

// Colors refract differently and the difference is more
// visible the stronger the refraction. We'll fake this
// effect by adding some rainbowish colors accordingly.
half4 rainbow = tex1D(Rainbow, pow(cosine, rainbowSpread));

half4 rain = rainbowScale * rainbow * baseColor;
half4 refl = reflectionScale * reflection;
half4 refr = refractionScale * refraction * baseColor;

// There is more light reflected at sharp angles and less
// light refracted. There is more color separation of refracted
// light at sharper angles
half4 color = sine * refl + (1 - sine2) * refr + sine2 * rain + ambient;
return color;
}
technique ComplexGlass{
pass Object {
AlphaBlendEnable=True;
Zenable = True;
AlphaTestEnable=True;
ZwriteEnable = False;
// ZwriteEnable = True;
CULLMODE = CCW;
BlendOp=5;
VertexShader = compile vs_1_1 ComplexGlass_Object_VS_main();
PixelShader = compile ps_2_0 ComplexGlass_Object_PS_main();
}
}

Danke.

Re: fx. Datei in nen Material schreiben? [Re: nightshade] #64577
02/17/06 16:13
02/17/06 16:13
Joined: Jun 2005
Posts: 4,875
broozar Offline
Expert
broozar  Offline
Expert

Joined: Jun 2005
Posts: 4,875
dafür gibt es das WIKI.

und damit du nicht erst suchen musst:
http://www.coniserver.net/wiki/wikisecure/index.php/HowToApplyShaders

Re: fx. Datei in nen Material schreiben? [Re: broozar] #64578
02/17/06 16:15
02/17/06 16:15
Joined: Mar 2003
Posts: 1,095
Germany
nightshade Offline OP
Serious User
nightshade  Offline OP
Serious User

Joined: Mar 2003
Posts: 1,095
Germany
Okay, danke.


Moderated by  Blink, Hummel, Superku 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1