Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gui] [vulkan] Support 3d-lines rendering #5492

Merged
merged 9 commits into from
Jul 22, 2022

Conversation

Morcki
Copy link
Member

@Morcki Morcki commented Jul 21, 2022

Usage

import taichi as ti

ti.init(arch=ti.cuda)

N = 10

particles_pos = ti.Vector.field(3, dtype=ti.f32, shape = N)
points_pos = ti.Vector.field(3, dtype=ti.f32, shape = N)
        
@ti.kernel
def init_points_pos(points : ti.template()):
    for i in range(points.shape[0]):
        points[i] = [i for j in ti.static(range(3))]

init_points_pos(particles_pos)
init_points_pos(points_pos)

window = ti.ui.Window("Test for Drawing 3d-lines", (768, 768))
canvas = window.get_canvas()
scene = ti.ui.Scene()
camera = ti.ui.make_camera()
camera.position(5, 2, 2)

while window.running:
    camera.track_user_inputs(window, movement_speed=0.03, hold_key=ti.ui.RMB)
    scene.set_camera(camera)
    scene.ambient_light((0.8, 0.8, 0.8))
    scene.point_light(pos=(0.5, 1.5, 1.5), color=(1, 1, 1))
    
    scene.particles(particles_pos, color = (0.68, 0.26, 0.19), radius = 0.1)
    # Here draw 3d-lines in the scene
    scene.lines(points_pos, color = (0.28, 0.68, 0.99), width = 5.0)
    canvas.scene(scene)
    window.show()

@netlify
Copy link

netlify bot commented Jul 21, 2022

Deploy Preview for docsite-preview ready!

Name Link
🔨 Latest commit a51c0ca
🔍 Latest deploy log https://app.netlify.com/sites/docsite-preview/deploys/62da0a19b2a45800082ff7a8
😎 Deploy Preview https://deploy-preview-5492--docsite-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@taichi-gardener taichi-gardener added this to In progress in GGUI Jul 21, 2022
@xuhao1
Copy link

xuhao1 commented Jul 21, 2022

Wait so long for this feature XD

@YuCrazing YuCrazing changed the title [gui] [vulkan] Support for python users to draw 3d-lines in scene of GGUI part. [gui] [vulkan] Support 3d-lines rendering Jul 22, 2022
@Morcki
Copy link
Member Author

Morcki commented Jul 22, 2022

Wait so long for this feature XD

It's comming soon! XD

python/taichi/shaders/SceneLines_vk.vert Outdated Show resolved Hide resolved
python/taichi/shaders/SceneLines_vk.vert Show resolved Hide resolved
python/taichi/ui/scene.py Show resolved Hide resolved
Copy link
Member

@PENGUINLIONG PENGUINLIONG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@YuCrazing YuCrazing merged commit eea6f74 into taichi-dev:master Jul 22, 2022
GGUI automation moved this from In progress to Done Jul 22, 2022
@Morcki Morcki deleted the taichi-ggui_test branch July 22, 2022 03:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
GGUI
Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants