HackerTrans
トップ新着トレンドコメント過去質問紹介求人

ux

no profile record

投稿

A series of tricks and techniques I learned doing tiny GLSL demos

blog.pkh.me
3 ポイント·投稿者 ux·7 か月前·0 コメント

Text rendering and effects using GPU-computed distances

blog.pkh.me
19 ポイント·投稿者 ux·8 か月前·0 コメント

Fast calculation of the distance to cubic Bezier curves on the GPU

blog.pkh.me
157 ポイント·投稿者 ux·9 か月前·33 コメント

Code golfing a tiny demo using maths and a pinch of insanity

blog.pkh.me
107 ポイント·投稿者 ux·10 か月前·22 コメント

Perfecting anti-aliasing on signed distance functions

blog.pkh.me
5 ポイント·投稿者 ux·12 か月前·0 コメント

The current technology is not ready for proper blending

blog.pkh.me
5 ポイント·投稿者 ux·12 か月前·0 コメント

Sharing everything I could understand about gradient noise

blog.pkh.me
137 ポイント·投稿者 ux·昨年·8 コメント

コメント

ux
·7 か月前·議論
Thank you for the kind words, and you're on point with "poetry using math".

I started 2-3 months ago or so doing this stuff, so don't be too intimidated to start. Especially with the two articles (Red Alp and this one), it should make it more accessible, hopefully :)
ux
·7 か月前·議論
> Thanks for putting this together.

I'm glad it reaches an audience :)

> Only critique is.. if you're sharing to teach, your compact/one line [460] char GLSL code is a poor delivery mechanism.

Understandable. Though, the demos are here to illustrate "what you can do with the trick I'm sharing". It's like, I'm teaching you how to do watercolor, and illustrate it with some paintings you won't be able to perform just with that knowledge. They're meant to inspire you to create. You're not looking at a tutorial, you're looking at art.
ux
·7 か月前·議論
> What's a good way to get started learning to build/customize shaders with GLSL?

I gave some directions and resources in a comment here, it might help you: https://www.reddit.com/r/GraphicsProgramming/comments/1pgqis...

> And GLSL syntax looks a bit tedious to be honest, but I'd love to dive in.

With the vectorization everywhere, it's surprisingly convenient given how simple the syntax is. I personally just miss some sinpi/cospi/etc, and/or a PI and TAU constant.
ux
·9 か月前·議論
Thank you! Do we have a guarantee that these subcurves are solvable with Newton's method? The approach with derivatives has this because we know there is one crossing, and also clipping them to the zero-derivatives makes sure there won't be multiple curve "pits".
ux
·9 か月前·議論
What you described in your first message seemed similar to the approach used in the degree N root solving algorithm by Cem Yuksel; splitting the curve in simpler segments, then bisect into them. I'd be happy to explore what you suggested, but I'm not mathematically literate, so I'll be honest with you; what you're saying here is complete gibberish to me, and it's very hard to follow your point. It will take me weeks to figure out your suggestion and make a call as to whether it's actually simpler or more performant than what is proposed in the article.
ux
·9 か月前·議論
Thanks, I'll look into this. BTW, your 2nd shadertoy link is off (maybe it's private? Edit: seems you fixed it, thanks)
ux
·9 か月前·議論
I'm interested in the approach you're describing but it's hard to follow a comment in the margin. Is there a paper or an implementation example somewhere?
ux
·9 か月前·議論
Finding the sign of the distance has been extremely challenging to me in many ways, so I'm very curious about the approach you're presenting. The snippet you shared has a "a³-bcd ≤ 0" formula which is all I get without more context. Can you elaborate on it or provide resources?

The winding number logic is usually super involved, especially when multiple sub-shapes start overlap and subtracting each other. Is this covered or orthogonal to what you are talking about?
ux
·9 か月前·議論
Ah nice for noticing d!=0 is d>0. Not sure how I missed the multiplication to get rid of the vector form; I guess I was too obsessed with the x-x trick...

I added your changes to the Shadertoy version with your HN nickname. I'll integrate it to the original later.

Thanks!
ux
·10 か月前·議論
Is this tutorial kind of abandoned? There are many teased chapters that never seem to have materialized somehow.
ux
·10 か月前·議論
This is not equivalent; the `a` in `c.r+=w*a` is different, you need the original untouched w. The mountain looses its crack with your version.

But! You can save 1 char by replacing w with a:

    g -= a*=w,
    c += a*d*9.+...
    a = min(...),
    c.r += w*a*a*.2,
So thank you for the idea!
ux
·10 か月前·議論
Incredible, thank you very much. I've included the script for a quick fix, I'll see how to make to cook something myself at some point!
ux
·10 か月前·議論
Yeah. If you want implicit conversion, you need to specify a constructor like float(cond), but that would be longer than the ternary form. I thought about using a vec3() but vec3(...).x is still too long and using the vec3 directly doesn't look viable. Declaring a bool adds more characters as well. There is also step() giving the same number of chars: a=step(.001,h), but it's not more optimal: https://iquilezles.org/articles/gpuconditionals/

If you see a way to make it shorter, feel free to share :)
ux
·10 か月前·議論
Ah, someone reported this to me today, but I must admit I have no idea how to address the issue. Currently the canvas animations are stopped when out of context, but yeah they have to be loaded.

The code on the blog is pretty simple and naive (I'm not a webdev): https://github.com/ubitux/scripts/blob/main/share/blog/shade...

Any suggestion on how to address the issue is welcome.

Note: I don't have any Windows machine to test with
ux
·10 か月前·議論
Hey, thank you, that's a nice one. I added the change to the Shadertoy version with your credit. I will add a note/update on the blog and demo page later. Thanks again :)
ux
·昨年·議論
Hehe, thanks. The thing is, it could hardly have been prerecorded animations :D

I don't know if you tried before, but compressing noise is particularly hard, so 16 videos would have been quite too much of bandwidth. The total size of the shaders is something around 70kB (not minimized) for endless lossless videos, and since I had to write them anyway if I were doing records of them, it was really a no-brainer to embed them to be honest.
ux
·昨年·議論
> What an impressive and thorough deep dive.

Thanks!

> Have any of you ever gotten lost tweaking fade functions to get that perfect wave-like look?

You cannot use anything for the fade function, because you likely want the derivative (and potentially the second derivative) to be 0. See https://gist.github.com/KdotJPG/417d62708c76d53972f006cb906f... for making different ones. I personally never tried anything else than the hermite and the quintic.