Vala プログラミング

WebGPU プログラミング

おなが@京都先端科学大

GNUStepSwiftBridge & OpenGL

GNUStepSwiftBridge を使って NSOpenGLView への描画にトライしました。[ 実行結果 ] Swift で OpenGL による描画のサンプルがあります。 GitHub - sakrist/Swift_OpenGL_Example: :star: Swift OpenGL Example written with swift (for Ubuntu, macOS, iOS …

GNUStepSwiftBridge & CairoGraphics

前回の GNUStepSwiftBridge を利用して、CairoGraphics を行いました。 実行結果 起動時 メニューアイテム(AItem)をクリック時 InfoPanel の表示 前回からの変更点 Resources ファイルの .build/debug ディレクトリへのコピー 前回はResouces を手動で コピ…

GNUStepSwiftBridge

discuss-gnustep mailing list(https://mail.gnu.org/archive/html/discuss-gnustep/) の8月のリストに、以下のような投稿がありました。 Swift calling into GNUStep Progress github: https://github.com/austintatiousness/GNUStepSwiftBridgeこのスレッ…

Swift CairoGraphics

前回報告した GNUstep CoreGraphics は、「今更 GNUstep ?」感がありますので、同様な事を Swift で行ってみました。 Linux(Lubuntu 22.04) の Swift(v5.8) を使用しています。 (Swift のインストールは、UbuntuでSwiftの環境構築を行う方法を参照。 バー…

GNUstep CoreGraphics (2)

前回報告した ProjectCenter を使って作成した CoreGraphics のプログラムです。実行結果 起動時の画面 (Draw1) Draw2(メニューから Draw → Draw2 を選択) Draw3 Draw4 プログラム (プロジェクト生成時以降、編集したプログラム) Headers AppController.…

GNUstep CoreGraphics (1)

今回は、ブログタイトルから離れて、GNUstep について書いています。最近 GNUstep や Objective-C についての記事が、2、3報告されています。 今更のObjective-C | 貯え 小道具 興味ない? M1 Mac-Ubuntu20.04でGNUstep | 貯え 小道具 興味ない? GNUstep…

Babylon.js WebGPU Cloth Simulation (3)

前々回アップした、XPBD(extended position-based dynamics) による Cloth シミュレーションの解説です。今回はマウス操作について説明しています。実行結果 cloth の上でマウスをクリックしドラッグすると、cloth が引っ張られた状態になります。1 mouse d…

Babylon.js WebGPU Cloth Simulation (2)

前回アップした、XPBD(extended position-based dynamics) による Cloth シミュレーションの解説です。1 GPU StorageBuffer compute shader で扱うデータは、storage buffer を介して利用する。 mesh の各vertex point のデータは、Particle 構造体とし、そ…

Babylon.js WebGPU Cloth Simulation

Babylon.js WebGPU を用いて、XPBD(extended position-based dynamics) による Cloth シミュレーションを行なってみました。 XPBD の計算は、compute shader で GPU 計算を行なっています。XPBD による Cloth シミュレーションは、下記を参照しました。 http…

Chrome Stable WebGPU

2022/07/05/ chrome stable version 103 WebGPU: version 2022/05/13 WGSL: version 2022/04/11chrome の安定版(現在のバージョンは 103)でも、WebGPU を利用できます。 WebGPU Samples https://austin-eng.com/webgpu-samples/ このサンプルでは、Next.js…

WebGPU Triangle and Instancing (WebGPU, WGSL update)

06/28/2022 chrome canary version 105 WebGPU, WGSL 06/17/2022chrome canary について (WebGPU を利用するには、chrome://flags/#enable-unsafe-webgpu を設定する。) この時点では GPUDevice の読み込みが不安定になっています。 requestDevice の read…

物理シミュレーション 剛体の衝突 4 PositionBased ( ShapeMatching )

PositionBased ( ShapeMatching ) による、剛体の衝突シミュレーションです。[ 実行結果] 参考にした文献とサイト Meshless Deformations Based on Shape Matching https://matthias-research.github.io/pages/publications/publications.html 藤澤 誠著「CG…

物理シミュレーション 剛体の衝突 3 PositionBased ( Constraint )

PositionBased(Constraint) による、剛体の衝突シミュレーションです。[ 実行結果] 2Dシミュレーション メッシュの描画には、 BabylonJS を使用しています。参考にした文献とサイト Position Based Dynamics https://matthias-research.github.io/pages/pub…

物理シミュレーション 剛体の衝突 2 ( Force Based )

Force Based による、剛体の衝突シミュレーションです。[ 実行結果 ] 2Dシミュレーション メッシュの描画には、 BabylonJS を使用しています。シミュレーションの方法 壁との衝突、剛体同士の衝突での力、トルクの計算は、以下を参照しています。 「WebGLに…

物理シミュレーション 剛体の衝突 1

物理シミュレーションの勉強のため、剛体の衝突についてまとめてみました。 剛体衝突の物理シミュレーションは、主に以下の3つの方法で行われています。 1 Force Based 2 Position Based(Constraint) 3 Position Based(ShapeMatching) 衝突のシミュレー…

Julia MeshCat SPH 流体シミュレーション (Mesh)

update 2022/03/03 Julia MeshCat SPH 流体シミュレーション (Mesh) の記事のupdate です。 GeometryTypes ライブラリーが GeometryBasics に変更されました。 この変更により、MeshCat でメッシュの表示ができなくなっていました。 この変更に合わせて、Mes…

WebGPU WGSL 仕様 update

最近のWebGPUとWGSLの仕様 update により、前回プログラムにエラーが出て表示できなくなっていました。WebGPUでは、ワーニングが出ます。 Error : WGSL E1: a compute shader must include 'workgroup_size' in its attributes fn main([[builtin(global_inv…

WebGPU SPH シミュレーション(3)

最近、W3C が WebGPUとWGSL仕様書の published version を出すようになりました。(6月7日修正) WGSL の最近の仕様変更により、4月26日付のプログラム「WebGPU SPH シミュレーション(2)」は実行できなくなりました。 以下のようなエラーとワーニングが…

Babylon.js WebGPU Fluid MAC ( Chrome Canary )

Babylon.js WebGPU で流体シミュレーションを行なってみました。計算には、MAC法を用いています。 以下のサイトと本を参考にしました。 1 「数学とか語学とか楽しいよね」 【Navier-Stokes方程式】MAC法によるNavier-Stokes方程式の離散化 https://mathlang…

Babylon.js WebGPU Instancing ( Chrome Canary )

Babylon.js WebGPU Compute Shaders examples にある Compute_Boids を参考にして、instancing にトライしました。実行結果 プログラム instancing.html <html> <head> <title>Babylon.js WebGPU Instancing</title> <script src="https://preview.babylonjs.com/babylon.js"></script> </head> <body> </body></html>

Babylon.js WebGPU Compute Shader ( Chrome Canary )

Babylon.js のWebGPUで Compute Shader が使えるようになりました。 ( v5.0.0-alpha で動作します。)Compute Shaders | Babylon.js Documentation https://doc.babylonjs.com/advanced_topics/shaders/computeShader この画面からSimple compute shaders exa…

WebGPU SPH シミュレーション(2)

(4月26日修正) WGSL の最近の仕様変更により、4月6日付のプログラムは実行できなくなり ました。 エラー箇所 1Parser error: A structure type with a [[block]] decoration cannot be used as an element of an array 変更 [[block]] struct Particle…

ThreeJS WebGPU & Neighbor Search ( 近傍探索 )

前回の WebGPU に続いて、ThreeJS WebGPU で、Neighbor Search を 行ってみました。 (粒子の表示は、前回同様です。)プログラム NeighborSearch-ThreeJS-WebGPU.html <html> <head> <title>Neighbor Search ThreeJS</title> <meta charset="utf-8"> </head> <body> <script type="module"> import * as THREE from '../build/three.module.js'; </body></html>…

WebGPU & Neighbor Search ( 近傍探索 )

WebGPU で Compute Shader を用いて、Neighbor Search を行ってみました。2d 画面を 9個のセルに区切り、注目の粒子を赤色、同じセル内の粒子を黄色、 その隣のセル内にある粒子を緑色、それ以外の粒子を灰色で示しています。 隣接セルは、注目粒子に近いセ…

Three.js WebGPU SPH シミュレーション ( Chrome Canary)

Three.js WebGPU compute shader instancing に関する以下の記事がありました。 WebGPURenderer: Initial instancing support https://github.com/mrdoob/three.js/pull/20407 この記事を参考にして、Three.js WebGPU を用いて SPH (Smoothed Particle Hydro…

WebGPU SPH シミュレーション ( Chrome Canary )

WebGPUを使って、SPH(Smoothed Particle Hydrodynamics)のシミュレーションを行いました。 メインPCをMacBook Pro(13in.)に変えました。Chrome Canaryを使って表示して います。SPHの計算は、前回のjuliaによる計算と同様ですが、ここではcompute shaderを …

WebGPU with Firefox Nightly ( Linux ) 2

HTMLとJavaScriptで書かれたWebGPUのサンプルがありましたので、 Firefox Nightlyでトライしてみました。 プログラムは、以下のサイトにあります。 tsherif/webgpu-examples https://github.com/tsherif/webgpu-examplestriangle particles cube cube-textur…

WebGPU in Firefox Nightly ( Linux )

最近、「A Taste of WebGPU in Firefox」という記事(2020/04/23の記事)を見つけました。 Firefox Nightly で WebGPU が使えるようになっています。 hacks.mozilla.orgこれまで、Windows版の「Chrome Canary」を使って、WebGPU を試していました。 Firefox …

Julia MeshCat SPH 流体シミュレーション (Mesh)

Julia MeshCat ライブラリを用いた、水柱崩壊のシミュレーションです。 流体のシミュレーションには、SPH (Smoothed Particle Hydrodynamics) 法を 使用しています。 前回は、PointCloudを用いて、粒子による描画を行いました。 今回は、Marching cubes法を…

Julia MeshCat SPH 流体シミュレーション (PointCloud)

Julia MeshCat ライブラリを用いて、水柱崩壊のシミュレーションを行ってみました。 流体のシミュレーションには、SPH (Smoothed Particle Hydrodynamics) 法を 使用しています。 MeshCat ( Julia bindings to the MeshCat WebGL viewer) https://github.com…