I have a very simple Cg shader, which is supposed to apply a sphere map to an object:
Code: Select all
void main_vs(float4 position : POSITION,
float3 uvCoord : TEXCOORD0,
float3 uvCoordRef : TEXCOORD1,
out float4 oPosition : POSITION,
out float3 oUVCoord : TEXCOORD0,
out float3 oUVCoordRef : TEXCOORD1,
const uniform float4x4 wvpMat)
{
oPosition = mul(wvpMat, position);
oUVCoord = uvCoord;
oUVCoordRef = uvCoordRef;
}
void main_fs(float3 uvCoord : TEXCOORD0,
float3 uvCoordRef : TEXCOORD1,
out float4 oColour : COLOR0,
const uniform sampler2D diffuseMap : register(s0),
const uniform sampler2D refMap : register(s1))
{
float4 cubeElem = tex2D(refMap, uvCoordRef);
oColour = cubeElem;
}
Here is the corresponding pass in the material file:
Code: Select all
// Texture pass
pass
{
vertex_program_ref vs_texture
{
}
fragment_program_ref fs_texture
{
}
texture_unit
{
texture white.bmp
}
texture_unit
{
texture smap_bar1.png
env_map spherical
}
}
Code: Select all
vertex_program vs_texture cg
{
source texture.cg
entry_point main_vs
profiles vs_2_0 arbvp1
default_params
{
param_named_auto wvpMat worldviewproj_matrix
}
}
fragment_program fs_texture cg
{
source texture.cg
entry_point main_fs
profiles ps_2_0 arbfp1
}
I should also mention that I have tried to apply a cube map, with similar results.
I have searched and searched for hours through the manual, wiki, forum, example programs, and google, and have found nothing. I am posting this to make sure there is nothing obvious that I am doing wrong, or any steps that I have to take, that I am foolishly missing out (I sincerely hope this is the case).
Thanks in advance,
Joe