Given an equation of a parametric surface, is there a general way to sample of points uniformly distributed on that surface?


I'm interested in this problem for purposes of visualisation - rather than attempting to attempt to triangulate the surface and display with polygons, display a dense sample of points. This makes it easier to generalise to >3d.


Here's an example of a surface I'd like to display: the Klein bottle. 



```
u = [-pi, pi]
v = [-pi, pi]

x1 = (r * cos(v) + a) * cos(u), 
x2 = (r * cos(v) + a) * sin(u), 
x3 = r * sin(v) * cos(u/2),
x4 = r * sin(v) * sin(u/2)

```

(where r and a are parameters that control the shape of the overall surface)



How can I sample uniformly from a surface?
This paper may be of interest to you:


J. Arvo, [Stratified Sampling of 2-Manifolds](http://www.ics.uci.edu/~arvo/papers/notes2001.pdf)


It directly answers your question, though you may need to do some of the computations numerically depending on how complicated your surfaces are. Moreover, stratifying your samples will help the sampling *look* uniform -- sampling uniformly over the entire domain tends to look blotchy.


