1 | initial version |

If you're looking for a WebGL-oriented approach, then use the `json_repr`

of a 3D surface. This code

```
var('x y z')
p = implicit_plot3d(sqrt(3*x^2+y^2)-z, (x, -30, 30), (y, -30,30), (z, -10,40))
p.json_repr(p.default_render_params())
```

returns an array of vertices, faces and color as can be seen in this live example. The array can be saved to file using Python

```
f = open('data.json', 'w')
f.write(str(p.json_repr(p.default_render_params())))
f.close()
```

and imported into Unity. This will work for any surface composed of faces, but not for 3D lines and points.

One catch is that by default Sage returns quadrilateral faces instead of triangles. If Unity can't import quadrilateral faces you'll need to split the quads into triangles beforehand. That's pretty straightforward in either Python or JavaScript.

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.