I've been searching on a bug in my shaders for a really long time, only to find out that the problem was not my shader, but me thinking that the Vertex Shader's input tangent would be stored in the TANGENT register and the binormal in the BINORMAL register.
After much too long, I found this topic on this forum that states that I should use the TEXCOORD1 and TEXCOORD2 register in stead of TANGENT and BINORMAL. YES! That solved it!
But why??? Why??? Why does irrlicht use the TEXCOORD1 and TEXCOORD2 registers in stead of the obvious TANGENT and BINORMAL registers?
Yes, you might say that I should have read this forum earlier to find out about this, but you can't blame me for trusting irrlicht
HLSL Shaders - Tangent & Binormal
Re: HLSL Shaders - Tangent & Binormal
On a very simplified level:scippie wrote: But why??? Why??? Why does irrlicht use the TEXCOORD1 and TEXCOORD2 TANGENT and BINORMAL registers?
TANGENT and BINORMAL are semantics;
TEXCOORD1 and TEXCOORD2 are registers.
Post your HLSL code so we can see how your trying to do things...
Irrlicht Demos: http://irrlicht.sourceforge.net/forum/viewtopic.php?f=6&t=45781
Re: HLSL Shaders - Tangent & Binormal
Not really. TANGENT, BINORMAL, TEXCOORDx are all semantics and registers are registers, input registers in this case.sio2 wrote:On a very simplified level:scippie wrote: But why??? Why??? Why does irrlicht use the TEXCOORD1 and TEXCOORD2 TANGENT and BINORMAL registers?
TANGENT and BINORMAL are semantics;
TEXCOORD1 and TEXCOORD2 are registers.
As far as I understand the question, the problem is already solved, only it is asked why Irrlicht uses TEXCOORD semantics for tangents and binormals. Can't answer that one, sorry.
Because irrlicht doesn't use vertex attributes for some reason. (probably to save loading yet another extension if under opengl
Those aren't registers, think of registers (or call them temporary registers because it makes more sense) as temporary variables that you have total control of what goes in and out of them.
Those aren't registers, think of registers (or call them temporary registers because it makes more sense) as temporary variables that you have total control of what goes in and out of them.
"Irrlicht is obese"
If you want modern rendering techniques learn how to make them or go to the engine next door =p
If you want modern rendering techniques learn how to make them or go to the engine next door =p
Re: HLSL Shaders - Tangent & Binormal
Yeah, I don't think I got my point over very well.Saturn wrote: Not really.
If you use tangent and binormal semantics then there needs some mapping for the shader to know where in the input vertex to pull the data. If you use texcoordn then I think the HLSL compiler can infer where to pull data from to fill the respective register. I'm guessing a bit on this as: a) I haven't seen the OP's code and b) the HLSL compiler sometimes needs a "nudge" (such as the need for :register(sn) sometimes for samplers).
Does Irrlicht use FVF codes or full vertex declarations?
Irrlicht Demos: http://irrlicht.sourceforge.net/forum/viewtopic.php?f=6&t=45781
Thanks. I didn't know that those were not real registers (the book I'm reading puts them next to TEXCOORDn and the like).
No, there is no problem to be solved with my shader as it works fine now.
I just got very strange looking results when I used TANGENT en BINORMAL but after a long search, I tried the obvious: "are the tangents and binormals that I receive in the shaders the same as the ones I have in my code?"... and they werent . And that's why I thought: WHY?
No, there is no problem to be solved with my shader as it works fine now.
I just got very strange looking results when I used TANGENT en BINORMAL but after a long search, I tried the obvious: "are the tangents and binormals that I receive in the shaders the same as the ones I have in my code?"... and they werent . And that's why I thought: WHY?