Skip to content

Instantly share code, notes, and snippets.

@rexwangcc
Created August 30, 2021 00:33
Show Gist options
  • Save rexwangcc/30d2ec4a00be851554a85c3e052e1616 to your computer and use it in GitHub Desktop.
Save rexwangcc/30d2ec4a00be851554a85c3e052e1616 to your computer and use it in GitHub Desktop.
Render a Taichi logo with Taichi language, originally created by @yuanming-hu
import taichi as ti
ti.init(arch=ti.cpu)
n = 512
x = ti.field(ti.f32, shape=(n, n))
@ti.kernel
def paint():
for i, j in ti.ndrange(n * 4, n * 4):
# 4x4 super sampling:
ret = ti.taichi_logo(ti.Vector([i, j]) / (n * 4))
x[i // 4, j // 4] += ret / 16
paint()
gui = ti.GUI('Logo', (n, n))
while gui.running:
gui.set_image(x)
gui.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment