Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Changing FX file data

Author
Message
Iain
22
Years of Service
User Offline
Joined: 17th Jun 2004
Location: UK
Posted: 5th Jul 2010 13:35
Hi, does anyone know how you can affect an fx file from darkbasic, for example change the amount of specular on a bump map by passing the values over to the fx file in real time?
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 5th Jul 2010 13:39
Unless it's a 'tweakable' value you can't change it realtime without re-loading the effect...

Maybe post the shader and someone will explain it to you?

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 5th Jul 2010 13:48 Edited at: 5th Jul 2010 13:50
set effect constant float
set effect constant vector
set effect constant matrix
set effect technique

(etc)

You could look at one of the many examples on the numerous shader threads here.

The commands are listed in the Help file under APPEARANCE COMMANDS, not under SHADER COMMANDS for some odd reason.

Simple example:

set effect constant float 1, "specLevel", 1.2

That refers to effect 1, the constant "specLevel" in the shader, and 1.2 is the value you wish to change to.

Vectors must be vector4's but you can pass these to float2's or float3's in the FX file if you wish - the extra entries are simply ignored by the shader.

Edit I think baxslash may have interpreted you literally. Do you really want to change the FX file itself? The commands I've listed just change the values used by the loaded effect - which is what we usually need.
Iain
22
Years of Service
User Offline
Joined: 17th Jun 2004
Location: UK
Posted: 5th Jul 2010 13:57
Thanks for the replys, yes i just want to change the values in theloaded shader, so what youve said Gandelf is a great help,thanks again,will get trying those commands out.
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 5th Jul 2010 13:59
Quote: "I think baxslash may have interpreted you literally"

I often do, sorry. I nearly added "Green Gandalf will probably explain how to edit shader values to you" or something along those lines but didn't want to be presumptuous...

Iain
22
Years of Service
User Offline
Joined: 17th Jun 2004
Location: UK
Posted: 5th Jul 2010 14:03
Lol, thanks again.

Login to post a reply

Server time is: 2026-07-25 08:13:29
Your offset time is: 2026-07-25 08:13:29