views:

809

answers:

2

Can anyone recommend an algorithm for a HLSL Pixel Shader (for WPF or Silverlight 3) to do a stippling effect? Here are some examples: http://www.nolinovak.com/, http://sprouls.com/

+1  A: 

The following research paper may help. EFFICIENT STIPPLE RENDERING by Jens Krüger and Rüdiger Westermann

Graeme Bradbury
Any idea on how that would translate to HLSL?
Michael S. Scherotter
A: 

The answer is closer than you think. Email Hugues Hoppe (http://hhoppe.com) as he used to be into stroked surface texturing. His explanations and suggestions will be more involved than you want, but he does know how.

Great stippling probably requires the predominant 3D 'direction' of the surface at each point (gradient?) which might be beyond the capabilities of your shader model restrictions (two-pass render and multiple render targets, or a large pixel-vertex data structure). A naive first version would translate each pixel's grayscale value into a probability of the pixel being black or white. That will get you 1-pixel dots which isn't what you want.

You could try taking using the grayscale value as the stacking dimension (Z) in a 3D stacked texture where each texture (X,Y) is a hand-drawn, randomly-looking, homogeneous-density stipple pattern. The borders between darkness levels will look odd, but try closest-point and linear sampling on the stacking dimension.

I'm not writing the code for you ... at least not for free.