|
|
specular Shader AUM54 use with transparens HOW???
#80732
07/08/06 16:16
07/08/06 16:16
|
Joined: Mar 2006
Posts: 2,252
Hummel
OP
Expert
|
OP
Expert
Joined: Mar 2006
Posts: 2,252
|
hi Leute, ich verwende den specular shader ausm AUM 54. Ich wollte fragen ob jemand weiß wie man dem anstatt der specularmap, welche sich im Alpha Kanal der Colormap befindet, Transparentz hinzufügt? Danke scon ma`!  ----------------------------NOW IN ENGLISH---------------------------------- hi, I would like to know what I have to change to use the AUM54 shader with transparents. Can everyone help me? sorry -> for my bad English...I hope you can understand everything! 
Last edited by Hummel; 07/09/06 13:34.
|
|
|
Re: specular Shader AUM54 use with transparens HOW???
[Re: Hummel]
#80733
07/10/06 12:18
07/10/06 12:18
|
Joined: Mar 2006
Posts: 2,252
Hummel
OP
Expert
|
OP
Expert
Joined: Mar 2006
Posts: 2,252
|
Nobody???  @Matt_Aufderheide: You should be able to help me...you wrote this shader...  -> Please help me!
Last edited by Hummel; 07/10/06 12:20.
|
|
|
Re: specular Shader AUM54 use with transparens HOW???
[Re: Hummel]
#80734
07/12/06 12:30
07/12/06 12:30
|
Joined: Mar 2006
Posts: 2,252
Hummel
OP
Expert
|
OP
Expert
Joined: Mar 2006
Posts: 2,252
|
Hmmmmm???  Why transparents-> I like to use the shader for plants: without Shader (I know it´s a little bit to transparent)  with Shader:  I need transparents!!!!!!!!!
|
|
|
Re: specular Shader AUM54 use with transparens HOW???
[Re: Hummel]
#80735
07/13/06 06:49
07/13/06 06:49
|
Joined: Aug 2005
Posts: 512 Bayern
Schmerzmittel
User
|
User
Joined: Aug 2005
Posts: 512
Bayern
|
Tagchen Hummel  Hast du schon mal probiert, den Alphakanal zu kopieren. Also du nimmst du Haupttextur. Dann kopierst du das selbe Bild einfach in den Alphakanal und machst es, je nachdem wie transparent du es haben willst, heller oder dunkler. Sollte gehen. Ich mach es so für meine Envmap objekte. Ich selber verwende immer den Photoshop, ist recht einfach darin. Wenn du noch Fragen hast, schreib einfach. Ach ja. Wie hast du den Shader zum laufen gebracht? Ich selber hab ihn von AUM 54. Hab die WDL eingebunden, und die Action angehängt. Aber ich sehe nur die normale Textur. Kannst mir ja helfen, wenn du willst.
A7 Com V7.80
|
|
|
Re: specular Shader AUM54 use with transparens HO
[Re: TheExpert]
#80738
07/13/06 13:26
07/13/06 13:26
|
Joined: Mar 2006
Posts: 2,252
Hummel
OP
Expert
|
OP
Expert
Joined: Mar 2006
Posts: 2,252
|
@Matt_Aufderheide: Thanks for help -> I will try it!!!  @Expert: What shader do you mean?  ... I need a shader with sunlight, because I like to use it for outdoorlevels.  OH!: "transparency" not "transparents"..  ...  -> Sorry!
Last edited by Hummel; 07/13/06 13:32.
|
|
|
Re: specular Shader AUM54 use with transparens HO
[Re: Hummel]
#80739
07/13/06 13:30
07/13/06 13:30
|
Joined: Mar 2006
Posts: 2,252
Hummel
OP
Expert
|
OP
Expert
Joined: Mar 2006
Posts: 2,252
|
@Schmerzmittel: Alphakanal is ja alles da, aber da er nicht vom Shader unterstützt wird, wird er ausgeschalten.... Ich werd ma gucken was du womöglich falsch gemacht hast mit dem Shader... ÄHHM...hast du in deinem Level zurzeit überhaupt "Sonnenlicht"? Danach richtet sich der Shader 
Last edited by Hummel; 07/14/06 04:52.
|
|
|
Re: specular Shader AUM54 use with transparens HO
[Re: Matt_Aufderheide]
#80740
07/13/06 13:48
07/13/06 13:48
|
Joined: Mar 2006
Posts: 2,252
Hummel
OP
Expert
|
OP
Expert
Joined: Mar 2006
Posts: 2,252
|
Quote:
DWORD ref=128.0f;
then in the technique add some lines: alphablendenable=false; alphatestenable=true; AlphaRef=<ref>; AlphaFunc=Greater;
I done it... so...now I can´t see my models anymore...  That is the shader: // ------------------------------------------------------------- // Diffuse and specular shader for models // ------------------------------------------------------------- //Only does sun light, no dynamic lights..
float4x4 matWorldViewProj; float4x4 matWorld; float4 vecViewPos; float4 vecFog; float4 vecSkill1;
float4 ambientcolor={0.3,0.3,0.3,0.0}; //can also use vecLight here for true ambient color float4 suncolor={0.8,0.8,0.7,0.0}; //define the suncolor here, couls al so pass it fomr the script in a mtl skill
texture entSkin1; //this is the color map with specular map in alpha ..32 bit texture entSkin2; //this is the normal map .. 24 bit
sampler ColorMapSampler = sampler_state { Texture = <entSkin1>; MinFilter = Linear; MagFilter = Linear; MipFilter = Linear; AddressU = wrap; AddressV = wrap; };
sampler BumpMapSampler = sampler_state { Texture = <entSkin2>; MinFilter = Linear; MagFilter = Linear; MipFilter = Linear; AddressU = wrap; AddressV = wrap; };
/////////////////////////////////////////////////////////////////////////////////////////////////////////////// //sunlight ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// ------------------------------------------------------------- // Output channels // ------------------------------------------------------------- struct VS_OUTPUT1 { float4 Pos : POSITION; float2 Tex : TEXCOORD0;
float3 View4 : TEXCOORD3; float3 Sun : TEXCOORD1; float Fog : FOG; };
// ------------------------------------------------------------- // vertex shader function (input channels) // ------------------------------------------------------------- VS_OUTPUT1 VS_PASS1(float4 Pos : POSITION, float2 texcoord0 : TEXCOORD0, float3 Normal : NORMAL, float3 Tangent : TEXCOORD2 ) { VS_OUTPUT1 Out = (VS_OUTPUT1)0; Out.Pos = mul(Pos, matWorldViewProj); // transform Position // compute the 3x3 tranform matrix // to transform from world space to tangent space float3x3 worldToTangentSpace; worldToTangentSpace[0] = mul(Tangent, matWorld); worldToTangentSpace[1] = mul(cross(Tangent, Normal), matWorld); worldToTangentSpace[2] = mul(Normal, matWorld); Out.Tex = texcoord0.xy;
float3 PosWorld = mul(Pos, matWorld); // float ofog = 1 - (distance(PosWorld, vecViewPos) - vecFog.x) * (vecFog.z); // Out.Fog = ofog; Out.Fog = 10000;
float3 Viewer4 = PosWorld - vecViewPos; Out.View4 = mul(worldToTangentSpace, -Viewer4); // V
//sunlight Out.Sun.xyz = mul(worldToTangentSpace, vecSkill1); // L
return Out; }
struct PS_INPUT1 { float2 Tex : TEXCOORD0; float3 View4 : TEXCOORD3; float3 Sun : TEXCOORD1; float Fog : FOG; };
// ------------------------------------------------------------- // Pixel Shader (input channels):output channel // ------------------------------------------------------------- float4 PS_PASS1( PS_INPUT1 psInStruct ):COLOR { float4 color = tex2D(ColorMapSampler, psInStruct.Tex); // fetch color map float3 bumpNormal = (tex2D(BumpMapSampler, psInStruct.Tex) - 0.5); // fetch bump map bumpNormal=normalize(bumpNormal); float3 ViewDir4 = normalize(psInStruct.View4);
//sunlight float3 Sun = normalize(psInStruct.Sun); float4 diff7 = saturate(dot(bumpNormal, Sun)); // diffuse component float3 Reflect7 = normalize(2 * diff7 * bumpNormal - Sun); // R float4 spec7 = 0.3 * pow(saturate(dot(Reflect7, ViewDir4)), 15); float shadow7 = 1.5 * (saturate(4 * diff7)); return ( (ambientcolor * color) + //ambient
((shadow7* (color * diff7 + (spec7 * color))) * suncolor) ); }
// ------------------------------------------------------------- // techniques// // -------------------------------------------------------------
DWORD ref=128.0f; technique two_pass { pass P0 { alphablendenable=false; alphatestenable=true; AlphaRef=<ref>; AlphaFunc=Greater; zenable=true; zwriteenable=true;
//compile shaders VertexShader = compile vs_1_1 VS_PASS1(); PixelShader = compile ps_2_0 PS_PASS1(); } } 
Last edited by Hummel; 07/13/06 13:50.
|
|
|
Re: specular Shader AUM54 use with transparens HO
[Re: Hummel]
#80741
07/13/06 14:01
07/13/06 14:01
|
Joined: Sep 2002
Posts: 1,604 Deutschland
ChrisB
Serious User
|
Serious User
Joined: Sep 2002
Posts: 1,604
Deutschland
|
try this one: Code:
// ------------------------------------------------------------- // Diffuse and specular shader for models // ------------------------------------------------------------- //Only does sun light, no dynamic lights..
float4x4 matWorldViewProj; float4x4 matWorld; float4 vecViewPos; float4 vecFog; float4 vecSkill1;
float4 ambientcolor={0.3,0.3,0.3,0.0}; //can also use vecLight here for true ambient color float4 suncolor={0.8,0.8,0.7,0.0}; //define the suncolor here, couls al so pass it fomr the script in a mtl skill
texture entSkin1; //this is the color map with specular map in alpha ..32 bit texture entSkin2; //this is the normal map .. 24 bit
sampler ColorMapSampler = sampler_state { Texture = <entSkin1>; MinFilter = Linear; MagFilter = Linear; MipFilter = Linear; AddressU = wrap; AddressV = wrap; };
sampler BumpMapSampler = sampler_state { Texture = <entSkin2>; MinFilter = Linear; MagFilter = Linear; MipFilter = Linear; AddressU = wrap; AddressV = wrap; };
/////////////////////////////////////////////////////////////////////////////////////////////////////////////// //sunlight ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// ------------------------------------------------------------- // Output channels // ------------------------------------------------------------- struct VS_OUTPUT1 { float4 Pos : POSITION; float2 Tex : TEXCOORD0;
float3 View4 : TEXCOORD3;
float3 Sun : TEXCOORD1; float Fog : FOG;
};
// ------------------------------------------------------------- // vertex shader function (input channels) // ------------------------------------------------------------- VS_OUTPUT1 VS_PASS1(float4 Pos : POSITION, float2 texcoord0 : TEXCOORD0, float3 Normal : NORMAL, float3 Tangent : TEXCOORD2 ) { VS_OUTPUT1 Out = (VS_OUTPUT1)0; Out.Pos = mul(Pos, matWorldViewProj); // transform Position
// compute the 3x3 tranform matrix // to transform from world space to tangent space float3x3 worldToTangentSpace; worldToTangentSpace[0] = mul(Tangent, matWorld); worldToTangentSpace[1] = mul(cross(Tangent, Normal), matWorld); worldToTangentSpace[2] = mul(Normal, matWorld);
Out.Tex = texcoord0.xy;
float3 PosWorld = mul(Pos, matWorld);
// float ofog = 1 - (distance(PosWorld, vecViewPos) - vecFog.x) * (vecFog.z); // Out.Fog = ofog; Out.Fog = 10000;
float3 Viewer4 = PosWorld - vecViewPos; Out.View4 = mul(worldToTangentSpace, -Viewer4); // V
//sunlight Out.Sun.xyz = mul(worldToTangentSpace, vecSkill1); // L
return Out; }
struct PS_INPUT1 { float2 Tex : TEXCOORD0; float3 View4 : TEXCOORD3; float3 Sun : TEXCOORD1; float Fog : FOG; };
// ------------------------------------------------------------- // Pixel Shader (input channels):output channel // ------------------------------------------------------------- float4 PS_PASS1( PS_INPUT1 psInStruct ):COLOR {
float4 color = tex2D(ColorMapSampler, psInStruct.Tex); // fetch color map float3 bumpNormal = (tex2D(BumpMapSampler, psInStruct.Tex) - 0.5); // fetch bump map bumpNormal=normalize(bumpNormal);
float3 ViewDir4 = normalize(psInStruct.View4);
//sunlight float3 Sun = normalize(psInStruct.Sun); float4 diff7 = saturate(dot(bumpNormal, Sun)); // diffuse component float3 Reflect7 = normalize(2 * diff7 * bumpNormal - Sun); // R float4 spec7 = 0.3 * pow(saturate(dot(Reflect7, ViewDir4)), 15); float shadow7 = 1.5 * (saturate(4 * diff7)); float4 outColor = (ambientcolor * color) + //ambient
((shadow7* (color * diff7 + (spec7 * color))) * suncolor)); outColor.a=color.a; return outColor; }
// ------------------------------------------------------------- // techniques// // -------------------------------------------------------------
DWORD ref=128.0f; technique two_pass {
pass P0 { alphablendenable=false; alphatestenable=true; AlphaRef=<ref>; AlphaFunc=Greater; zenable=true; zwriteenable=true;
//compile shaders VertexShader = compile vs_1_1 VS_PASS1(); PixelShader = compile ps_2_0 PS_PASS1(); }
}
|
|
|
|