TEXCOORDn in HLSL?
TEXCOORDn in HLSL?
Trying to change my triplanar texturing shader to be able to use multiple texture using an simple texture atlas. My mesh is based on a volume of voxels were every voxel have a material value. Now i want to take this value into the shader and i have read that using TEXCOORD0 for this works very well, but i have no clue how to make TEXCOORD0 contain something? How do i set this from Irrlicht?
Re: TEXCOORDn in HLSL?
It all depends on the type of vertex you are passing to a shader. Irrlicht still doesn't support FVF's so, you have to adapt your code to what Irrlicht can offer. In this case, your best friend is the Tangents vertices, mainly because it is the largest, and thus, the one which has the most room for stuff.
The structure of a tanget vertex contains a vector which is the position, another with the normal, a 32 bit unsigned integer which has the color, a 2d vector containing the texture map coordinates and 2 more vectors containing the Binormal and the Tangent of the vertex. These are mapped as follow:
Position -> POSITION0: float4
Normal -> NORMAL0: float3
Color -> COLOR0: float4
UVcoordinates-> TEXCOORD0: float2
Tangent-> TEXCOORD1: float3
Binormal-> TEXCOORD2: float3
So, if you want to pass any data to a shader, you have to alter the vertex information manually, keeping in mind that if you wish the data to be ported correctly, you have to fit your data in the space and types the vertex has.
The structure of a tanget vertex contains a vector which is the position, another with the normal, a 32 bit unsigned integer which has the color, a 2d vector containing the texture map coordinates and 2 more vectors containing the Binormal and the Tangent of the vertex. These are mapped as follow:
Position -> POSITION0: float4
Normal -> NORMAL0: float3
Color -> COLOR0: float4
UVcoordinates-> TEXCOORD0: float2
Tangent-> TEXCOORD1: float3
Binormal-> TEXCOORD2: float3
So, if you want to pass any data to a shader, you have to alter the vertex information manually, keeping in mind that if you wish the data to be ported correctly, you have to fit your data in the space and types the vertex has.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Re: TEXCOORDn in HLSL?
But wouldn't you automatically get TEXCOORD0 just by loading a model with UV coords?
Re: TEXCOORDn in HLSL?
Thanx Mel, just what i needed to know, i only have a 4-bit value i need to pass, so it should be easy to fit : )