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, 1 invisible), 1,417 guests, and 12 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Beginner question: Why is everything black? #50186
07/24/05 13:45
07/24/05 13:45
Joined: Aug 2002
Posts: 44
Panama City, FL
S
Specterdragon Offline OP
Newbie
Specterdragon  Offline OP
Newbie
S

Joined: Aug 2002
Posts: 44
Panama City, FL
Oh mighty gurus of the shader world!!! Lend me you brains for a moment.

I'm just starting out using shaders, so thought I'd make a go of it using HLSL (at least I can understand that LOL... the assembly was killing me). So here's the problem...

I've created a basic shader that should transform the object into proper world/view space and then use flat red coloring. This is intended to be the basis for future procedural shaders to come, so it's pretty simple. What's happening is that the object is projecting correctly, but the color is a solid black... I'm assuming that my output for the pixel color is wrong, but I'm not sure where I messed up. (For the record, I checked the fog. Fog is disabled - I actually saw the effect of fog with this shader... not pretty LOL.)

Code:
 material mat_basic_shader
{

effect = "

float4x4 matWorldViewProj;


struct VS_OUTPUT
{
float4 Position : POSITION;

};

VS_OUTPUT vs_main( float4 pos: POSITION )
{
VS_OUTPUT Output;

Output.Position = mul( pos, matWorldViewProj );

return( Output );

}

float4 ps_main() : COLOR0
{
return( float4( 1.0f, 0.0f, 0.0f, 1.0f ) );

}

technique primary
{
pass p0
{
VertexShader = compile vs_2_0 vs_main();
PixelShader = compile ps_2_0 ps_main();
}
}

";

}

action basic_obj
{
wait(1);
my.material = mat_basic_shader;

}



Anyone know how to get what I'm after? I'm at a bit of a loss to see what I missed.

Thanks


Just thinking out loud, Specterdragon
Re: Beginner question: Why is everything black? [Re: Specterdragon] #50187
07/24/05 21:55
07/24/05 21:55
Joined: Mar 2001
Posts: 3,298
Beverly, Massachusetts
Rhuarc Offline
Expert
Rhuarc  Offline
Expert

Joined: Mar 2001
Posts: 3,298
Beverly, Massachusetts
Perhaps your card does not support PS2.0... Change these two lines to match what I have here:
Quote:


VertexShader = compile vs_1_0 vs_main();
PixelShader = compile ps_1_1 ps_main();





-Rhuarc


I no longer post on these forums, keep in touch with me via:
Linkedin.com
My MSDN blog
Re: Beginner question: Why is everything black? [Re: Rhuarc] #50188
07/24/05 21:58
07/24/05 21:58
Joined: Aug 2002
Posts: 44
Panama City, FL
S
Specterdragon Offline OP
Newbie
Specterdragon  Offline OP
Newbie
S

Joined: Aug 2002
Posts: 44
Panama City, FL
Thought of that... but I've confermed that my card does support the higher VS/PS.

On top of that, I've tried to lower the VS/PS version to 1_0... same results.

I know this shader works, because this is the default for RenderMonkey; and I have no difficulty running that program in vs/ps 2_0


Just thinking out loud, Specterdragon
Re: Beginner question: Why is everything black? [Re: Specterdragon] #50189
07/24/05 22:09
07/24/05 22:09
Joined: Mar 2001
Posts: 3,298
Beverly, Massachusetts
Rhuarc Offline
Expert
Rhuarc  Offline
Expert

Joined: Mar 2001
Posts: 3,298
Beverly, Massachusetts
To ensure fog isn't used on the object, add this to the pass:
Code:
EnableFog = false;



Beyond that, the shader looks perfectly fine to me, it should render a red object.... What version/edition of A6 are you running?


I no longer post on these forums, keep in touch with me via:
Linkedin.com
My MSDN blog
Re: Beginner question: Why is everything black? [Re: Rhuarc] #50190
07/25/05 00:06
07/25/05 00:06
Joined: Aug 2002
Posts: 44
Panama City, FL
S
Specterdragon Offline OP
Newbie
Specterdragon  Offline OP
Newbie
S

Joined: Aug 2002
Posts: 44
Panama City, FL
I'm using A6 v6.31.4

When I added EnableFog = false; to the pass, I get an error:

Error in effect:
Mat_basic_sgader(38): ID3DXEffectCompiler: Unrecognised state 'EnableFog'

So I played around with it a little, and I THINK its working (finally), but the command looked like this:

fogenable = false;

Thanks for the assist!!!
Now.... If only I could figure out the command to subtract one vector from another inside the shader....


Just thinking out loud, Specterdragon

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