6 ms·
The Book of Shaders
- nos4A2 12y agoThis is awesome! As someone who just spent a ton of time navigating a patchwork of information about GLSL, this looks like an oasis :) (I can't seem to access all the chapters though, I guess its a work in progress).
- BinaryIdiot 12y agoThis looks great. Is there a way to easily take it offline so I can read it on my Kindle? Also... > If you are reading this book in a browser the previous block of code is interactive. That means you can click and change any part of the code you want to explore. Now that's pretty damn cool!
- nos4A2 12y agoI found the github repo, you can compile the LaTeX to any format https://github.com/patriciogonzalezvivo/thebookofshaders.git https://github.com/patriciogonzalezvivo/thebookofshaders.git http://patriciogonzalezvivo.com/2015/thebookofshaders/92/ http://patriciogonzalezvivo.com/2015/thebookofshaders/92/
- BinaryIdiot 12y agoWell that's handy, thanks!
- cfrs 12y agoFor those who don't want to install texlive, pandoc and glslViewer, here is PDF: https://www.dropbox.com/s/uc6g1pkrswjrvhj/TheBookofShaders-PatricioGonzalezVivo.pdf?dl=0 https://www.dropbox.com/s/uc6g1pkrswjrvhj/TheBookofShaders-P...
- letmeinletmein 12y agoCan anyone see this? I think HN is censoring Tor commenters.. :(
- monsterix 12y agoKindle or on iPad Safari? I don't know about people in your vicinity but kids in my area are off Kindle completely. This is anecdotal evidence obviously. The experience of reading books with lifeless text/images sounds like a retrogressive proposition to me. I think e-books will have to move up the tool chain, enter browser with alternative reading experiences.
- lemming 12y agoI don't know about the kids near you but I gave my iPad away, and you can claw my Kindle from my cold, dead hands.
- sp332 12y agoNote to user letmeinletmein: https://news.ycombinator.com/item?id=8872776 https://news.ycombinator.com/item?id=8872776
- fWnApHU2PY6CPA 12y agoWhat an incredibly beautiful piece of design. I can't remember the last time I was so inspired by careful use of typesetting and white space.
- telekid 12y agoWhat an incredibly beautiful piece of design. I can't remember the last time I was so inspired by careful use of typesetting and white space.
- mykolasmith 12y agoThanks for this! Edit: great illustrations, too!
- GuiA 12y agoToby Schachman made a similar attempt at writing an interactive book about shader programming, but sadly it hasn't been updated in a long time. http://pixelshaders.com http://pixelshaders.com Hopefully this site won't meet the same fate!
- ash 12y agoI think it was because Toby Schachman couldn't think of good exercises on more advanced topics. I would guess this struggle influenced his later work - Shadershop: http://tobyschachman.com/Shadershop/ http://tobyschachman.com/Shadershop/ (Check it out, it's super cool.)
- Sophistifunk 12y agoThis really needs an email list for updates as more content is added. And maybe a Patreon account as well :D
- Aldo_MX 12y agoIn the meantime you can watch the github repo and get notified of updates.
- Sophistifunk 12y agogood idea!
- aikah 12y ago> This really needs an email list for updates as more content is added. And maybe a Patreon account as well :D or you know,support simple Atom syndication ...
- lobo_tuerto 12y agoThis would be great material for a GitBook: https://www.gitbook.com/ https://www.gitbook.com/
- adsche 12y agoWhy? What about the iteractive shaders?
- lobo_tuerto 12y agoThat could be used in-browser as it is right now. But going to a publishing platform could also earn his efforts some money for a work well done. Open a channel to receive donations (or sells). Supporting the book through economic means might motivate the author enough to see through its completion.
- endymi0n 12y agoFinally. 50 Shaders of Grey.
- adsche 12y agoWhat I read so far is great, but I noticed this gem about preprocessor directives: All the macro comands begin with a hashtag (#). Do we really call every hash character a hashtag now?! :)
- fit2rule 12y agoWelcome to the rolling wave of civilization. Did we really used to call the number sign a "hash character"?
- pmjordan 12y agoUK & Ireland: Yes, and still do, although it's apparently a corruption of "hatch" (as in cross-hatch). http://en.wikipedia.org/wiki/Number_sign#Usage_in_the_United_Kingdom_and_Ireland http://en.wikipedia.org/wiki/Number_sign#Usage_in_the_United...
- e12e 12y agoVaguely related: From The Devil's Dictionary (1881-1906) [devil]: HASH, x. There is no definition for this word -- nobody knows what hash is.
- pjc50 12y agoBetter than calling it the pound symbol. It was always a source of minor confusion, as people used it rarely and had all sorts of different names for it.
- smoyer 12y agoYou mean the octothorpe character? [1] That symbol seems to go by a lot of names! [1] https://en.wikipedia.org/wiki/Number_sign https://en.wikipedia.org/wiki/Number_sign
- gaius 12y agoIt's a "sharp", hence why #! is often called a "shebang". Tho' I call ! a "pling".
- anon4 12y agoA very small piece of advice which I don't see mentioned here: OpenGL works in linear RGB (which is very convenient), while your monitor displays sRGB (which gives you better colour resolution due to how eyes work). This means that outputting the result of OpenGL directly on your screen is wrong (a lot dimmer than it should be). Use this little fragment in all your shaders to convert the final output to sRGB: vec3 srgb(vec3 rgb) { vec3 mask = vec3(greaterThan(rgb, vec3(0.0031308))); return mix(rgb * 12.92, pow(rgb, vec3(1.0 / 2.4)) * 1.055 - 0.055, mask); } Edit: Here's a very good example of the difference https://imgur.com/a/g6qNI https://imgur.com/a/g6qNI Edit 2: And of course when you load textures you must tell OpenGL they're in sRGB colourspace (most probably they are, if you created them on a normal monitor), so it will do the reverse transformation when reading from the texture. All this trouble could have been avoided if monitors were 30bit linear RGB colourspace to begin with, but that's history now. C'est la vie.
- topkekz 12y agohttps://www.opengl.org/registry/specs/EXT/framebuffer_sRGB.txt https://www.opengl.org/registry/specs/EXT/framebuffer_sRGB.t... https://www.opengl.org/wiki/Framebuffer#Colorspace https://www.opengl.org/wiki/Framebuffer#Colorspace
- socialist_coder 12y agoSo you're saying that in my shaders, as long as I have GL_FRAMEBUFFER_SRGB enabled, this conversion takes place automatically? Am I understanding the docs right? I'm asking because I'm a mobile game developer using Unity3d, and we have a fair amount of custom shaders, and I've never heard about this sRGB vs RGB colorspace thing before so I want to investigate. There's not much on google for GL_FRAMEBUFFER_SRGB + Unity3d. Maybe it's handled automatically or it's not even possible with openGL ES 2.0.
- topkekz 12y agoThe implicit conversion only happens when the internal format of the destination buffer is GL_SRGB8 or GL_SRGB8_ALPHA8
- WhitneyLand 12y agoGreat work, it's apparent a lot of thought went into the presentation and teachings. I'm guessing there are lots of developers out there who don't realize that shaders are quite accessible for simple tasks even without much of a math or graphics background and/or that power is now available is most web browsers.
- kowdermeister 12y agoI can only encourage the author to continue. It's a really enjoyable way to learn things. I like how he challenges my in a tutorial. Although I haven't tried it, here is an NPM package for learning shaders: https://www.npmjs.com/package/shader-school https://www.npmjs.com/package/shader-school
- le_lenny_face 12y agoYeah, this kind of pathetic and creepy attempt to cash in on the 50 Shades of Grey success is precisely why the whole IT community is so repulsive to women in general.
- daeken 12y agoUm... what? How does this in any way relate to 50 Shades, except for the word 'shade' being contained in 'shaders'? There doesn't even appear to be a reference to it in any of the text. Put down the pitchforks.
- guncheck 12y agoThis is pretty cool. I'll read this. Thanks!