Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by dr_panther. 05/18/24 11:01
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
2 registered members (7th_zorro, dr_panther), 724 guests, and 3 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
Page 5 of 8 1 2 3 4 5 6 7 8
Re: [Supply] Matt's NormalMapping shader with 3 li [Re: xXxGuitar511] #118020
03/29/07 01:31
03/29/07 01:31
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
Alright... it's finished! (for now)...


It currently runs through 2 passes, supports 3 dynamic light, sun light, static lighting, and more...


Who wants to host it? I'll email it to you...


xXxGuitar511
- Programmer
Re: [Supply] Matt's NormalMapping shader with 3 li [Re: xXxGuitar511] #118021
03/29/07 02:27
03/29/07 02:27
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
Here it is for now... I'm not sure how long the link will hold up though...


Download Here


xXxGuitar511
- Programmer
Re: [Supply] Matt's NormalMapping shader with 3 li [Re: xXxGuitar511] #118022
03/29/07 06:39
03/29/07 06:39
Joined: Aug 2006
Posts: 652
Netherlands
bstudio Offline
User
bstudio  Offline
User

Joined: Aug 2006
Posts: 652
Netherlands
I'll host it for you, just gimme a sec
Download normal mapping shader
here it is

Last edited by bstudio; 03/29/07 06:41.

BASIC programmers never die, they GOSUB and don't RETURN.
Re: [Supply] Matt's NormalMapping shader with 3 li [Re: frazzle] #118023
03/29/07 09:03
03/29/07 09:03
Joined: Oct 2005
Posts: 528
Italy
M
Mondivirtuali Offline
User
Mondivirtuali  Offline
User
M

Joined: Oct 2005
Posts: 528
Italy
Well, it gave me ton of errors
this is the code
Code:
 -------------------------------------------------------------
// Diffuse and specular shader for models
// -------------------------------------------------------------
// [18/3/06 Bloodline] - Added ambient and a 3rd light


float4x4 matWorldViewProj;
float4x4 matWorld;
float4 vecLightPos[8]; //light position
float4 vecLightColor[8]; //light color
float4 vecViewPos;

// Change ambient here
float4 Ambient = { 0.6f, 0.6f, 0.6f, 1.0f };

texture entSkin1; //this is the color map
texture entSkin2; //this is the normal map

sampler sColorMap = sampler_state
{
Texture = <entSkin1>;
MinFilter = Linear;
MagFilter = Linear;
MipFilter = Linear;
AddressU = wrap;
AddressV = wrap;
};


sampler sBumpMap = sampler_state
{
Texture = <entSkin2>;
MinFilter = Linear;
MagFilter = Linear;
MipFilter = Linear;
AddressU = wrap;
AddressV = wrap;
};




///////////////////////////////////////////////////////////////////////////////////////////////////////////////
//first pass
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// -------------------------------------------------------------
// Output channels
// -------------------------------------------------------------
struct VS_OUTPUT0
{
float4 Pos : POSITION;
float2 Tex : TEXCOORD0;

float3 Light1 : TEXCOORD2;
float3 View1 : TEXCOORD3;
float3 Att1 : TEXCOORD4;

float3 Light2 : TEXCOORD5;
float3 View2 : TEXCOORD6;
float3 Att2 : TEXCOORD7;

float3 Light3 : TEXCOORD8;
float3 View3 : TEXCOORD9;
float3 Att3 : TEXCOORD10;

};

// -------------------------------------------------------------
// vertex shader function (input channels)
// -------------------------------------------------------------
VS_OUTPUT0 VS_PASS0(float4 Pos : POSITION, float2 texcoord0 : TEXCOORD0, float3 Normal : NORMAL, float3 Tangent : TEXCOORD2 )
{
VS_OUTPUT0 Out = (VS_OUTPUT0)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 LightRange = 1/vecLightPos[0].w;
float LightRange2 = 1/vecLightPos[1].w;
float LightRange3 = 1/vecLightPos[2].w;

//light 1
float3 Light1 = PosWorld - vecLightPos[0] ;
Out.Light1.xyz = mul(worldToTangentSpace, -Light1); // L

float3 Viewer1 = PosWorld - vecViewPos;
Out.View1 = mul(worldToTangentSpace, -Viewer1); // V

Out.Att1 = Light1 * LightRange; // Point light

//light 2
float3 Light2 = PosWorld - vecLightPos[1] ;
Out.Light2.xyz = mul(worldToTangentSpace, -Light2); // L

float3 Viewer2 = PosWorld - vecViewPos;
Out.View2 = mul(worldToTangentSpace, -Viewer2); // V

Out.Att2 = Light2 * LightRange2; // Point light

//light 3
float3 Light3 = PosWorld - vecLightPos[2] ;
Out.Light3.xyz = mul(worldToTangentSpace, -Light3); // L

float3 Viewer3 = PosWorld - vecViewPos;
Out.View3 = mul(worldToTangentSpace, -Viewer3); // V

Out.Att3 = Light3 * LightRange3; // Point light

return Out;
}


struct PS_INPUT0
{
float2 Tex : TEXCOORD0;

float3 Light1 : TEXCOORD2;
float3 View1 : TEXCOORD3;
float3 Att1 : TEXCOORD4;

float3 Light2 : TEXCOORD5;
float3 View2 : TEXCOORD6;
float3 Att2 : TEXCOORD7;

float3 Light3 : TEXCOORD8;
float3 View3 : TEXCOORD9;
float3 Att3 : TEXCOORD10;

};

float4 PS_PASS0( PS_INPUT0 psInStruct ):COLOR


