Created
August 30, 2021 00:33
-
-
Save rexwangcc/30d2ec4a00be851554a85c3e052e1616 to your computer and use it in GitHub Desktop.
Render a Taichi logo with Taichi language, originally created by @yuanming-hu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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