From 9ecaea6623d1935d15fe6f82e7358a2a65a19a92 Mon Sep 17 00:00:00 2001 From: archibate <1931127624@qq.com> Date: Tue, 23 Jun 2020 17:29:59 +0800 Subject: [PATCH 1/5] [doc] Add Taichi THREE to documentation --- README.md | 8 ++++++-- docs/extension_libraries.rst | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 09332d425767d..c2eca75c9f678 100644 --- a/README.md +++ b/README.md @@ -48,17 +48,21 @@ Please build from source for other configurations (e.g., your CPU is ARM). ## Links - [Taichi Forum](https://forum.taichi.graphics): Powered by Discourse, Taichi offical forum for discussing issues and sharing ideas. -- [Taichi Simplified Chinese Documentation](https://github.com/taichi-dev/taichi-docs-zh-cn): Translated by Taichi community, welcome contribution! +- [Taichi Simplified Chinese Documentation](https://github.com/taichi-dev/taichi-docs-zh-cn): Translated by the Taichi community, welcome contribution! - [Taichi Conference](https://github.com/taichi-dev/taichicon): Taichi Online Virtual Conference available in both Chinese and English, approximately per-month. - [GAMES 201 Lectures](https://github.com/taichi-dev/games201): (Chinese) A hands-on tutorial on advanced physics engines based on Taichi, per-week. --- +- [Taichi GLSL](https://github.com/taichi-dev/taichi_glsl): A Taichi extension library providing a set of GLSL-alike helper functions. +- [Taichi THREE](https://github.com/taichi-dev/taichi_three): A 3D rendering library based on Taichi (work in progress). - [Taichi Elements](https://github.com/taichi-dev/taichi_elements): A High-Performance Multi-Material Continuum Physics Engine based on Taichi (work in progress). + +--- + - [LBM Taichi](https://github.com/hietwll/LBM_Taichi): Fluid solver based on Lattice Boltzmann method implemented by Taichi programming language, by [Zhuo Wang (hietwll)](https://github.com/hietwll). - [Shadertoy reproduced by Taichi](https://github.com/Phonicavi/Shadertoy-taichi): Some prevalent shadertoys implemented in Taichi, by [QIU Feng (Phonicavi)](https://github.com/Phonicavi). - [DiffTaichi](https://github.com/yuanming-hu/difftaichi): 10 differentiable physical simulators built with Taichi differentiable programming, by [Yuanming Hu (yuanming-hu)](https://github.com/yuanming-hu). -- [Taichi GLSL](https://github.com/taichi-dev/taichi_glsl): Manipulate Taichi with GLSL-alike helper functions. ## Developers diff --git a/docs/extension_libraries.rst b/docs/extension_libraries.rst index cf39a7693f565..156e371123f88 100644 --- a/docs/extension_libraries.rst +++ b/docs/extension_libraries.rst @@ -14,5 +14,24 @@ library of Taichi, aiming at providing useful helper functions including: 2. GLSL-alike vector functions like ``normalize``, ``distance``, ``reflect``. 3. Well-behaved random generators including ``randUnit2D``, ``randNDRange``. 4. Handy vector and matrix initializer: ``vec`` and ``mat``. +5. Handy vector component shuffle accessor like ``v.xy``. Click here for `Taichi GLSL Documentation `_. + +.. code-block:: bash + + python3 -m pip install taichi_glsl + + +Taichi THREE +------------ + +`Taichi THREE `_ or Tai3D is an +extension library of Taichi to render 3D scenes into nice-looking 2D images +in real-time (work in progress). + +.. image:: https://raw.githubusercontent.com/taichi-dev/taichi_three/16d98cb1c1f2ab7a37c9e42260878c047209fafc/assets/monkey.png + +.. code-block:: bash + + python3 -m pip install taichi_three From b280a4748d8c47f0f354949d94ca52ea1efd0159 Mon Sep 17 00:00:00 2001 From: archibate <1931127624@qq.com> Date: Wed, 24 Jun 2020 00:11:41 +0800 Subject: [PATCH 2/5] [skip ci] update usage --- docs/extension_libraries.rst | 58 ++++++++++++++++++++++++++++++++++-- 1 file changed, 55 insertions(+), 3 deletions(-) diff --git a/docs/extension_libraries.rst b/docs/extension_libraries.rst index 156e371123f88..2e0b72369e705 100644 --- a/docs/extension_libraries.rst +++ b/docs/extension_libraries.rst @@ -22,16 +22,68 @@ Click here for `Taichi GLSL Documentation `_ python3 -m pip install taichi_glsl +.. code-block:: python + + from taichi_glsl import * + import time, math + + image = vec_array(3, float, 512, 512) + + @ti.kernel + def paint(t: ti.f32): + for i, j in image: + coor = view(image, i, j) + image[i, j] = smoothstep(distance(coor, vec(0.5, 0.5)), t, + t - 0.06) * vec(coor.x, coor.y, 0.0) + + with ti.GUI('Step UV') as gui: + while not gui.get_event(ti.GUI.ESCAPE, ti.GUI.EXIT): + paint(0.4 + 0.4 * math.cos(time.time())) + gui.set_image(image) + gui.show() + Taichi THREE ------------ -`Taichi THREE `_ or Tai3D is an -extension library of Taichi to render 3D scenes into nice-looking 2D images -in real-time (work in progress). +`Taichi THREE `_ is an extension +library of Taichi to render 3D scenes into nice-looking 2D images in real-time +(work in progress). + +Click here for `Taichi THREE Tutorial `_. .. image:: https://raw.githubusercontent.com/taichi-dev/taichi_three/16d98cb1c1f2ab7a37c9e42260878c047209fafc/assets/monkey.png .. code-block:: bash python3 -m pip install taichi_three + +.. code-block:: python + + import taichi as ti + import taichi_three as t3 + import numpy as np + + ti.init() + + scene = t3.Scene() + model = t3.Model() + scene.add_model(model) + + vertices = t3.Vertex.var(3) + faces = t3.Face.var(2) + vertices.pos.from_numpy(np.array( + [[+0.0, +0.5, 0.0], [-0.5, -0.5, 0.0], [+0.5, -0.5, 0.0]])) + faces.idx.from_numpy(np.array([[0, 1, 2], [0, 2, 1]])) # both cull faces + model.set_vertices(vertices) + model.add_geometry(faces) + + scene.set_light_dir([0.4, -1.5, -1.8]) + gui = ti.GUI('Triangle', scene.res) + while gui.running: + gui.running = not gui.get_event(ti.GUI.ESCAPE) + scene.camera.from_mouse(gui) + #model.L2W.from_mouse(gui) + scene.render() + gui.set_image(scene.img) + gui.show() From c3b0fb3bf0fa4b3a0420cf2a2a2df06a73389cf4 Mon Sep 17 00:00:00 2001 From: archibate <1931127624@qq.com> Date: Wed, 24 Jun 2020 00:12:58 +0800 Subject: [PATCH 3/5] [skip ci] upd --- docs/extension_libraries.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/extension_libraries.rst b/docs/extension_libraries.rst index 2e0b72369e705..0f6e3a6972220 100644 --- a/docs/extension_libraries.rst +++ b/docs/extension_libraries.rst @@ -50,10 +50,10 @@ Taichi THREE library of Taichi to render 3D scenes into nice-looking 2D images in real-time (work in progress). -Click here for `Taichi THREE Tutorial `_. - .. image:: https://raw.githubusercontent.com/taichi-dev/taichi_three/16d98cb1c1f2ab7a37c9e42260878c047209fafc/assets/monkey.png +Click here for `Taichi THREE Tutorial `_. + .. code-block:: bash python3 -m pip install taichi_three From a65f18c69b1fe5db0b7611f0669a7f1dbeb9a6fd Mon Sep 17 00:00:00 2001 From: archibate <1931127624@qq.com> Date: Wed, 24 Jun 2020 00:35:50 +0800 Subject: [PATCH 4/5] [skip ci] deprecate Expr.parent --- python/taichi/lang/expr.py | 1 + 1 file changed, 1 insertion(+) diff --git a/python/taichi/lang/expr.py b/python/taichi/lang/expr.py index 0ed3958f54c3d..6bc68ce7f1557 100644 --- a/python/taichi/lang/expr.py +++ b/python/taichi/lang/expr.py @@ -122,6 +122,7 @@ def fill(self, val): from .meta import fill_tensor fill_tensor(self, val) + @deprecated('tensor.parent()', 'tensor.snode().parent()') def parent(self, n=1): import taichi as ti p = self.ptr.snode() From 9b9bd37ec04cf407f56fbb14b13ddc6df47d8fc2 Mon Sep 17 00:00:00 2001 From: archibate <1931127624@qq.com> Date: Thu, 25 Jun 2020 11:15:51 +0800 Subject: [PATCH 5/5] [skip ci] update --- docs/extension_libraries.rst | 50 ------------------------------------ 1 file changed, 50 deletions(-) diff --git a/docs/extension_libraries.rst b/docs/extension_libraries.rst index 0f6e3a6972220..d6368c1fe1a9b 100644 --- a/docs/extension_libraries.rst +++ b/docs/extension_libraries.rst @@ -22,26 +22,6 @@ Click here for `Taichi GLSL Documentation `_ python3 -m pip install taichi_glsl -.. code-block:: python - - from taichi_glsl import * - import time, math - - image = vec_array(3, float, 512, 512) - - @ti.kernel - def paint(t: ti.f32): - for i, j in image: - coor = view(image, i, j) - image[i, j] = smoothstep(distance(coor, vec(0.5, 0.5)), t, - t - 0.06) * vec(coor.x, coor.y, 0.0) - - with ti.GUI('Step UV') as gui: - while not gui.get_event(ti.GUI.ESCAPE, ti.GUI.EXIT): - paint(0.4 + 0.4 * math.cos(time.time())) - gui.set_image(image) - gui.show() - Taichi THREE ------------ @@ -57,33 +37,3 @@ Click here for `Taichi THREE Tutorial