Jump to content
  • Advertisement
Sign in to follow this  
Klarre

[HLSL] Simple texturing

This topic is 3960 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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!