Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (AndrewAMD, TipmyPip), 16,005 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 5 1 2 3 4 5
My first shader is not working #323841
05/17/10 19:22
05/17/10 19:22
Joined: Apr 2010
Posts: 56
Badrizmo Offline OP
Junior Member
Badrizmo  Offline OP
Junior Member

Joined: Apr 2010
Posts: 56
I have studied the first three lessons in the shader tutorial and tried to use the Ambient shader in a test level, but nothing happens. Here is what I did

In my level script file, I added this block
Click to reveal..

MATERIAL* Ambient=
{
ambient_red = 250; // The ambient color.
ambient_green = 64;
ambient_blue = 64;
effect = "Ambient.fx";
}

The Ambient.fx contains the following code
Click to reveal..

/***********************************************************************************************
/ Copyright 2006 by Taco Cohen. All rights reserved
/***********************************************************************************************/

/***********************************************************************************************
/ Ambient Lighting Shader
/
/ OUTLINE:
/ This shader draws the object in a solid color given by the materials ambient color.
/
/ IMPLEMENTATION:
/ The vertex shader transforms the vertex to clip space. The pixel shader multiplies the
/ ambient color by the ambient intensity and returns that as the final pixel color.
/
/ NOTES:
/ -
/***********************************************************************************************/

/***********************************************************************************************
/ Global Variables:
/***********************************************************************************************/
// Tweakables:
static const float AmbientIntensity = 1.0f; // The intensity of the ambient light.

// Application fed data:
const float4x4 matWorldViewProj; // World*view*projection matrix.
const float4 vecAmbient; // Ambient color, passed by the engine.

/***********************************************************************************************
/ Vertex Shader:
/***********************************************************************************************/
void AmbientVS( in float4 InPos : POSITION,
out float4 OutPos : POSITION)
{
// Transform the vertex from object space to clip space:
OutPos = mul(InPos, matWorldViewProj);
}

/***********************************************************************************************
/ Pixel Shader:
/***********************************************************************************************/
float4 AmbientPS() : COLOR
{
return AmbientIntensity * vecAmbient;
}

/***********************************************************************************************
/ Technique:
/***********************************************************************************************/
technique AmbientTechnique
{
pass P0
{
VertexShader = compile vs_1_1 AmbientVS();
PixelShader = compile ps_1_1 AmbientPS();
}
}

In WED
1- Added a cube,
2- Hollow the cube
3- scope to the cube
4- selected the bottom face of the hollow cube,
5- clicked on properties and selected "Ambient=" as my material

Compiled the level with the "Create meshes" options,

Re: My first shader is not working [Re: Badrizmo] #323843
05/17/10 19:39
05/17/10 19:39
Joined: Nov 2009
Posts: 89
Germany, NRW
T
TrackingKeks Offline
Junior Member
TrackingKeks  Offline
Junior Member
T

Joined: Nov 2009
Posts: 89
Germany, NRW
Try to use the shader with an entity or attach it in the script:

my.material=Ambient;

Last edited by TrackingKeks; 05/17/10 19:41.

Gamestudio: A7.82 Commercial/A8 Commercial
System specs (Laptop):
Windows 7 64bit
DirectX v10.1
Intel Core i7-720QM CPU @ 1,60 GHz
4GB DDR2 Ram
NVIDIA GeForce GT 230M (1024MB)
Re: My first shader is not working [Re: Badrizmo] #323844
05/17/10 19:40
05/17/10 19:40
Joined: Nov 2008
Posts: 196
the wrong place
Muhsin Offline
Member
Muhsin  Offline
Member

Joined: Nov 2008
Posts: 196
the wrong place
which gamestudio version do you use?


Come and play my new browsergame - Valley Of Wolves:

http://www.mafiacreator.com/ValleyOfWolves

Hurry and be the first to take over the different business' in the Valley Of Wolves, before anybody else does it!
And be the most feared MafiaBoss in the World!!
Re: My first shader is not working [Re: Muhsin] #323845
05/17/10 19:53
05/17/10 19:53
Joined: Jun 2008
Posts: 428
Rasch Offline
Senior Member
Rasch  Offline
Senior Member

Joined: Jun 2008
Posts: 428
Pro xD

Re: My first shader is not working [Re: Rasch] #323847
05/17/10 20:00
05/17/10 20:00
Joined: Jul 2004
Posts: 1,710
MMike Offline
Serious User
MMike  Offline
Serious User

Joined: Jul 2004
Posts: 1,710
the topic is sooo funny, because thats the most probable thing to happen. the first time is most of the times a fail.

Re: My first shader is not working [Re: Badrizmo] #323848
05/17/10 20:00
05/17/10 20:00
Joined: Nov 2009
Posts: 89
Germany, NRW
T
TrackingKeks Offline
Junior Member
TrackingKeks  Offline
Junior Member
T

Joined: Nov 2009
Posts: 89
Germany, NRW
Are you sure that you do not use A7.07?
Because then you should probably switch to A7 free..
Then it should work. xD


Gamestudio: A7.82 Commercial/A8 Commercial
System specs (Laptop):
Windows 7 64bit
DirectX v10.1
Intel Core i7-720QM CPU @ 1,60 GHz
4GB DDR2 Ram
NVIDIA GeForce GT 230M (1024MB)
Re: My first shader is not working [Re: TrackingKeks] #323850
05/17/10 20:05
05/17/10 20:05
Joined: Nov 2008
Posts: 196
the wrong place
Muhsin Offline
Member
Muhsin  Offline
Member

Joined: Nov 2008
Posts: 196
the wrong place
Badrizmo, I'm not sure, but It may be because you use an old version. what is the version number? try to update you PROFESSIONAL version.


Come and play my new browsergame - Valley Of Wolves:

http://www.mafiacreator.com/ValleyOfWolves

Hurry and be the first to take over the different business' in the Valley Of Wolves, before anybody else does it!
And be the most feared MafiaBoss in the World!!
Re: My first shader is not working [Re: TrackingKeks] #323858
05/17/10 21:42
05/17/10 21:42
Joined: Apr 2010
Posts: 56
Badrizmo Offline OP
Junior Member
Badrizmo  Offline OP
Junior Member

Joined: Apr 2010
Posts: 56
Originally Posted By: TrackingKeks
Try to use the shader with an entity or attach it in the script:

my.material=Ambient;


both ways didn't work frown

Re: My first shader is not working [Re: Muhsin] #323859
05/17/10 21:44
05/17/10 21:44
Joined: Apr 2010
Posts: 56
Badrizmo Offline OP
Junior Member
Badrizmo  Offline OP
Junior Member

Joined: Apr 2010
Posts: 56
Originally Posted By: Muhsin
which gamestudio version do you use?

Gamestudio Pro 7.04 /Wed v6.8291

Re: My first shader is not working [Re: MMike] #323860
05/17/10 21:45
05/17/10 21:45
Joined: Apr 2010
Posts: 56
Badrizmo Offline OP
Junior Member
Badrizmo  Offline OP
Junior Member

Joined: Apr 2010
Posts: 56
Originally Posted By: MMike
the topic is sooo funny, because thats the most probable thing to happen. the first time is most of the times a fail.


Well you are totally right, I'm trying my best to pass this ASAP grin

Page 1 of 5 1 2 3 4 5

Moderated by  Blink, Hummel, Superku 

Gamestudio download | 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