Sign in to follow this  

[HLSL] Simple texturing

This topic is 3596 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello! Downloaded RenderMonkey to try out some shader coding. I am trying to simply texture a mesh but can't get it to work. I guess you experienced guys can see the error pretty quick. The result I got now is that the mesh got the same color over it. Probably the first pixel color in the image file. Thanks for your help! /Klarre Vertex shader
float4x4 matViewProjection;

struct Vertex
{
   float4 position : POSITION;
   float2 texCoord : TEXCOORD;
};

Vertex vs_main(Vertex IN)
{
   Vertex OUT;

   OUT.position = mul(IN.position, matViewProjection);
   OUT.texCoord = IN.texCoord;
   
   return OUT;
}

Pixel shader
sampler2D tex0;

float4 ps_main(float2 texCoord : TEXCOORD) : COLOR
{
   return tex2D(tex0, texCoord);
}

[Edited by - Klarre on February 9, 2008 12:19:58 PM]

Share this post


Link to post
Share on other sites
It's been a while since i used render monkey, but look at the input streams to the shaders. I think it is available in the property tree on the left. There is a dialog that allows you to specify the vertex declarations and in this you have to specify that you want texture coordinates to be passed into the vertex shader.

That's all i got.

Share this post


Link to post
Share on other sites

This topic is 3596 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this