Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, Akow, degenerate_762), 1,430 guests, and 9 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 3 of 8 1 2 3 4 5 6 7 8
Re: [Supply] Matt's NormalMapping shader with 3 li [Re: xXxGuitar511] #118000
03/22/07 01:17
03/22/07 01:17
Joined: Aug 2001
Posts: 2,320
Alberta, Canada
William Offline
Expert
William  Offline
Expert

Joined: Aug 2001
Posts: 2,320
Alberta, Canada
Quote:

struct VS_OUTPUT0
{
float4 Pos : POSITION;
float2 Tex : TEXCOORD0;
float3 View : TEXCOORD1;

float3 Light1 : TEXCOORD2;
float Att1 : TEXCOORD3;
float3 Sun : TEXCOORD6;

float3 Light2 : TEXCOORD4;
float Att2 : TEXCOORD5;

float Fog : FOG;
};


VS_OUTPUT0 VS_PASS0(float4 Pos : POSITION, float2 texcoord0 : TEXCOORD0, float3 Normal : NORMAL, float3 Tangent : TEXCOORD0 )
{
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);

float3 Viewer = PosWorld - vecViewPos;
Out.View = mul(worldToTangentSpace, - Viewer); // V

Out.Sun = mul(worldToTangentSpace, -vecSunDir);

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

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

Out.Att2 = distance(PosWorld,vecLightPos[1])/vecLightPos[1].w; // Point light

float ofog = 1 - (distance(PosWorld, vecViewPos) - vecFog.x) * (vecFog.z);
Out.Fog = ofog;

return Out;
}




I tried adding it, but it gives an error and defaults to vertex lighting material. Then I added "float3 Sun : TEXCOORD6;" and theres no error, but it doesn't show the first light properly(and still no sun). I've also tried messing in the PS part and edited out light1 and put in Sun instead, but no luck. Am I messing things up?


Check out Silas. www.kartsilas.com

Hear my band Finding Fire - www.myspace.com/findingfire

Daily dev updates - http://kartsilas.blogspot.com/
Re: [Supply] Matt's NormalMapping shader with 3 li [Re: William] #118001
03/22/07 14:10
03/22/07 14:10
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
I added some stuff, I'm gonna go "debug" it...

I'll post my results soon...


xXxGuitar511
- Programmer
Re: [Supply] Matt's NormalMapping shader with 3 li [Re: xXxGuitar511] #118002
03/22/07 23:59
03/22/07 23:59
Joined: Aug 2001
Posts: 2,320
Alberta, Canada
William Offline
Expert
William  Offline
Expert

Joined: Aug 2001
Posts: 2,320
Alberta, Canada
Will be looking forward to it. Thanks for your help.


Check out Silas. www.kartsilas.com

Hear my band Finding Fire - www.myspace.com/findingfire

Daily dev updates - http://kartsilas.blogspot.com/
Re: [Supply] Matt's NormalMapping shader with 3 li [Re: William] #118003
03/24/07 16:26
03/24/07 16:26
Joined: Jul 2002
Posts: 1,364
Minbar
M
MaxF Offline
Serious User
MaxF  Offline
Serious User
M

Joined: Jul 2002
Posts: 1,364
Minbar
Hi

Its not working for me, it looks like the model is not change by the shader

What I'm doing wrong?

1) Put the shader in a fx file
2) wrote a wdl with the following statement:

material mat_nm3lights
{
effect = "nm3light.fx";
}

3) attached material in WED to model


Re: [Supply] Matt's NormalMapping shader with 3 li [Re: MaxF] #118004
03/24/07 18:09
03/24/07 18:09
Joined: Aug 2006
Posts: 652
Netherlands
bstudio Offline
User
bstudio  Offline
User

Joined: Aug 2006
Posts: 652
Netherlands
did you include a light near the model (dynamic light that is)


BASIC programmers never die, they GOSUB and don't RETURN.
Re: [Supply] Matt's NormalMapping shader with 3 li [Re: bstudio] #118005
03/24/07 20:31
03/24/07 20: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
add in effect_load() in a starter function


Code:

string fxNM3Light = "nm3light.fx";

material mat_nm3lights
{
effect = fxNM3Light;
}

starter loadFX
{
effect_load(mat_nm3lights, fxNM3Light);
}




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

Joined: Mar 2006
Posts: 2,503
SC, United States
just thought I'd let you know I'm still workin on this. I accidently coppied it onto my work drive instead of my thumbdrive, so I havn't been able to work on it this weekend.

So far I [theoretically] have 5 lights in one pass. It should work, but needs to be tested. I did this by copying the light AttenuationX into the LightX:TEXCOORDX.

I'll be at work tomorrow, and post my results...


xXxGuitar511
- Programmer
Re: [Supply] Matt's NormalMapping shader with 3 li [Re: xXxGuitar511] #118007
03/26/07 04:38
03/26/07 04:38
Joined: Aug 2001
Posts: 2,320
Alberta, Canada
William Offline
Expert
William  Offline
Expert

Joined: Aug 2001
Posts: 2,320
Alberta, Canada
Np, I'm looking forward to testing it.

BTW - why 5 lights in one pass? Is this needed to allow sunlight?


Check out Silas. www.kartsilas.com

Hear my band Finding Fire - www.myspace.com/findingfire

Daily dev updates - http://kartsilas.blogspot.com/
Re: [Supply] Matt's NormalMapping shader with 3 li [Re: William] #118008
03/26/07 06:41
03/26/07 06:41
Joined: Aug 2006
Posts: 652
Netherlands
bstudio Offline
User
bstudio  Offline
User

Joined: Aug 2006
Posts: 652
Netherlands
starter is no longer used as a function, to use a starter function use this:

Code:

function LoadFX_startup()
{
effect_load(mat_nm3lights, fxNM3Light);
}




BASIC programmers never die, they GOSUB and don't RETURN.
Re: [Supply] Matt's NormalMapping shader with 3 li [Re: bstudio] #118009
03/26/07 13:15
03/26/07 13:15
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
@bstudio: Thanks, I had heard of this update, but never got around to actually using it. I'll remember that...


@William: It's not required, it's just an optimization. Using less passes, yet still getting the same effect = better speeds... correct? I currently only have 5 lights, but it still has room for more in its pass... (1 or 2 texcoords left)


xXxGuitar511
- Programmer
Page 3 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