Ok, the internet didn't turn anything up on this, maybe its just too obvious. What, exactly, represents the 4th component in a float4/vector variable?
I am currently writing a shader, using Nvidia FxComposer(Great tool btw) and setting the 4th component of my global variables to zero produces some strange effects, such as stretching an object to infinity in case of a position vector. Setting it to 1 seems straightforward enough, yet I'd like to know what I'm dealing with.
HLSL: What represents the 4th component in a float4/vector?
Normally, in position vectors it is always 1. In fact float4() is a flexible object, and thus, the 4th component can be used in many ways. for example, in colors, the 4th component is the alpha channel. So, if you want to use position vectors, just stick to the 3 first, and ignore the 4th. It will work well in any case
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
It has to do with perspective projection. It's called the W component. Read up on that.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Re: HLSL: What represents the 4th component in a float4/vect
I'm just guessing, but this sounds to me that in your case the 4th number could be a scale factor !?!?!OnyxIdol wrote:some strange effects, such as stretching an object to infinity in case of a position vector. Setting it to 1 seems straightforward enough
while(!asleep) sheep++;
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java