3
\$\begingroup\$

I'm trying to write an anti-aliasing shader in HLSL, but I can't find any way to rasterize at a custom point. (in between pixels on the screen, but not orderly like supersampling)

Is there any way to do this completely in HLSL, or would it require external c++ code?

Currently I am creating a 2nd camera to rasterize my geometry on a screen of 1x1 at this point, and editing it from there, but it feels like this isn't the best way to do this.

\$\endgroup\$
7
  • \$\begingroup\$ If you do it as a post-process, you don't need to "rasterize a custom point". You just sample the rendered scene at whatever coordinates you choose. \$\endgroup\$ May 6, 2013 at 5:55
  • \$\begingroup\$ Lets say i have a hole in some geometry so i can see though it. Behind this hole there is a light, but none of the samples actually see though the hole, they get them around it. http://i.imgur.com/UlJ4R8L.gif in this image, the blue points are where it samples the texture, and the yellow area is the hole with the light. How would i re-sample just a single pixel where the hole is? \$\endgroup\$ May 6, 2013 at 8:14
  • \$\begingroup\$ That's not antialiasing, that's drawing things that were never in the scene. Also, you should edit that explanation into your question, so it's clearer what you're trying to accomplish. \$\endgroup\$ May 6, 2013 at 12:27
  • \$\begingroup\$ I'm a little confused. I know the light has been passed though my vertex shaders unaltered, because when i move the camera I can occasionally see it, so it must be within the scene. I'm trying to implement a fix in the Pixel shader, specifically performing an additional render at that point to retain the quality of the image. \$\endgroup\$ May 6, 2013 at 16:47
  • \$\begingroup\$ What I'm saying is that, once you're in the pixel shader, anti-aliasing is not going to get that light back out. By definition, anti-aliasing only samples pixels which have been already been drawn (to a rendertarget other than the screen) and smooths their edges. If you want light to appear when it wasn't in that pixel set, you need to do something else. Perhaps you could draw the scene twice with a half-pixel offset, and sample both those renders for your final pixel output to screen. But that is tantamount to supersampling. \$\endgroup\$ May 6, 2013 at 21:47

0

Browse other questions tagged .