Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by AndrewAMD. 12/05/23 10:56
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
6 registered members (3run, AndrewAMD, alibaba, fairtrader, ozgur, TipmyPip), 605 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
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 Offline OP
Expert
Hummel  Offline 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 Offline OP
Expert
Hummel  Offline 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 Offline OP
Expert
Hummel  Offline 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 Offline
User
Schmerzmittel  Offline
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: Schmerzmittel] #80736
07/13/06 08:36
07/13/06 08:36
Joined: Oct 2003
Posts: 4,131
M
Matt_Aufderheide Offline
Expert
Matt_Aufderheide  Offline
Expert
M

Joined: Oct 2003
Posts: 4,131
its quite simple..

in the fx file just add this line right above the techniques:
DWORD ref=128.0f;

then in the technique add some lines:
alphablendenable=false;
alphatestenable=true;
AlphaRef=<ref>;
AlphaFunc=Greater;

of course, you have to make sure your shader is actually using the alpha value of the texture.. i cant help witt that as dont have the shader your talking about, i never told AUM to publish my shaders, so I dont know what they may have done to it, or which one they have used..I dont like AUM

However, it might work as is..
if not, you would need to make sure the result or final color contains the alpha from the the texture you are using for the alpha..

just set something like this above the last line in the pixel shader body:
finalcolor.a=colormap.a ...or whatever the names are..


Sphere Engine--the premier A6 graphics plugin.
Re: specular Shader AUM54 use with transparens HO [Re: Matt_Aufderheide] #80737
07/13/06 11:27
07/13/06 11:27
Joined: Oct 2004
Posts: 1,856
TheExpert Offline
Senior Developer
TheExpert  Offline
Senior Developer

Joined: Oct 2004
Posts: 1,856
why not using the normal map shader with alpha transparency from the shader list sticky?

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 Offline OP
Expert
Hummel  Offline 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 Offline OP
Expert
Hummel  Offline 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 Offline OP
Expert
Hummel  Offline 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 Offline
Serious User
ChrisB  Offline
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();
}



}





www.Swollen-Eyeballs.org
ICQ:169213431
#3dgs@quakenet
Page 1 of 2 1 2

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