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 / set effect constant vector - problem with vector3

Author
Message
mr Handy
18
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 6th Aug 2012 15:22
Hello.
I am trying to set effect float3 (color).

In DBP:
v=make vector3(1)
set vector3 1,0.5,0.75,1.0
set effect constant vector 1,"LightColor",1

In shader at the beginning:
float3 LightColor;

Result is {0,0,0}

BUT!

v=make vector4(1)
set vector4 1,0.5,0.75,1.0,0
set effect constant vector 1,"LightColor",1

works! why?

TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 6th Aug 2012 23:26
I'm not sure why it needs a vector4 but that's just how you have to do it when passing values from DBP to shaders.

TheComet

Your mod has been erased by a signature, please reduce him [overall] to no larger than 120 kg please.
Blobby 101
20
Years of Service
User Offline
Joined: 17th Jun 2006
Location: England, UK
Posted: 7th Aug 2012 00:41
Yeah, vectors in shaders are always set up as vector 4s (with the 4th as alpha) for some reason, it's kinda useful when setting some colour settings though

mr Handy
18
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 7th Aug 2012 09:43
I realized that in example for "set effect constant vector" vector4 is used. SO other vectors (3,2) are just for internal DBP using?

Although, why there is no error when parsing DBP vector4 to shader vector3?

Login to post a reply

Server time is: 2026-07-07 12:26:28
Your offset time is: 2026-07-07 12:26:28