• Create Account

## what does 'w' mean in shader assembler

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

21 replies to this topic

### #21Jason Z  Members

6411
Like
0Likes
Like

Posted 14 June 2013 - 04:30 PM

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.

Jason Zink :: DirectX MVP

Direct3D 11 engine on CodePlex: Hieroglyph 3

Games: Lunar Rift

### #22Icebone1000  Members

1822
Like
1Likes
Like

Posted 14 June 2013 - 07:41 PM

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.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.