Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (Ayumi), 1,170 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
shader depending on vars? #203948
04/25/08 09:10
04/25/08 09:10
Joined: May 2006
Posts: 50
austria
R
roald Offline OP
Junior Member
roald  Offline OP
Junior Member
R

Joined: May 2006
Posts: 50
austria
good morning comm!!

well, a question to all that shadergurus out there: is it possible to manage shaderparameters depending on gamevars?

example:
the saturation (or any other parameter of a shader) of a texture (of a model) should be definend by distance to the player; if the player is nearby or is less then xy quants to the object the saturation should not be modified; if the distance between player/object grows, saturation should be reduced depending on the the dictance until saturation equals zero;

is it possible to do this EASY??

thanks for paying attention

roald

roald´s home

Re: shader depending on vars? [Re: roald] #203951
04/25/08 10:12
04/25/08 10:12
Joined: Jan 2003
Posts: 4,615
Cambridge
Joey Offline
Expert
Joey  Offline
Expert

Joined: Jan 2003
Posts: 4,615
Cambridge
it is. look for vecSkill1 in the manual.

Re: shader depending on vars? [Re: Joey] #203980
04/25/08 14:25
04/25/08 14:25
Joined: Oct 2005
Posts: 4,771
Bay City, MI
lostclimate Offline
Expert
lostclimate  Offline
Expert

Joined: Oct 2005
Posts: 4,771
Bay City, MI
it is sorta easy but the manual makes it more confusing than it is.
the entity has skills and skill 41-44 are sent to the shader.

in the shader these values can be obtained thru 1 float4 for called vecSkill1.
note all of these values are in vecSkill1

skill41=vecSkill1.x;
skill42=vecSkill1.y;
skill43=vecSkill1.z;
skill44=vecSkill1.w;


also when ever sending a value this is incorrect:
skill41=my.pan;

since a7's variables are different then a shader float you need to send it like this:

skill41=float(my.pan);

Re: shader depending on vars? [Re: lostclimate] #203985
04/25/08 14:40
04/25/08 14:40
Joined: May 2005
Posts: 2,713
Lübeck
Slin Offline
Expert
Slin  Offline
Expert

Joined: May 2005
Posts: 2,713
Lübeck
That is not right lostclimate ;\)
Each material has skill1 to skill20 those can be accessed from a shader through float4 vecSkill1; //skill1-4
float4 vecSkill5; //skill5-8
float4 vecSkill9; //skill9-12
float4 vecSkill13; //skill13-16
float4 vecSkill17; //skill17-20

And there are also the entityskills 41 to 44 (41 to 48 since A7.07) which can be accessed from a shader through:
float4 vecSkill41; //skill41-44
float4 vecSkill45; //skill45-48

If you want to pass a gamestudio var to a shader you have to use floatv() (float() with A6) to convert it to float.

You can also pass one matrix to a shader (8 with the latest beta). Just set the material matrix and use it within the shader as float4x4 matMtl.

Re: shader depending on vars? [Re: Slin] #204012
04/25/08 16:58
04/25/08 16:58
Joined: Oct 2005
Posts: 4,771
Bay City, MI
lostclimate Offline
Expert
lostclimate  Offline
Expert

Joined: Oct 2005
Posts: 4,771
Bay City, MI
??? i thought he was talking strictly about entity skills (not mat skills,) but either way, i thought 41-45 only went to one float4 that was accesible

Re: shader depending on vars? [Re: lostclimate] #204050
04/25/08 22:39
04/25/08 22:39
Joined: Jul 2006
Posts: 503
Australia
A
adoado Offline

User
adoado  Offline

User
A

Joined: Jul 2006
Posts: 503
Australia
Also, I think you need to convert the value to a float:

mtl.skill1 = flloatv(SomeValue);

Thanks ^^
Adoado


Visit our development blog: http://yellloh.com
Re: shader depending on vars? [Re: roald] #204432
04/29/08 09:14
04/29/08 09:14
Joined: May 2006
Posts: 50
austria
R
roald Offline OP
Junior Member
roald  Offline OP
Junior Member
R

Joined: May 2006
Posts: 50
austria
thx guys, now i know in which direction i have to do my "tests"

roald

roalds home:www.playpublic.com


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