Jump to content
  • Advertisement
Sign in to follow this  

HLSL simple shader to draw lines ?

This topic is 3089 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

Hi using xna/c# i have several pixel shaders that perform stuff like grayscale/invert and so forth they all write to a rendertarget and the final texture is put to an object, this works well and fast, but what i am looking for is some shader code that is able to write pixel thin lines in a pattern i.e say Snowflakes/binary tree/von koch initiator basicaly patterns with adjustments to the varables is there any way to do this just simple code to write a line would be a start i have looked everwhere. here is my basic template.
 
// Default Variables
sampler TextureSampler : register(s0);

// Variables

// Methods
float4 Shder(float2 Tex : TEXCOORD0) : COLOR0
{
    float4 Color;
    Color = tex2D(TextureSampler, Tex.xy);
    return Color;
}

// Techniques
technique
{
    pass pass0
    {
        PixelShader = compile ps_2_0 Shder();
    }
}

[Edited by - cosmo909 on December 6, 2009 1:56:37 PM]

Share this post


Link to post
Share on other sites
Advertisement
Hi,

Hmm...not sure since I always use dx9/c++ but can't you just use a standard texture shader and use the xna/c# equivalent of IDirect3DDevice9::DrawPrimitive with the parameter D3DPT_LINELIST or D3DPT_LINESTRIP ?

I'm not too certain here as I am not sure what exactly you want to do have no experience in xna/c# and if what I wrote really applies to it.

^_^

Share this post


Link to post
Share on other sites
hi Zaph-0

yes D3DPT_LINELIST does exist in xna it is an idea and in some ways would be easier to first construct texture to a rendertarget then
render the shape/pattern i want over the top of that with the linelist then use gettexture() on that it could work.

just i was hoping i could keep it all in the shaders :).

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!