Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (1 invisible), 672 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
passing float to pixelshader #365083
03/23/11 11:09
03/23/11 11:09
Joined: Feb 2005
Posts: 3,687
Hessen, Germany
T
Tempelbauer Offline OP
Expert
Tempelbauer  Offline OP
Expert
T

Joined: Feb 2005
Posts: 3,687
Hessen, Germany
hi
i´m new to shaders

i have a simple question: how to pass a float-var (from lite-c) to a pixelshader by keeping it´s precision. the float-value i want to pass has a range about [4,0) with the maximum precision-deep. possible values are (for example):
Code:
float mx;
mx = 4.0;
mx = 0.7;
mx = 0.00002;
mx = ...



my shader works correctly for mx >= 0.0005. in the other cases the value i got in the shader is 0. So i guess the value will be converted to a var before passing --> the precision is lost.

i´m confused:
- the manual says that the skills are type of var (http://www.conitec.net/manual_d/aentity-skill.htm)
- in the shader the skills are available in float4 (http://www.conitec.net/manual_d/Shader-entskill.htm)
- to pass a var i have to use floatv(). this function expects a var and converts it into a ieee-float (for the shader)

so: is it possible at all to pass a float when the skills are typeof var?? how to do this? is there a wordaraound?

currently i use
mat.skill1 = floatv(mx);
to pass it. i know its wrong, but i have no better idea


can someone help the newbie?
thanks

Re: passing float to pixelshader [Re: Tempelbauer] #365148
03/23/11 17:36
03/23/11 17:36
Joined: Mar 2006
Posts: 2,252
Hummel Offline
Expert
Hummel  Offline
Expert

Joined: Mar 2006
Posts: 2,252
I think you cant use entity skills if you want to keep float precision. I you use the material skills youz dont need the floatv() since its already a float type. You could also use a global float f.i. float g_foo=0.0121;>//Lite-C
declaration for use in the shader:
float g_foo_ftl;//HLSL

Re: passing float to pixelshader [Re: Hummel] #365216
03/24/11 16:11
03/24/11 16:11
Joined: Feb 2005
Posts: 3,687
Hessen, Germany
T
Tempelbauer Offline OP
Expert
Tempelbauer  Offline OP
Expert
T

Joined: Feb 2005
Posts: 3,687
Hessen, Germany
wonderful laugh
the global float works perfectly

many thanks

Re: passing float to pixelshader [Re: Tempelbauer] #365326
03/25/11 11:15
03/25/11 11:15
Joined: Jan 2003
Posts: 4,615
Cambridge
Joey Offline
Expert
Joey  Offline
Expert

Joined: Jan 2003
Posts: 4,615
Cambridge
you can also use floatd(.001,1000) to pass .000001 to the shader.


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