Right now at Frame we have an Asset type that uses the grease line material, but when that tries to spawn we get this error:
Uncaught (in promise) The plugin "GreasedLinePluginMaterial" can't be added to the material "doodleMat.doodler1732047173675" because the plugin is not compatible with the shader language of the material
Is there some Boolean I need to flip or is there just generally no support for wgsl grease lines right now?
Guys I had a āfreeā weekend so I was able to port almost every feature of GreasedLine into WGSL.
However Iām figthing an interesting issue:
The lines are rendered correctly initially. When I start to rotate the camera the lines starts to jitter. I couldnāt solve this issue yet, I checked the shader code multiple times. Maybe Iāve missed something so Iāll go trough it again and again
EDIT:
If I set the viewProjection in my code the jittering disappears and everything runs smoothly:
Material: uniformBuffer.updateMatrix("viewProjection", this._scene.getTransformMatrix());
Shader: let grlMatrix: mat4x4f = uniforms.viewProjection * finalWorld;
Shouldnāt the framework set the value of viewProjection in the same way?
Uniform buffers (scene, mesh, material) are automatically used by the standard/PBR materials, but not by shader materials. You have to declare them explicitely if you use them in shader materials (through the uniformBuffers option parameter). However, if your code is part of a plugin material, I think scene.viewProjection should work => let me know if you are in this case and I will have a look.
But Iāve recently pushed new code which uses this approach:
If I set the viewProjection in my code the jittering disappears and everything runs smoothly:
Material: uniformBuffer.updateMatrix("viewProjection", this._scene.getTransformMatrix());
Shader: let grlMatrix: mat4x4f = uniforms.viewProjection * finalWorld;
Do you want me to push the previous version which uses scene.viewProjection in the shader?
I just tested locally the PG you linked above, but with your previous code (so, I removed lines 265-271 in greasedLinePluginMaterial.ts and used scene.viewProjection instead of uniforms.viewProjection in the WGSL code), and it does work for me, I donāt have any jittering, the PG behaves in WebGPU as in WebGL. Can you re-test on your side/rollback to the old code in your PR?
I confirm I donāt have any problems with the current code of the PR using the test link of the CI ( Babylon.js Playground) and testing the changes locally.
So, it must be a problem on MacOS. Do you use Safari or Chrome on your Mac?
There seems to be a specific problem in Chrome, as the 3 browsers have 3 different WebGPU implementationsā¦ To solve this problem, I think you should go back to using a uniform, but we should probably revisit this case later.