Jump to content

  • Log In with Google      Sign In   
  • Create Account


rendering to one pixel


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 lomateron   Members   -  Reputation: 300

Like
0Likes
Like

Posted 26 April 2014 - 01:52 AM

I want to render to only one pixel of a texture 

So this is done using one vertex, drawing it using the D3D10_PRIMITIVE_TOPOLOGY_POINTLIST

and then the SV_Position value will depend on wich pixel I want to render

The problem is that if this SV_Position value is in the middle of 2 pixels, two pixels get rendered and I just want one pixel always to be rendered

Is there code that configures the API to only render one pixel instead of two?


Edited by lomateron, 26 April 2014 - 01:58 AM.


Sponsor:

#2 Erik Rufelt   Crossbones+   -  Reputation: 3032

Like
0Likes
Like

Posted 26 April 2014 - 02:13 AM

Clamp SV_Position to be exactly on the closest pixel in the vertex-shader.



#3 Rattenhirn   Crossbones+   -  Reputation: 1660

Like
0Likes
Like

Posted 26 April 2014 - 02:14 AM

The answer is pretty obvious. You cannot render a pixel in the middle of two raster positions without splitting it up somehow. Therefor, you need to avoid that situation and always render to a single raster position.

There are multiple ways to do this, depending on what kind of projection you are using and how many of these guys you want to render. If you use orthogonal projection and just "a few" (number depends on kind and power of the hardware used) pixels, just trim off any fractions of the position on the CPU or in the vertex shader.

If you use perspective projection, either do the projection on the CPU and trim, or again, use the vertex shader.

For a more detailed answer you'll need to provide more details!

I hope that helps!




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