# \#wgsl

**URL:** https://forum.babylonjs.com/tag/wgsl/130.md

[Latest](https://forum.babylonjs.com/latest.md) · [Categories](https://forum.babylonjs.com/categories.md) · [Tags](https://forum.babylonjs.com/tags.md)

---

## [Indirect Drawing sample using WGSL](https://forum.babylonjs.com/t/indirect-drawing-sample-using-wgsl/63571)

<div class="topic-metadata">

**Author:** [@cx20](https://forum.babylonjs.com/u/cx20)\
**Replies:** 2\
**Last updated:** [June 1, 2026, 9:17pm UTC](https://forum.babylonjs.com/t/indirect-drawing-sample-using-wgsl/63571 "2026-06-01T21:17:02Z")

</div>

I recently learned about Indirect Drawing in WebGPU and tried it out in Babylon.js. This sample draws multiple shapes and materials (coins and gems) in a single GPU-driven pass, and on top of that the physics simulation…

---

## [Optical Flow -\> Fluid](https://forum.babylonjs.com/t/optical-flow-fluid/63350)

<div class="topic-metadata">

**Author:** [@rdurnin](https://forum.babylonjs.com/u/rdurnin)\
**Replies:** 3\
**Last updated:** [May 12, 2026, 11:13pm UTC](https://forum.babylonjs.com/t/optical-flow-fluid/63350 "2026-05-12T23:13:46Z")

</div>

Hey guys, I have been working on migrating some computer vision processes to WGSL and decided to take a short detour to build a proof of concept. The shader chain uses Sobel edge detection and Optical Flow to process …

---

## [WGSL PostProcess Vertex shader building wrong](https://forum.babylonjs.com/t/wgsl-postprocess-vertex-shader-building-wrong/62494)

<div class="topic-metadata">

**Author:** [@Teych](https://forum.babylonjs.com/u/Teych)\
**Replies:** 12\
**Last updated:** [February 20, 2026, 2:10pm UTC](https://forum.babylonjs.com/t/wgsl-postprocess-vertex-shader-building-wrong/62494 "2026-02-20T14:10:50Z")

</div>

I am trying to use a post process effect with a custom fragment shader. When I run my app and look at the console, I am hit with a ton of invalid shader warnings for both the fragment and vertex. It should be using the b…

---

## [Problem converting GLSL to WGSL with glslang and twgsl](https://forum.babylonjs.com/t/problem-converting-glsl-to-wgsl-with-glslang-and-twgsl/60442)

<div class="topic-metadata">

**Author:** [@drbanetti](https://forum.babylonjs.com/u/drbanetti)\
**Replies:** 4\
**Last updated:** [September 10, 2025, 3:16pm UTC](https://forum.babylonjs.com/t/problem-converting-glsl-to-wgsl-with-glslang-and-twgsl/60442 "2025-09-10T15:16:20Z")

</div>

Hello, I don’t know if this belongs here, as I don’t have much experience with shaders I think this is mostly a question of me doing something wrong along the way… I’ve tried to test the conversion from GLSL to WGSL si…

---

## [Hair Simulation WebGPU](https://forum.babylonjs.com/t/hair-simulation-webgpu/55663)

<div class="topic-metadata">

**Author:** [@Propolisa](https://forum.babylonjs.com/u/Propolisa)\
**Replies:** 24\
**Last updated:** [May 30, 2025, 3:41am UTC](https://forum.babylonjs.com/t/hair-simulation-webgpu/55663 "2025-05-30T03:41:56Z")

</div>

Hey folks happy new year! For a very WIP underwater first-person-fishing game with a currently very hairless character, I wanted non-rigid hair. But of course it will also be useful for various soft elements like float…

---

## [Summary of objects in WebGPU ShaderMaterial and Babylon-specific WGSL](https://forum.babylonjs.com/t/summary-of-objects-in-webgpu-shadermaterial-and-babylon-specific-wgsl/57493)

<div class="topic-metadata">

**Author:** [@HiGreg](https://forum.babylonjs.com/u/HiGreg)\
**Replies:** 2\
**Last updated:** [April 1, 2025, 6:20am UTC](https://forum.babylonjs.com/t/summary-of-objects-in-webgpu-shadermaterial-and-babylon-specific-wgsl/57493 "2025-04-01T06:20:25Z")

</div>

Edited to correct my errors based on @Evgeni\_Popov’s reply I had a rough time figuring out how to declare Babylon objects and use them within Babylon’s slightly-modified WGSL shader language. This comes from experimenta…

---

## [StorageTexture writable from WebGPU Vertex Shader?](https://forum.babylonjs.com/t/storagetexture-writable-from-webgpu-vertex-shader/57499)

<div class="topic-metadata">

**Author:** [@HiGreg](https://forum.babylonjs.com/u/HiGreg)\
**Replies:** 3\
**Last updated:** [March 31, 2025, 8:15am UTC](https://forum.babylonjs.com/t/storagetexture-writable-from-webgpu-vertex-shader/57499 "2025-03-31T08:15:44Z")

</div>

Error in console: How do I add a StorageTexture that I write from WebGPU Vertex Shader. I get Storage texture binding with StorageTextureAccess::WriteOnly is used with a visibility (ShaderStage::Vertex) that contain…

---

## [\[WebGPU\] Getting final vertex positions of a mesh (bones + morph targets) as a storage buffer](https://forum.babylonjs.com/t/webgpu-getting-final-vertex-positions-of-a-mesh-bones-morph-targets-as-a-storage-buffer/56213)

<div class="topic-metadata">

**Author:** [@Propolisa](https://forum.babylonjs.com/u/Propolisa)\
**Replies:** 0\
**Last updated:** [January 27, 2025, 12:25am UTC](https://forum.babylonjs.com/t/webgpu-getting-final-vertex-positions-of-a-mesh-bones-morph-targets-as-a-storage-buffer/56213 "2025-01-27T00:25:38Z")

</div>

After some great help from @Evgeni\_Popov and @CodingCrusader in my hair simulation journey, I made something a bit too general for that thread but which might be useful to anyone else working with WebGPU and wants to cal…

---

## [Can the height, width, and depth of the current mesh be obtained in the shader](https://forum.babylonjs.com/t/can-the-height-width-and-depth-of-the-current-mesh-be-obtained-in-the-shader/55817)

<div class="topic-metadata">

**Author:** [@Kelede](https://forum.babylonjs.com/u/Kelede)\
**Replies:** 2\
**Last updated:** [January 8, 2025, 5:05am UTC](https://forum.babylonjs.com/t/can-the-height-width-and-depth-of-the-current-mesh-be-obtained-in-the-shader/55817 "2025-01-08T05:05:24Z")

</div>

I created a terrain using a height map and then wrote a shader to color it according to different heights. I need to input a set of colors, each containing RGB color values and percentage height values. I need to obtain …

---

## [GreasedLine fully ported to WebGPU / WGSL](https://forum.babylonjs.com/t/greasedline-fully-ported-to-webgpu-wgsl/55219)

<div class="topic-metadata">

**Author:** [@roland](https://forum.babylonjs.com/u/roland)\
**Replies:** 4\
**Last updated:** [January 6, 2025, 5:59pm UTC](https://forum.babylonjs.com/t/greasedline-fully-ported-to-webgpu-wgsl/55219 "2025-01-06T17:59:18Z")

</div>

Hey everyone! I’ve ported all GreasedLine shaders to WGSL. You can use all GreasedLine material types with WebGPU/WGSL. Material types docs Please keep in mind that you must use RGBA texures with WebGPU when using you…

---

## [Post Process infinite grid "jittering"](https://forum.babylonjs.com/t/post-process-infinite-grid-jittering/52834)

<div class="topic-metadata">

**Author:** [@Romulus2100](https://forum.babylonjs.com/u/Romulus2100)\
**Replies:** 1\
**Last updated:** [August 16, 2024, 5:42pm UTC](https://forum.babylonjs.com/t/post-process-infinite-grid-jittering/52834 "2024-08-16T17:42:32Z")

</div>

I’m trying to create a measurement grid on the XY plane using an orthographic camera similar to many CAD applications. I have decided it was a better idea to implement the grid effect as a post-processing effect instead…

---

## [\[WebGPU\] Unable to use StorageBuffer in PostProcess shader](https://forum.babylonjs.com/t/webgpu-unable-to-use-storagebuffer-in-postprocess-shader/51375)

<div class="topic-metadata">

**Author:** [@Propolisa](https://forum.babylonjs.com/u/Propolisa)\
**Replies:** 8\
**Last updated:** [July 3, 2024, 1:57pm UTC](https://forum.babylonjs.com/t/webgpu-unable-to-use-storagebuffer-in-postprocess-shader/51375 "2024-07-03T13:57:58Z")

</div>

Hello folks! I already owe so much of my progress with Babylon to the questions and answers here. :heart: Now I’m bringing one of my own: I am using a WGSL-flavored pixel shader for post processing in my game (source no…

---

## [WebGPU WGSL Vertex shader definition for PostProcess](https://forum.babylonjs.com/t/webgpu-wgsl-vertex-shader-definition-for-postprocess/46483)

<div class="topic-metadata">

**Author:** [@Bumpy](https://forum.babylonjs.com/u/Bumpy)\
**Replies:** 5\
**Last updated:** [December 17, 2023, 9:47am UTC](https://forum.babylonjs.com/t/webgpu-wgsl-vertex-shader-definition-for-postprocess/46483 "2023-12-17T09:47:51Z")

</div>

Hey there! Right now im trying to create post process shader with webGPU, using some examples from docs I initialized fragment shader and it works just fine, but when Im adding vertex shader definition it fails with D…

---

## [CYOS zip download stores shaders in ShadersStoreWGSL, even with WebGL](https://forum.babylonjs.com/t/cyos-zip-download-stores-shaders-in-shadersstorewgsl-even-with-webgl/45962)

<div class="topic-metadata">

**Author:** [@cx20](https://forum.babylonjs.com/u/cx20)\
**Replies:** 7\
**Last updated:** [November 29, 2023, 1:48pm UTC](https://forum.babylonjs.com/t/cyos-zip-download-stores-shaders-in-shadersstorewgsl-even-with-webgl/45962 "2023-11-29T13:48:55Z")

</div>

I tried zip download using CYOS. https://cyos.babylonjs.com/ Strangely enough, even if WebGL1/2 is selected as the 3D API, shaders seem to be stored in ShadersStoreWGSL. I suggest revising the logic to ensure tha…

---

## [CYOS's WebGPU Phong shader may be incorrect](https://forum.babylonjs.com/t/cyoss-webgpu-phong-shader-may-be-incorrect/45914)

<div class="topic-metadata">

**Author:** [@cx20](https://forum.babylonjs.com/u/cx20)\
**Replies:** 6\
**Last updated:** [November 27, 2023, 3:22pm UTC](https://forum.babylonjs.com/t/cyoss-webgpu-phong-shader-may-be-incorrect/45914 "2023-11-27T15:22:52Z")

</div>

I tried the CYOS WebGPU shader. https://cyos.babylonjs.com/ However, the execution result of WebGPU’s Phong shader seems to be too bright compared to WebGL2. When I checked the code, it seems that specComp2 is being c…

---

## [How to display triangles with WebGPU + WGSL?](https://forum.babylonjs.com/t/how-to-display-triangles-with-webgpu-wgsl/37427)

<div class="topic-metadata">

**Author:** [@cx20](https://forum.babylonjs.com/u/cx20)\
**Replies:** 9\
**Last updated:** [October 23, 2023, 3:38pm UTC](https://forum.babylonjs.com/t/how-to-display-triangles-with-webgpu-wgsl/37427 "2023-10-23T15:38:57Z")

</div>

Below is a sample triangle using GLSL in Babylon.js. This does not seem to be a problem. BABYLON.ShaderStore.ShadersStore\["customTriangleVertexShader"\] = \`#version 300 es in vec3 position; in vec4 color; …

---

## [The specifications of the compute shader used in Image Blur are outdated](https://forum.babylonjs.com/t/the-specifications-of-the-compute-shader-used-in-image-blur-are-outdated/44594)

<div class="topic-metadata">

**Author:** [@cx20](https://forum.babylonjs.com/u/cx20)\
**Replies:** 2\
**Last updated:** [October 1, 2023, 10:16am UTC](https://forum.babylonjs.com/t/the-specifications-of-the-compute-shader-used-in-image-blur-are-outdated/44594 "2023-10-01T10:16:40Z")

</div>

I noticed that some of the compute shader samples in the document link below do not work. https://playground.babylonjs.com/?webgpu#3URR7V#185 error: cannot initialize let of type 'vec2\<i32\>' with value of type 'vec2\<u…

---

## [Compute Shaders Order Execution](https://forum.babylonjs.com/t/compute-shaders-order-execution/41412)

<div class="topic-metadata">

**Author:** [@deadpe5](https://forum.babylonjs.com/u/deadpe5)\
**Replies:** 30\
**Last updated:** [June 28, 2023, 8:33pm UTC](https://forum.babylonjs.com/t/compute-shaders-order-execution/41412 "2023-06-28T20:33:08Z")

</div>

Hello, everyone. Sorry, if this question is silly or was already answered, but is it possible to control compute shaders order execution, to call next compute shader only when previous done his work? I am trying to make …

---

## [Newbie question about @workgroup\_size](https://forum.babylonjs.com/t/newbie-question-about-workgroup-size/41363)

<div class="topic-metadata">

**Author:** [@deadpe5](https://forum.babylonjs.com/u/deadpe5)\
**Replies:** 1\
**Last updated:** [June 5, 2023, 8:16am UTC](https://forum.babylonjs.com/t/newbie-question-about-workgroup-size/41363 "2023-06-05T08:16:05Z")

</div>

Hello everyone. I’m new to webGPU and compute shaders and want to ask how to determine size of workgroup and what these values are used for. Also, do the values of @workgroup\_size correspond the values (x, y, z) I pass t…

---

## [Convert GLSL to WGSL](https://forum.babylonjs.com/t/convert-glsl-to-wgsl/40786)

<div class="topic-metadata">

**Author:** [@arcman7](https://forum.babylonjs.com/u/arcman7)\
**Replies:** 3\
**Last updated:** [May 14, 2023, 10:43pm UTC](https://forum.babylonjs.com/t/convert-glsl-to-wgsl/40786 "2023-05-14T22:43:06Z")

</div>

I know that babylon.js can convert glsl shader code on the fly to wgsl, I was wondering is it possible to setup a playground that simply outputs the converted code? This would be a useful tool and I’m not having much loo…

---

## [How to get error callback when computeshader.Dispatch work wrong?](https://forum.babylonjs.com/t/how-to-get-error-callback-when-computeshader-dispatch-work-wrong/29571)

<div class="topic-metadata">

**Author:** [@Moriy](https://forum.babylonjs.com/u/Moriy)\
**Replies:** 9\
**Last updated:** [April 22, 2022, 10:11am UTC](https://forum.babylonjs.com/t/how-to-get-error-callback-when-computeshader-dispatch-work-wrong/29571 "2022-04-22T10:11:24Z")

</div>

Hi~ Nearly day, I want to learn how to use ComputeShader, and have some trying with writing wgsl. I find it is very hard to get error log when cs.Dispatch() working wrong. It always log warning in the console. it is …
