Gamestudio Links
Zorro Links
Newest Posts
nba2king Latest Roster Update Breakdown
by joenxxx. 10/14/25 06:06
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
0 registered members (), 9,184 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
joenxxx, Jota, krishna, DrissB, James168
19170 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
gerstner wave function #131352
05/23/07 21:34
05/23/07 21:34
Joined: Jan 2003
Posts: 4,615
Cambridge
Joey Offline OP
Expert
Joey  Offline OP
Expert

Joined: Jan 2003
Posts: 4,615
Cambridge
well, even though it's not really a shader, do you gurus know what is meant here when they speak of a "gerstner wave function"?

http://www.futuremark.com/products/3dmark06/tests/

i'm currently learning hlsl (proceeding well so far) but this is a thing which i've never heard before. i can only find essays and papers about physics and fluid simulation but nothing that tells me wether it is a shader or applies just to geometry transformations.

thanks in advance,
joey.

Re: gerstner wave function [Re: Joey] #131353
05/23/07 21:49
05/23/07 21:49
Joined: Jan 2004
Posts: 2,013
The Netherlands
E
Excessus Offline
Expert
Excessus  Offline
Expert
E

Joined: Jan 2004
Posts: 2,013
The Netherlands
Check this paper: Simulating Ocean Water

float3 and float4 [Re: Excessus] #131354
05/23/07 22:09
05/23/07 22:09
Joined: Jan 2003
Posts: 4,615
Cambridge
Joey Offline OP
Expert
Joey  Offline OP
Expert

Joined: Jan 2003
Posts: 4,615
Cambridge
great, thanks.

now, can anyone tell me when it's wise to use float3 and when float4? i already noticed that you have to set p.ex. the 4 vertex ouput position arguments as well as the pixel shader output (4 colors). i understand the latter one (though not what use the alpha component has, the model does not get rendered transparent, or is this the stuff with alphawriteenable?), but why a 4-dimensional vector for space? its x, y, z and w or something? what does that w stand for? i hardly noticed any difference switching from float3 over to float4 or back. i'd be really grateful if someone could point me to the right direction here.

Re: float3 and float4 [Re: Joey] #131355
05/23/07 22:37
05/23/07 22:37
Joined: Jan 2004
Posts: 2,013
The Netherlands
E
Excessus Offline
Expert
Excessus  Offline
Expert
E

Joined: Jan 2004
Posts: 2,013
The Netherlands
This is a really interesting document about homogeneous coordinates. It explains things in a relatively simple manner, but it's still quite difficult.

http://geometer.org/mathcircles/cghomogen.pdf

Re: float3 and float4 [Re: Excessus] #131356
05/23/07 22:40
05/23/07 22:40
Joined: Jan 2003
Posts: 4,615
Cambridge
Joey Offline OP
Expert
Joey  Offline OP
Expert

Joined: Jan 2003
Posts: 4,615
Cambridge
sounds interesting, i'll have a look at it tomorrow. thank you, excessus!

Re: float3 and float4 [Re: Joey] #131357
05/24/07 00:36
05/24/07 00:36
Joined: Oct 2003
Posts: 4,131
M
Matt_Aufderheide Offline
Expert
Matt_Aufderheide  Offline
Expert
M

Joined: Oct 2003
Posts: 4,131
Quote:

can anyone tell me when it's wise to use float3 and when float4? .... why a 4-dimensional vector for space?




Position is calculated in four dimensions because some technical reasons...essentially, the 3d position vector has to be transformed to homogenous perspective space, and a fourth component, w, is needed..

from Dr. Math:
"For technical reasons, you need a fourth coordinate to do this
efficiently, but the idea is this: The 3D point you would call
(x, y, z) is represented by any 4D "homogeneous" vector like this:
(ax, ay, az, a), where a is non-zero. We usually pick a to be
1, so it is represented by (x, y, z, 1). But if after multiplying
your input 4D vector by the matrix you get something like this:
(2, 11, 18, 2), the a is 2, so this corresponds to (2/2, 11/2, 18/2)
in 3 dimensions."

In any case, normally you dont need to worry about it, just output a float4 vector for you final transform ... you just cast the positon input as a 4d vector and do all the mul using that, and there you go.. mul(inpos,matWorldViewproj); where inpos is a 4d vector..

As far as other uses of vectors, always be aware of what components you really need.. if all you care about in a vector is the xyz or rgb values, you should use a float3, unless you need to use these vectors to operate on a different float4.

For instance, this operation is illegal: c1.xyzw*=c2.xyz; ...where c1 is a float4 and c2 is float3)

to properly do this operation do this instead:
c1.xyz*=c2.xyz; or you can do it in a dumber way like this
c1.xyzw*=float4(c2.xyz,1); ..we just recast the float3 c2 into a float 4, adding a one to the w component, meaning it will unchanged by the multiplication.. if you wanted an addition, just 0 instead of 1...

There is an exception to this rule however, you can always multiply a vector by a scalar.. therefore: c1.xyzw*=2.0f; ...is legal..this just mulitplies each component of the vector by the scalar value...

Interestingly, in shaders, scalars can be subsituted for vectors in any case.. such that: float value=c1.rgb; is legal.. this is the easy way to get a monotone value from a color vector.. which is very useful in many shaders.

The basic rule is to be aware of what the numbers your vectors represent actually mean, and use the appropriate dimensions.


Sphere Engine--the premier A6 graphics plugin.
Re: float3 and float4 [Re: Matt_Aufderheide] #131358
05/24/07 11:28
05/24/07 11:28
Joined: Jan 2004
Posts: 2,013
The Netherlands
E
Excessus Offline
Expert
Excessus  Offline
Expert
E

Joined: Jan 2004
Posts: 2,013
The Netherlands
Quote:

Interestingly, in shaders, scalars can be subsituted for vectors in any case.. such that: float value=c1.rgb; is legal.. this is the easy way to get a monotone value from a color vector.. which is very useful in many shaders.



Interesting indeed. Does it take the average of the elements or the max(), or some other algorithm?

Re: float3 and float4 [Re: Joey] #131359
05/26/07 09:01
05/26/07 09:01
Joined: Nov 2004
Posts: 7,121
Potsdam, Brandenburg, Germany
Machinery_Frank Offline
Senior Expert
Machinery_Frank  Offline
Senior Expert

Joined: Nov 2004
Posts: 7,121
Potsdam, Brandenburg, Germany
Quote:

can anyone tell me when it's wise to use float3 and when float4?




Sometimes a matrix contains r,g,b,a where a contains the alpha channel of your image. This can be helpful e.g. for carrying informations for specularity.


Models, Textures and Games from Dexsoft
Re: float3 and float4 [Re: Machinery_Frank] #131360
05/26/07 10:19
05/26/07 10:19
Joined: Jan 2003
Posts: 4,615
Cambridge
Joey Offline OP
Expert
Joey  Offline OP
Expert

Joined: Jan 2003
Posts: 4,615
Cambridge
well, yeah, i thought of that. can you tell me how i can "write" the alpha value to make parts of the model transparent?

Re: float3 and float4 [Re: Joey] #131361
05/26/07 10:37
05/26/07 10:37
Joined: Nov 2004
Posts: 7,121
Potsdam, Brandenburg, Germany
Machinery_Frank Offline
Senior Expert
Machinery_Frank  Offline
Senior Expert

Joined: Nov 2004
Posts: 7,121
Potsdam, Brandenburg, Germany
What do you mean with "write"?


Models, Textures and Games from Dexsoft
Page 1 of 2 1 2

Moderated by  Blink, Hummel, Superku 

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