cloth-simulation-homework icon indicating copy to clipboard operation
cloth-simulation-homework copied to clipboard

Submit your homework here

Open neozhaoliang opened this issue 2 years ago • 8 comments

Please submit your homework in this issue. Recommended submission formats:

Repo link: https://github.com/your-name/your-repo

Description: which challenge did you finish? And quickly summarize what you did in your code.

Screenshots: https://raw.githubusercontent.com.../xxxx.png

neozhaoliang avatar Jun 01 '22 02:06 neozhaoliang

Repo link: https://github.com/chunleili/cloth-simulation-homework

Description: complete the easy and medium tasks. Hard is not finished. And medium 2(prevent the cloth to be ripped) is not understood. 本着用最小的修改原则(能不改的不改,尽量增加而不是修改)进行了修改。防止刺穿那点暂时不会。还没用其他语言写过。全部过程描述已放到上述repo readme中。

Screenshots: demo.png

image

chunleili avatar Jul 05 '22 07:07 chunleili

@chunleili 不错!基本的挑战已经完成了。不过你的代码如果要添加很多球的话写起来就很麻烦了。其实有更简单的写法:

ball_center = ti.Vector.field(3, dtype=float, shape=(3, ))
ball_center[0] = [-0.5, 0, 0]
ball_center[1] = [0, 0, 0]
ball_center[2] = [0.5, 0, 0]

就可以了。后面碰撞检测的时候可以直接用 for loop 遍历所有的球,不需要每个球都写一遍代码。

neozhaoliang avatar Jul 06 '22 15:07 neozhaoliang

Repo link: https://github.com/tlcui/cloth_simulation_demo

Description: 用C++和opengl实现了一下这个demo,可以添加更多的球,加了一个布料与小球摩擦的trick。在个人PC上执行比taichi的ti.cpu运行更快(相应的taichi实现也在该repo中 https://github.com/tlcui/cloth_simulation_demo/blob/master/cloth_simulation.py )。 碰撞和布料的自相交太难不会>_<。详细情况可见该repo的readme。

Screenshots: https://github.com/tlcui/cloth_simulation_demo/blob/master/results.gif results

tlcui avatar Jul 31 '22 15:07 tlcui

@tlcui The repo is private?

neozhaoliang avatar Jul 31 '22 15:07 neozhaoliang

@tlcui The repo is private?

不好意思 操作失误。现在已经设置为公开了^_^

tlcui avatar Jul 31 '22 16:07 tlcui

能用 C++ 和 opengl 实现也是很棒的了!穿模有点明显, 不过瑕不掩瑜。你的实现跑得比 taichi 快应该是可以预料的,因为taichi版本是跑在 cpu 上的。要不要在你的代码里面把开头改成 ti.init(arch=ti.vulkan) 试试?

neozhaoliang avatar Aug 01 '22 06:08 neozhaoliang

能用 C++ 和 opengl 实现也是很棒的了!穿模有点明显, 不过瑕不掩瑜。你的实现跑得比 taichi 快应该是可以预料的,因为taichi版本是跑在 cpu 上的。要不要在你的代码里面把开头改成 ti.init(arch=ti.vulkan) 试试?

之前忘了给布料shading,是直接指定颜色的。现在改过来了,算了法向量,也有shading了,现在布料看上去自然了不少hhh,帧数还是60左右。taichi里用ti.vulkan速度确实快的夸张,有215帧,甚至远远比ti.cuda还要快,非常震撼 results_new

tlcui avatar Aug 02 '22 15:08 tlcui

Hi, @chunleili @tlcui Thanks for your great job. We have souvenirs for those who finished this homework. Please fill in the form if you'd like to get it. We will ship the souvenir the first Friday after we receive your information.

lucywsq avatar Aug 09 '22 03:08 lucywsq