In course Games201, some students (including me) need an easy way to draw some objects(particles, triangles, rectangles) in 3d space.
Now Taichi has an api ti.PLYwriter to export 3d results in ply format.
I don't think it is convenient enough to debug programs.
I want add a simple 3D rendering feature.
It would be used like this:
```python3
scene = ti.3d_scene() # create a 3d scene.
scene.add_sphere(XXX) # Add a sphere to scene.
scene.add_line(XXX) # Add a line to scene.
scene.add_triangle(XXX) # Add a triangle to scene.
scene.add_rectangle() # Add a rectangle to scene.
...
scene.set_camera(XXX,XXX,XXX) # Set camera's position, direction...
image = scene.render() # Render an image
gui = ti.GUI("screen", (800, 800))
gui.set_image(image) # Draw on GUI
````
Maybe I will use Taichi itself or OpenGL to Implement this feature.
And, does it need to be a built-in feature of taichi?
A 3rd-party library is better?
A 3rd-party rendering library sounds really good to me! Do you have time to create that library on your own, and upload it to PyPI so that GAMES 201 students could enjoy your work? If not, then I'll take this job :)
I'll do it. ^_^
I think this is a good idea for small-scale scenes and for real-time simulations. Maybe we can make use of pyglet or pygame?
Yes, I just want to make it easier to debug some small-scale scenes.
But I think pyglet and pygame are 2d library. Maybe PyOpenGL is better.
If there is no simpler and more convenient cross-platform library, I can only use PyOpenGL. It will take a lot of time. -_-
In fact PyOpenGL may cause issue with Taichi OpenGL backend..
Currently Python doesn't have a native lib to do such real-time rendering work yet, I think we can make one.
The best solution is to implement a soft OpenGL-alike API ourselves, which not only helps GAMES students, but also the py community by a brand-new cross-platform native highly-configable graphic lib.
I'm now done with a basic rendering library, install using:
pip install --user taichi_three -i https://pypi.org/simple
Inputs are welcome at https://github.com/taichi-dev/taichi_three/issues.
Now @archibate has made a 3d render for taichi: taichi_three.
So this issue closed.
Most helpful comment
I'm now done with a basic rendering library, install using:
Inputs are welcome at https://github.com/taichi-dev/taichi_three/issues.