Open sebastien opened 5 years ago
I think this restriction against exporting an infinite shape only applies to 2D shapes. It's because the 2D shape is scaled to fill the image. For 3D shapes, you essentially get a screen dump of whatever normally appears in the viewer window.
Here is a quick workaround:
curv -o mandel.png -x 'intersection(file "examples/mandelbrot.curv", rect(10,10))'
This trick provides a lot of flexibility, and covers most of what you asked for. There is no accessible FOV parameter right now, however.
Smart! But what about camera position on a 3D shape and output image resolution? It's not super urgent, as I think the WebGL 2 fix that you suggested will solve this problem for now, and I can generate PNG from the canvas.
Curv generates a PNG from the OpenGL viewport, and as you noted, it's just as easy for you to do that. In which case, you have direct control over camera and zoom.
From the Curv command line, you can simulate zoom and camera control by scaling, translating and rotating the object. It's a bit hacky; scriptable camera controls might be a good idea.
From the Curv command line, when exporting to PNG, you control output image resolution using -Oxsize= and -Oysize=. But, there is no command line control of the size of the viewer window, so that's another extension you might need.
Cleaning up old issues...
This now works: curv -o png -O aa=4 curv/examples/mandelbrot.curv
.
What's left to do? Scriptable camera position, using -O camera=...
.
Updating title of issue.
This would be cool for two reasons:
I would like to run curv with an offscreen rendering target (like
-o png
) so that it works with all curv programs. For instance:yields the following error:
I suppose this could be solved by introducing new options/flags to specify what should be rendered:
width
,height
for the width/height of the resulting imagescale
for 2d renders (ie, the zoom)x,y,z
camera position for 3d renders (not sure if we can set fov and up) -- or whatever parameters you already use for rendering the 3d shapes.This will allow me to fallback to server-side rendering when shaders don't compile to working WebGL: