Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AbrahamR, AndrewAMD), 1,305 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How to change shader code variable dynamically? #163779
10/27/07 18:48
10/27/07 18:48
Joined: Aug 2005
Posts: 1,558
HK
V
vlau Offline OP
Serious User
vlau  Offline OP
Serious User
V

Joined: Aug 2005
Posts: 1,558
HK
Is there any way to change the shader code variable
at runtime? Here is an example :

// main.c
float myValue = 0.65; // this value may change at runtime

void main()
{
.....
.....
}

// Here is the part of the shader code copied
// from Terrain multitexture of mtlFX.c
//....
//....
// Add the vertex light and shadow map
#ifdef SHADOWMAP
//entry: Shadow Map Offset
//cntl: spin 0 1.0 0.05
//help: Light offset (0..1) to be subtracted from the shadow map

float offset = myValue;

FinalColor *= In.Color + (MaskColor.b - offset);

Thanks for any help.

Re: How to change shader code variable dynamically? [Re: vlau] #163780
10/29/07 05:55
10/29/07 05:55
Joined: Aug 2005
Posts: 1,558
HK
V
vlau Offline OP
Serious User
vlau  Offline OP
Serious User
V

Joined: Aug 2005
Posts: 1,558
HK
I've succeed to pass "myValue" variable via vecSkill1,
but still looking for other easier solutions.

Thanks again!

Re: How to change shader code variable dynamically [Re: vlau] #163781
10/29/07 06:11
10/29/07 06:11
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
check here for some ideas on a useful DLL. go down to Matt's first reply. no, it isn't easier than using vecSkill1 or something, but if you need to use more values later i'm sure it can help.

once you establish a useful function (i haven't given it a go) it could be a very clean solution which allows you a lot of flexibility.

i hope this is of some use.

julz


Formerly known as JulzMighty.
I made KarBOOM!
Re: How to change shader code variable dynamically [Re: JibbSmart] #163782
10/29/07 14:01
10/29/07 14:01
Joined: Aug 2005
Posts: 1,558
HK
V
vlau Offline OP
Serious User
vlau  Offline OP
Serious User
V

Joined: Aug 2005
Posts: 1,558
HK
Thanks for your link Julz. Not more than 2 variables to be
passed right now, I would like to use vecSkill1... at the
moment but keep Matt's method in my HDD for future use.

Thanks!


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