Live data from Hacker News

Interactive intro to shaders

mayerowitz.io

21–30 of 72 posts

Re: Interactive intro to shaders

#21

I finally found the courage to write and expose myself to the internet. I've always wanted to learn shaders so I thought it would be nice to document my learning and share it with others.

Thanks for sharing! I started learning about the Godot Engine recently, and I was just beginning to fiddle with shaders. This was an excellent article to give me a few more points to start with. But, oh boy, the curve is steep.

Re: Interactive intro to shaders

#22

“their parallel nature makes them memoryless and stateless. This translates to: “You can’t store or share data between pixels or shader executions.”” This kind of constraint is so liberating for me for some reason. It just narrows the space a lot I guess. I also kind of love not having imports and libraries as that also really simplifies things.

I might be wrong but there are compute shaders that can retake inputs and well, do more computing on them afaik.

Re: Interactive intro to shaders

#23
Very nice, I've tried looking at a couple other tutorials in the past but they always assume more prior knowledge than I have.

This really hits the sweet spot for me.

Would love to see tutorials on more topics. In particular, a very basic lighting model but with a detailed breakdown on how normals and dot product work together.

Yes, there's plenty of info out there, but I think your teaching style would still make it worthwhile

Re: Interactive intro to shaders

#24

I finally found the courage to write and expose myself to the internet. I've always wanted to learn shaders so I thought it would be nice to document my learning and share it with others.

Looks like a good way to introduce newbies to the world of shaders, many thanks for putting this out, I already have a recipient in mind for this content.

Re: Interactive intro to shaders

#25
post #22

“their parallel nature makes them memoryless and stateless. This translates to: “You can’t store or share data between pixels or shader executions.”” This kind of constraint is so liberating for me for some reason. It just narrows the space a lot I guess. I also kind of love not having imports and libraries as that also really simplifies things.

I might be wrong but there are compute shaders that can retake inputs and well, do more computing on them afaik.

You can set up shaders to access a shared global texture (and write to it). It’s more expensive and a bit to set up so it’s not totally true, but it’s a good first mental model

Re: Interactive intro to shaders

#26

I finally found the courage to write and expose myself to the internet. I've always wanted to learn shaders so I thought it would be nice to document my learning and share it with others.

This feels like the absolute best way to give an introduction to shaders, given that they're completely graphical. The way the interactive code is embedded within the article, instead of being a link to an excercise works super well.

Thanks a lot for making this, keep doing what you do!

Re: Interactive intro to shaders

#27
post #23

Very nice, I've tried looking at a couple other tutorials in the past but they always assume more prior knowledge than I have. This really hits the sweet spot for me. Would love to see tutorials on more topics. In particular, a very basic lighting model but with a detailed breakdown on how normals and dot product work together. Yes, there's plenty of info out there, but I think your teaching style would still make it…

As a general rule, the third article/book/tutorial you read is the one where you "get it".

Re: Interactive intro to shaders

#29
post #10

I finally found the courage to write and expose myself to the internet. I've always wanted to learn shaders so I thought it would be nice to document my learning and share it with others.

Tangential to the main topic, what generative art artists are you following and/or where did you look to find them? I found a couple myself (@D_VISION7 @lv374 @beesandbombs @HAL09999), but ran into roadblocks trying to find more. There are a few fractals here and there, etc. Shadertoy seemed mostly like math demos/challenges rather than art, or at least it doesn't have an easy way to find the artsy ones.

Can only recommend checking out https://www.fxhash.xyz/. It's an NFT platform for generative art. Think of NFTs what you will but that platform really brought together lots of artists and in my opinion the field has advanced a lot these past two years due to that platform existing.

Personally I really like @KilledByAPixel and @piterpasma simply from a technical perspective. If you're into vector / plotting work @zancan is definitely worth checking out.

Re: Interactive intro to shaders

#30
post #22

“their parallel nature makes them memoryless and stateless. This translates to: “You can’t store or share data between pixels or shader executions.”” This kind of constraint is so liberating for me for some reason. It just narrows the space a lot I guess. I also kind of love not having imports and libraries as that also really simplifies things.

I might be wrong but there are compute shaders that can retake inputs and well, do more computing on them afaik.

Indeed it's a simplification! You can use buffers to keep information from previous states or share state between pixels (for both fragment and compute shaders). Though it can greatly reduce the performance sometimes. For an intro however, I think it's simpler to assume no memory nor shared state.
Post reply on HN