Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, SBGuy, TipmyPip, ozgur), 875 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 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