Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (Ayumi, AndrewAMD), 1,112 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
_var and global VECTOR definitions #420976
04/07/13 23:29
04/07/13 23:29
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline OP
Senior Expert
HeelX  Offline OP
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
Hi,

I want to access d3d_spotlightcone in a shader and wondered why I can't read out the falloff. To test it, I wrote

Code:
float3 d3d_spotlightcone_var;

color.rgb = d3d_spotlightcone_var.rgb;
return color;



The screen turns red and I can change the redness, if I change d3d_spotlightcone.x into the range 0...1; if I change d3d_spotlightcone.y or d3d_spotlightcone.z, nothing happens.

This implies, that only the .x component is accessible via _var and .y and .z components of a vector are always = 0. I doublechecked with e.g. d3d_fogcolor1 and the same observations can be made.

Re: _var and global VECTOR definitions [Re: HeelX] #421001
04/08/13 13:35
04/08/13 13:35
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
I'm pretty sure that _var is only for transferring data from vectors that are defined in your script. It is not for system variables, which are stored in a different way.

Please try it. You can find an example in the manual how to use _var shader variables. This should also work for VECTOR structs. Please post here again if you encounter a problem.

Re: _var and global VECTOR definitions [Re: jcl] #421014
04/08/13 15:27
04/08/13 15:27
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline OP
Senior Expert
HeelX  Offline OP
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
Originally Posted By: jcl
It is not for system variables, which are stored in a different way.
It works at least for d3d_alpharef.

Originally Posted By: jcl
This should also work for VECTOR structs.
I am not interested into making a global vector, copy the contents of d3d_spotlightcone into it and access it in my shader - because I strongly believe that all official shader variables should be accessible in actual shaders via something like "float3 vecSpotlightcone" or with _var/_flt.

Since because I am working with point and spotlights atm, I only can think of d3d_pointlightfalloff, d3d_spotlightfalloff and d3d_spotlightcone, which aren't supported. But this counts for e.g. detail_size as well. It would be just plain nice if they would be supported as all those other variables.


Moderated by  jcl, Nems, Spirit, Tobias 

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