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
2 registered members (AndrewAMD, ozgur), 1,421 guests, and 6 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 1 of 2 1 2
Where's my error here? #53934
09/01/05 12:23
09/01/05 12:23
Joined: Aug 2005
Posts: 107
NMS Offline OP
Member
NMS  Offline OP
Member

Joined: Aug 2005
Posts: 107
material Spec_ef
{
effect ="struct VS_OUT
{
float4 Position : POSITION;
float4 Diffuse : COLOR0;
float4 Specular : COLOR1;
float2 TexCoord : TEXCOORD;
};

struct VS_IN
{
float4 Position : POSITION;
float3 Normal : NORMAL;
float2 TexCoord : TEXCOORD;
};

VS_OUT main(VS_IN In)
{
VS_OUT ret;

// Transform model vertex position to
// screen space.
ret.Position = mul(In.Position, MatrixWVP);

// Transform model vertex normal to view space
float3 ViewNormal = mul(In.Normal, (float3x3)MatrixWV);
ret.Diffuse = max(0, dot(ViewNormal, LightDirection));

// Find Eye Vector by Normalizing view position
float3 ViewDir = normalize(mul((float3)In.Position, (float3x3)MatrixWV));

// Calculate reflect vector
float3 ViewReflect = reflect(-ViewNormal, LightDirection);
ret.Specular = pow(max(0, dot(ViewReflect, ViewDir)), 4);

// Output texture coordinates to pixel shader
ret.TexCoord = In.TexCoord;

return ret;
}"
}

action spec_effect
{
my.material = spec_ef;
}


Plz help me, so that i can understand once and for all.


http://www.coniserver.net/ubbthreads/showflat.php?Cat=0&Number=560847&an=0&page=0#560847 Cmon every one! Help me building this camera script! The first of its kind in 3dgs! Thnkx to everyone who helped me in my questions
Re: Where's my error here? [Re: NMS] #53935
09/01/05 12:32
09/01/05 12:32
Joined: Oct 2002
Posts: 8,939
planet.earth
ello Offline
Senior Expert
ello  Offline
Senior Expert

Joined: Oct 2002
Posts: 8,939
planet.earth
hmm, 3dgs provides matWorldViewProj; instead of MatrixWVP; and matWorldView; instead of matWorldView;

you need to set a lightdirection, too like vecSunDir; or vecLightDir[x];

your error is, that you just copied an fx-file like it was , without porting it to 3dgs style, plus your error is that you dont tell anything about what you want to achive and what errors you get in detail... thus making it hard to help


www.earthcontrol.de
quoted: We want to maintain a clean, decent, American family suited forum look... which means you may post zombies or chainsaw massacres, but no erotic.
Re: Where's my error here? [Re: ello] #53936
09/01/05 12:49
09/01/05 12:49
Joined: Aug 2005
Posts: 107
NMS Offline OP
Member
NMS  Offline OP
Member

Joined: Aug 2005
Posts: 107
I putted the code there, like you said, the errors are everything inside the effect="...";

Can you explain simplyfied what you just said?


http://www.coniserver.net/ubbthreads/showflat.php?Cat=0&Number=560847&an=0&page=0#560847 Cmon every one! Help me building this camera script! The first of its kind in 3dgs! Thnkx to everyone who helped me in my questions
Re: Where's my error here? [Re: NMS] #53937
09/01/05 19:33
09/01/05 19:33
Joined: Mar 2001
Posts: 3,298
Beverly, Massachusetts
Rhuarc Offline
Expert
Rhuarc  Offline
Expert

Joined: Mar 2001
Posts: 3,298
Beverly, Massachusetts
1) Change MatrixWV to matWorldView
2) Change MatrixWVP to matWorldViewProj
3) LightDirection isn't set, you'll have to define it. Most likely what you want to do is use the global sunlight, so put this at the top of the code:
Code:
extern float4 vecSunDir


And change LightDirection to vecSunDir in your code.

That should be it...
-Rhuarc


I no longer post on these forums, keep in touch with me via:
Linkedin.com
My MSDN blog
Re: Where's my error here? [Re: Rhuarc] #53938
09/02/05 09:35
09/02/05 09:35
Joined: Aug 2005
Posts: 107
NMS Offline OP
Member
NMS  Offline OP
Member

Joined: Aug 2005
Posts: 107
thnks to your help, most of the erros desapeared

but i'm a slow learn, and my engine is not so friend of myne, so it gives now another excuse to dont work...

I changed what you said:


----------------------------------
material Spec_ef
{
effect ="
extern float4 vecSunDir;
struct VS_OUT
{
float4 Position : POSITION;
float4 Diffuse : COLOR0;
float4 Specular : COLOR1;
float2 TexCoord : TEXCOORD;
};

struct VS_IN
{
float4 Position : POSITION;
float3 Normal : NORMAL;
float2 TexCoord : TEXCOORD;
};

VS_OUT main(VS_IN In)
{
VS_OUT ret;

// Transform model vertex position to
// screen space.
ret.Position = mul(In.Position, matWorldViewProj);

// Transform model vertex normal to view space
float3 ViewNormal = mul(In.Normal, (float3x3)matWorldView);
ret.Diffuse = max(0, dot(ViewNormal, LightDirection));

// Find Eye Vector by Normalizing view position
float3 ViewDir = normalize(mul((float3)In.Position, (float3x3)matWorldView));

// Calculate reflect vector
float3 ViewReflect = reflect(-ViewNormal, LightDirection);
ret.Specular = pow(max(0, dot(ViewReflect, ViewDir)), 4);

// Output texture coordinates to pixel shader
ret.TexCoord = In.TexCoord;

return ret;
}";
} <---------------------------this-last-line---------------


