Gamestudio Links
Zorro Links
Newest Posts
What are you working on?
by rayp. 10/15/25 20:44
Help!
by VoroneTZ. 10/14/25 05:04
Zorro 2.70
by jcl. 10/13/25 09:01
ZorroGPT
by TipmyPip. 10/12/25 13:58
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 10/11/25 18:45
Reality Check results on my strategy
by dBc. 10/11/25 06:15
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (TipmyPip, AndrewAMD), 6,732 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
joenxxx, Jota, krishna, DrissB, James168
19170 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: 28,028
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,028
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 | 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