patriciogonzalezvivo / lygia

LYGIA, it's a granular and multi-language (GLSL, HLSL, WGSL, MSL and CUDA) shader library designed for performance and flexibility
https://lygia.xyz
Other
2.61k stars 169 forks source link

add: srandom, noised wgsl #180

Closed sdedovic closed 3 months ago

sdedovic commented 3 months ago

A few questions:

sdedovic commented 3 months ago

I was able to (manually) preprocess this file and compile it into one of my projects. I have fully tested the functions, though.

patriciogonzalezvivo commented 3 months ago

Hi @sdedovic! I'm so glad to see you here! To your first question, yes. GLSL is usually a head or consider cannon. Lately @shadielhajj have been making huge contributions to the HLSL side, specially for the PBR and Raymarching functions.
To your second question, I led that to your discretion. I usually don't add my self when is just a translation. And just leave the original authors. But sometimes that process is not a 1:1 and feel the result is a different thing that the originally and in that case I do add my self.

I have a question about macros. What are you using to compile in WGSL? Are they supported or made your own implementation. I was working on WGSL heavily last year and at that point we didn't have #defines so I didn't use them. As you can tell for this library I really really love them and find them useful. Is something we can relay for name collisions or assume users can count on them to customize function behavior?

Thank you so much for bringing some TLC to WGSL side of LYGIA

sdedovic commented 3 months ago

I have a question about macros. What are you using to compile in WGSL?

I have a WGPU (rust-lang) project and I believe it uses Naga internally to translate the WGPU shader to the appropriate language. My project has integration tests that I manually run on Windows (DirectX), Linux (Vulkan / OpenGL), and MacOS (Metal).

As for preprocessing, I manually copy everything into one file. I plan to write my own pre-processor and open source it. Maybe in the next month.

sdedovic commented 3 months ago

@patriciogonzalezvivo updated

patriciogonzalezvivo commented 3 months ago

Awesome! thank you!

Wellcome to the license!

Screenshot 2024-08-01 at 11 48 08 AM