Jump to content

  • Log In with Google      Sign In   
  • Create Account


Texture coordinates for a straight line and a point


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 emt   Members   -  Reputation: 134

Like
1Likes
Like

Posted 08 February 2013 - 01:09 PM

How to genrate or calculate the texture coordinates for a straight line and a point ? Basically I have a HLSL shadre code for blur effect, it works fine with quads and triangles when I use "texCoord = Input.Position*0.5 + 0.5", but the same shader does not work when I use to blur a straight line or a point.

Regards.



Sponsor:

#2 Kjell Andersson   Members   -  Reputation: 387

Like
2Likes
Like

Posted 11 February 2013 - 03:46 PM

A pixel shader only affects the pixels that are within your rendered geometry. For the triangle case, only the pixels within your triangle are rendered by the shader. This means that the pixels that are outside of your triangle will not be affected. If you are drawing a triangle with a shader that blurs the texture you will get a blurry texture within the triangle only - it will not blur the edges to the outside of the triangle area.

 

When using the graphics card to draw lines or points, the same applies. The shader will only calculate the texture for the pixels within the line or the single point. You will thus never be able to draw blurred lines using only a shader attached to the line drawing.

 

In order to draw blurred lines you have to do a screen blur by first rendering your lines and points to an off-screen texture. Then you draw this texture to the screen using a quad and attach your blur shader to the drawing of that quad.

 

The other approach to drawing blurred lines and points is to use a pre-created semi-transparent texture of a blurred point. Instead of drawing a single line using the line drawing of the graphics card you create a thick "box"-line using two triangles to create a quad where you want the line or point to be drawn. Then just apply the "blurred point"-texture and draw the quad to the screen using a simple alpha-blending shader.



#3 rouncer   Members   -  Reputation: 284

Like
1Likes
Like

Posted 12 February 2013 - 07:24 AM

yeh you need a pixel shader to do it.   full screen blurring is a really wicked way to spice a game up, can make a car game look really fast if you make the lines blur from the centre of the screen outwards. (doesnt just do that either, you can have full correct vectoral motion blurs on everything with a worldspace coordinate render)






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS