News for hackers. Stuff that matters.
Re:The Book of Shaders by Waterluvian on Wednesday November 01, 2017 @02:02PM (#15603833)
This looks great for someone like me who has no idea what shaders are, but it really needs to start with, "...Fragment Shaders, those things that do X with computer graphics."

Written by people who know what the topic is already, so I think they miss that I went into this not knowing if they were talking about computers or some art form or ink and pen style or whatnot.

Re:The Book of Shaders by sp332 on Wednesday November 01, 2017 @02:39PM (#15604213)
A fragment shader a.k.a. pixel shader is a program that runs once for each pixel [edit: per frame!]. It's at the end of the graphics pipeline so the geometry and texture of a scene is already available as an input. So it can either interpret the scene and decide how to render the output, or it can even ignore the scene and draw something completely original. Lots of examples at https://www.shadertoy.com/ (Warning: it might bog down your browser if you have a crummy GPU.)
Re:The Book of Shaders by leggomylibro on Wednesday November 01, 2017 @05:23PM (#15605602)
Well, it actually can run way more than once per pixel; it runs once per texel per thing that is rendered, where a texel is a 'fragment' of the displayed model which is the size of a pixel on the screen.

So if you have a bunch of things occluding each other, they can all get rendered on top of each other even if only the closest is actually displayed.

Sometimes people try to avoid that by not drawing stuff that is occluded, or drawing in order of depth, or discarding fragments if the depth buffer has already drawn over a location with a nearer texel, or that sort of thing. But it's always a PITA to calculate/sort that sort of thing in realtime.

Re:The Book of Shaders by reificator on Wednesday November 01, 2017 @05:29PM (#15605631)
Look, teaching is the art of lying about the monster under the bed until the other person is ready to defeat it.

Once per pixel is fine when you're teaching the hello world of shaders.

Re:The Book of Shaders by leggomylibro on Wednesday November 01, 2017 @08:40PM (#15606868)
Good point, sorry, that was pedantic.

But I've actually kind of been thinking about that, too. Think about how much 'magic code' most 'hello world' tutorials have that you're told to just ignore. That can also be off-putting when there's too much of it.

I wonder if there's a happy medium for introducing the basic concepts, like starting with microcontroller assembly instead of 'std::cout << "hello, world";'.

Then you won't have to explain things like '#include' because your students will already know that it just means 'pretend I copy/pasted file X here' from when they learned how to make an LED blink.

Anyways, I guess this particular resource does look like it struck a pretty happy middle ground for beginners. I just hope they don't get discouraged trying to branch out with self-teaching; there are a lot of byzantine 'gotcha's with graphics APIs and parallel stuff.

Re:The Book of Shaders by pfranz on Thursday November 02, 2017 @01:15AM (#15608013)
I was thinking about this the other day, too. Clash Royale recently added this Quests thing. Since I've been playing for awhile I know that it's separate from the main game and basically a bonus. If I was first starting to play it would be yet another thing to learn and it would be hard to know how it fits in with the rest of the game's objectives. I think of those crazy 10-way slot machines in Vegas. I have no idea whats going on (either by design or I'm not their mark...I mean target).

I think the big thing with introducing new things is keep it simple enough that they can riff on it. If you introduce too many things and something breaks, it's hard to get back to "good" and eventually you give up.

Python is a simple language, but I see a lot of online classes giving full-on VMs because the yak shaving involved in getting set up with a consistent environment wastes the first week or two of class.

Re:The Book of Shaders by bigmanwalter on Wednesday November 01, 2017 @07:48PM (#15606583)
Great metaphor. I might borrow that line sometime :)
Re:The Book of Shaders by sp332 on Thursday November 02, 2017 @12:48AM (#15607916)
Thanks, I didn't know that. I've written exactly one shader in my life and it was a transliteration from python. https://www.shadertoy.com/view/MdSXWc (And yeah we have integer modulus now lol)
Re:The Book of Shaders by 1wheel on Wednesday November 01, 2017 @02:06PM (#15603867)
Re:The Book of Shaders by Waterluvian on Wednesday November 01, 2017 @02:41PM (#15604242)
Yeah, that's fair. I suppose I'm just looking for a very up-front half-sentence about what we're talking about. Computer graphics shaders. Maybe this link isn't meant to go to anyone who isn't already aware of what they're clicking on.