Jump to content
  • Advertisement

guillotine

Member
  • Content Count

    23
  • Joined

  • Last visited

Community Reputation

126 Neutral

About guillotine

  • Rank
    Member
  1. Hello,   I'm very much a newbie with HLSL, but I was able to understand enough to put together a simple shader that would change the colors of indexed, gray-scaled sprites in my 2D engine.   Here's the  shader: Texture ColorTexture; sampler ColorTextureSampler = sampler_state { texture = <ColorTexture> ; magfilter = NONE; minfilter = NONE; mipfilter = NONE; AddressU = wrap; AddressV = wrap; }; Texture PaletteTexture; sampler PaletteTextureSampler = sampler_state { texture = <PaletteTexture> ; magfilter = NONE; minfilter = NONE; mipfilter = NONE; AddressU = wrap; AddressV = wrap; }; float4 Palette(float2 pos : TEXCOORD0) : COLOR0 { float4 color = tex2D(ColorTextureSampler, pos); return tex1D(PaletteTextureSampler, color.r); } technique Technique1 { pass { PixelShader = compile ps_2_0 Palette(); } } The only issue is that no matter what I set to ColorTexture, the shader seems to ignore it and use the texture being drawn instead. I use the Draw method of ID3DXSprite. It's not even a "real" problem I guess since I would want to pass the current texture anyway for this, but I'm curious if there is a way around it without abandoning ID3DXSprite which really does everything I need.  
  • 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!