what does 'w' mean in shader assembler

Started by
20 comments, last by Icebone1000 10 years, 10 months ago

Out of all of the conjecture and philosophical discussion (which is also important...) nobody answered the original question from the OP. He wants to know why his w value is initialized to 1 when he only has a XYZ format for his vertex information. Its been really long since I worked with D3D9, so I couldn't say off the top of my head why that is. Can you describe how you managed to determine that the value is 1?

The original question isn't really very clear.

I would guess that it may be about this: If you have a vertex declaration entry for vertex position (D3DDECLUSAGE_POSITION) with the type D3DDECLTYPE_FLOAT3 and your vertex shader input parameter for position is float4, then w is automatically filled with w = 1, because that's what points need. I don't know whether for normal it would put 0 there, but I guess it would.

Anyway, I personaly have always been consistent in this and with D3DDECLTYPE_FLOAT3 I use float3 in shaders. And I add w manually.

That seems like prudent advice - can the original poster chime in about that? Are you using all four components of a vector without initializing them? It could be that since he is using an assembly shader, that the full register is initialized regardless of if he declares 3 or 4 components.

Advertisement

Its just me who thinks wikipedia entries on any math subject are terrible? I never learned anything about math on wikipedia, but I did learned a trick: try searching on really early versions of the entry, before some calculus freak made his version full of weird notations and explanations nobody really cares, helps a lot, since early version focus on things ppl are actually more concerned, instead of those versions full of history and names.

This topic is closed to new replies.

Advertisement