Conversion to HLSL #10
Replies: 9 comments 7 replies
-
Nice work. I've also done and repo'd a port of the psrdnoise GLSL and its various example permutations to Unity shaders and ShaderGraph nodes. It's certainly a wonderful gift that stegu has given us, even if I don't understand word one of the maths involved lol. |
Beta Was this translation helpful? Give feedback.
-
|
I would be happy to include your ports in my repo. There is already a WGSL
port there, because I felt like learning it. Just submit a pull request,
and I will accept it.
Because there are multiple ports, and because they are external
contributions, I would suggest submitting them as separate subfolders. I
might take a stab at merging the versions some time, but for now, it would
be a great addition to just have at least one working HLSL port in there,
even if it wouldn't be actively maintained by me and tested only by others.
People are asking me for it, so there is most definitively an interest out
there. My own reluctance to get up close and personal with HLSL (and
Direct3D) doesn't make me oblivious to the fact that it exists and is being
used.
|
Beta Was this translation helpful? Give feedback.
-
|
Yeah, sorry for not being more clear, the "-min" versions are the same
functions, only with more compact source code. Because GLSL shaders are
compiled from source text by the application, people who write demos don't
care for comments
and verbose license texts.
If you're not itching to make a pull request, you can simply send me
whatever code you want to share in a zip file, or send me a link. My e-mail
address is "stefan dot gustavson at gmail dot com", as listed in the source
for psrdnoise. I probably won't be able to test HLSL stuff any time soon,
but hosting it on Github makes it easy for others to submit fixes if they
find a bug.
this man has tapped into the arcane
FYI, I'm not actually a wizard, just a mad scientist. (Insert diabolical
"Muhahahaa", picture me in a double-buttoned lab coat and weird goggles, in
a room lit by sparks.)
|
Beta Was this translation helpful? Give feedback.
-
|
I'm looking forward to any PRs or links, or file dumps over email. I am
struggling with a pretty bad case of post-Covid at the moment, with an
often overwhelming brain fatigue, so I might not be quick to act, but
please don't take that as a lack of interest.
Myself, I recently modified a plain C software version of psrdnoise2 to use
only integer math and mostly 8-bit data types, to run on the lower ranks of
Arduino boards. It's fast enough for low-res LED effects (in my case, a
Neopixel light saber blade) and sound synthesis (also for that light
saber). That code might find a place in the repo as well if I include
"miscellaneous ports".
|
Beta Was this translation helpful? Give feedback.
-
|
Shannon, your hard and appreciated work with the Unity shader ports is now
at least linked and mentioned from stegu/psrdnoise. Given my current
less-than-ideal state of mind, I'm not sure I would get it right if I tried
to decide what to include if I were to duplicate your files in my repo, but
feel free to put together a pull request if you want your files to be
duplicated in, say, a directory named "src/unity".
|
Beta Was this translation helpful? Give feedback.
-
|
Hey there! I'm just tapping into the HLSL ports and I think I found an error. This part: This doesn't compile for me, but not entirely sure it's an error or if it's because I'm using slang for my shaders which might not map 100% to HLSL. Here's the original for comparison: I ended up using this, which also is probably a bit more optimal because it calculates sin and cos at the same time: |
Beta Was this translation helpful? Give feedback.
-
|
I didn't do the HLSL ports, and I have no easy means for testing this, but
that part does look wrong. The hash is different for each grid point, and
the ported code doesn't look as if it handles that properly, with or
without your fix.
|
Beta Was this translation helpful? Give feedback.
-
|
I'm sorry for my confusion, your fix seems fine. The original code is
nonsense, though, and doesn't look like it ever worked.
|
Beta Was this translation helpful? Give feedback.
-
|
@Ollhax @stegu I didn't personally get to test every bit of this, as I really only needed a part of this noise library and just converted the rest while I was there as well. If something looks incorrect, it probably is, and your input here is invaluable! glad you caught this. I dont have time at the moment and am liable to forget, but this fix should definitely be upstreamed it should be worth noting that the float conversion issues might be compiler-specific, as it did compile on my end using Unity's compiler, though that is far from a proper reference compiler that this conversion should hold itself accountable to |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey all, I've converted this and the webgl-noise repos to HLSL. Thank you stegu for this amazing work, I look forward to using it for years to come, and I hope my translation helps others do the same.
Beta Was this translation helpful? Give feedback.
All reactions