-----------------------------------------------

but now the engine says that there's an erros in the last line.
did i fail in something?
I thnik didnt catch the "extern float4 vecSunDir;" to well.



I have the 6.12 version of the engine, my browser dont let me update, it says "link is broken!". reinstalation dont fix it, and i dont want to format my pc so soon, if someone could send me the update.

Last edited by NMS; 09/02/05 09:59.

http://www.coniserver.net/ubbthreads/showflat.php?Cat=0&Number=560847&an=0&page=0#560847 Cmon every one! Help me building this camera script! The first of its kind in 3dgs! Thnkx to everyone who helped me in my questions
Re: Where's my error here? [Re: NMS] #53939
09/02/05 09:50
09/02/05 09:50
Joined: Oct 2002
Posts: 8,939
planet.earth
ello Offline
Senior Expert
ello  Offline
Senior Expert

Joined: Oct 2002
Posts: 8,939
planet.earth
effect="..."; - you missed the semicolon


www.earthcontrol.de
quoted: We want to maintain a clean, decent, American family suited forum look... which means you may post zombies or chainsaw massacres, but no erotic.
Re: Where's my error here? [Re: ello] #53940
09/02/05 09:56
09/02/05 09:56
Joined: Aug 2005
Posts: 107
NMS Offline OP
Member
NMS  Offline OP
Member

Joined: Aug 2005
Posts: 107
looooool
ops...

but there's still a problem:




The code:

----------------------------------
material Spec_ef
{
effect ="
extern float4 vecSunDir
struct VS_OUT
{
float4 Position : POSITION;
float4 Diffuse : COLOR0;
float4 Specular : COLOR1;
float2 TexCoord : TEXCOORD;
};

struct VS_IN
{
float4 Position : POSITION;
float3 Normal : NORMAL;
float2 TexCoord : TEXCOORD;
};

VS_OUT main(VS_IN In)
{
VS_OUT ret;

// Transform model vertex position to
// screen space.
ret.Position = mul(In.Position, matWorldViewProj);

// Transform model vertex normal to view space
float3 ViewNormal = mul(In.Normal, (float3x3)matWorldView);
ret.Diffuse = max(0, dot(ViewNormal, LightDirection));

// Find Eye Vector by Normalizing view position
float3 ViewDir = normalize(mul((float3)In.Position, (float3x3)matWorldView));

// Calculate reflect vector
float3 ViewReflect = reflect(-ViewNormal, LightDirection);
ret.Specular = pow(max(0, dot(ViewReflect, ViewDir)), 4);

// Output texture coordinates to pixel shader
ret.TexCoord = In.TexCoord;

return ret;
}";
}
----------------------------------

Last edited by NMS; 09/02/05 10:02.

http://www.coniserver.net/ubbthreads/showflat.php?Cat=0&Number=560847&an=0&page=0#560847 Cmon every one! Help me building this camera script! The first of its kind in 3dgs! Thnkx to everyone who helped me in my questions
Re: Where's my error here? [Re: NMS] #53941
09/02/05 13:30
09/02/05 13:30
Joined: Aug 2005
Posts: 107
NMS Offline OP
Member
NMS  Offline OP
Member

Joined: Aug 2005
Posts: 107

3) LightDirection isn't set, you'll have to define it. Most likely what you want to do is use the global sunlight, so put this at the top of the code:
Code:

extern float4 vecSunDir


"And change LightDirection to vecSunDir in your code." ----> how do i do that?


http://www.coniserver.net/ubbthreads/showflat.php?Cat=0&Number=560847&an=0&page=0#560847 Cmon every one! Help me building this camera script! The first of its kind in 3dgs! Thnkx to everyone who helped me in my questions
Re: Where's my error here? [Re: NMS] #53942
09/02/05 14:05
09/02/05 14:05
Joined: Oct 2002
Posts: 8,939
planet.earth
ello Offline
Senior Expert
ello  Offline
Senior Expert

Joined: Oct 2002
Posts: 8,939
planet.earth
example:
ret.Diffuse = max(0, dot(ViewNormal, vecSunDir)); //it may be that you need to use -vecSunDir


www.earthcontrol.de
quoted: We want to maintain a clean, decent, American family suited forum look... which means you may post zombies or chainsaw massacres, but no erotic.
Re: Where's my error here? [Re: ello] #53943
09/02/05 15:43
09/02/05 15:43
Joined: Mar 2001
Posts: 3,298
Beverly, Massachusetts
Rhuarc Offline
Expert
Rhuarc  Offline
Expert

Joined: Mar 2001
Posts: 3,298
Beverly, Massachusetts
Actually... it's -vecSunDir.zyx if I remember right- for some reason the light vector is flipped funny in A6....
-Rhuarc


I no longer post on these forums, keep in touch with me via:
Linkedin.com
My MSDN blog
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