{

float4 color = tex2D(sColorMap, psInStruct.Tex); // fetch color map
float3 bumpNormal = 2 * (tex2D(sBumpMap, psInStruct.Tex) - 0.5); // fetch bump map
float4 gloss = tex2D( sBumpMap, psInStruct.Tex );

//light1
float3 LightDir1 = normalize(psInStruct.Light1);
float3 ViewDir1 = normalize(psInStruct.View1);
float4 diff1 = saturate(dot(bumpNormal, LightDir1)); // diffuse component
float shadow1 = saturate(4 * diff1);
float3 Reflect1 = normalize(2 * diff1 * bumpNormal - LightDir1); // R
float4 spec1 = pow(saturate(dot(Reflect1, ViewDir1)), 15);
float4 Attenuation1 = saturate(dot(psInStruct.Att1, psInStruct.Att1));

//light2
float3 LightDir2 = normalize(psInStruct.Light2);
float3 ViewDir2 = normalize(psInStruct.View2);
float4 diff2 = saturate(dot(bumpNormal, LightDir2)); // diffuse component
float shadow2 = saturate(4 * diff2);
float3 Reflect2 = normalize(2 * diff2 * bumpNormal - LightDir2); // R
float4 spec2 = pow(saturate(dot(Reflect2, ViewDir2)), 15);
float4 Attenuation2 = saturate(dot(psInStruct.Att2, psInStruct.Att2));

//light3
float3 LightDir3 = normalize(psInStruct.Light3);
float3 ViewDir3 = normalize(psInStruct.View3);
float4 diff3 = saturate(dot(bumpNormal, LightDir3)); // diffuse component
float shadow3 = saturate(4 * diff3);
float3 Reflect3 = normalize(2 * diff3 * bumpNormal - LightDir3); // R
float4 spec3 = pow(saturate(dot(Reflect3, ViewDir3)), 15);
float4 Attenuation3 = saturate(dot(psInStruct.Att3, psInStruct.Att3));

return (
(0.1 * color + 0.2 * Ambient) +
((shadow1 * (color * diff1 + (spec1*gloss.w)) * (1 -Attenuation1))*vecLightColor[0])+
((shadow2 * (color * diff2 + (spec2*gloss.w)) * (1 -Attenuation2))*vecLightColor[1])+
((shadow3 * (color * diff3 + (spec3*gloss.w)) * (1 -Attenuation3))*vecLightColor[2])
);
}



// -------------------------------------------------------------
// techniques//
// -------------------------------------------------------------
technique two_pass
{
pass P0
{
alphablendenable=false;
srcblend=zero;

VertexShader = compile vs_3_0 VS_PASS0();
PixelShader = compile ps_3_0 PS_PASS0();
}



}[\code]



Re: [Supply] Matt's NormalMapping shader with 3 li [Re: Mondivirtuali] #118024
03/29/07 09:06
03/29/07 09:06
Joined: Aug 2006
Posts: 652
Netherlands
bstudio Offline
User
bstudio  Offline
User

Joined: Aug 2006
Posts: 652
Netherlands
did you put it in a .fx file and included it in a material like this:
Code:

material normal_map_map
{
effect = <normalmap.fx>;
}



Last edited by bstudio; 03/29/07 09:06.

BASIC programmers never die, they GOSUB and don't RETURN.
Re: [Supply] Matt's NormalMapping shader with 3 li [Re: bstudio] #118025
03/29/07 10:31
03/29/07 10:31
Joined: Oct 2005
Posts: 528
Italy
M
Mondivirtuali Offline
User
Mondivirtuali  Offline
User
M

Joined: Oct 2005
Posts: 528
Italy
ah Yes
this was the script
Code:
  // Diffuse and specular shader for models
// -------------------------------------------------------------
// [18/3/06 Bloodline] - Added ambient and a 3rd light
MATERIAL mtl_newman2
{

float4x4 matWorldViewProj;
float4x4 matWorld;
float4 vecLightPos[8]; //light position
float4 vecLightColor[8]; //light color
float4 vecViewPos;....



ton of errors




Last edited by Mondivirtuali; 03/29/07 10:31.
Re: [Supply] Matt's NormalMapping shader with 3 li [Re: Mondivirtuali] #118026
03/29/07 10:56
03/29/07 10:56
Joined: Oct 2005
Posts: 528
Italy
M
Mondivirtuali Offline
User
Mondivirtuali  Offline
User
M

Joined: Oct 2005
Posts: 528
Italy
Now works, I just use the NM files from Bstudio.

Re: [Supply] Matt's NormalMapping shader with 3 li [Re: Mondivirtuali] #118027
03/29/07 11:11
03/29/07 11:11
Joined: Oct 2005
Posts: 528
Italy
M
Mondivirtuali Offline
User
Mondivirtuali  Offline
User
M

Joined: Oct 2005
Posts: 528
Italy


the risult

the maps






Re: [Supply] Matt's NormalMapping shader with 3 li [Re: Mondivirtuali] #118028
03/29/07 11:28
03/29/07 11:28
Joined: Jan 2006
Posts: 1,829
Neustadt, Germany
T
TWO Offline OP

Serious User
TWO  Offline OP

Serious User
T

Joined: Jan 2006
Posts: 1,829
Neustadt, Germany
Ugly modell ^^

Yes, the shader you posted was outdated

Re: [Supply] Matt's NormalMapping shader with 3 li [Re: TWO] #118029
03/29/07 13:31
03/29/07 13:31
Joined: Oct 2005
Posts: 528
Italy
M
Mondivirtuali Offline
User
Mondivirtuali  Offline
User
M

Joined: Oct 2005
Posts: 528
Italy
A test model, just an exercise for verify how the work flow ( modelling, texturing, animating and shaders ) does work.

Page 5 of 8 1 2 3 4 5 6 7 8

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