Hacker News new | past | comments | ask | show | jobs | submit login
The Book of Shaders (thebookofshaders.com)
238 points by Tomte on June 12, 2020 | hide | past | favorite | 26 comments



I'm confused about why this site keeps making the rounds, because it's been in the exact same unfinished state for something like five years now. Patricio keeps promoting the unfinished work without working on it. The intro content is good but it's been stuck in intro mode for years. It's just a strange self promotional situation.


It's a real pity, because the current chapters are incredible. Patricio's gift of communication along with the artistic and creative aspects of the book really makes the learning process so much more inspiring. I hope he finishes the other chapters some day.


When I saw this here again I so wished it was because it now had more content.

It’s such a great intro to shaders. Please finish it!!!!


Indeed, it is a very valuable resource for beginners to jump into shaders, but for those that already know the basics there are several good books focusing on shading languages, and NVidia has a couple of free ones available on their site.

Even the outdated book about Cg language has good content regarding shading in general.

But if Patricio ever puts it in an actual book, I would gladly buy it.


I'm ok with him promoting his work, not sure why that's bad for you. It's a great resource for learning.


I remember this from a year or two ago. I found it to be a useful entrypoint into a topic that I thought I'd never understand at all.

Understanding the basics of shaders has been helpful for some audio-visual tchotchkes that I have enjoyed building. Hope to learn more, over time. And I'd really love to see more of the chapters that are planned, but unavailable.

Is there a changelog that will tell us what parts of the book were updated and when they were updated?

edit – it's all on GitHub, which is also helpful given how slow the Book of Shaders website is right now: https://github.com/patriciogonzalezvivo/thebookofshaders


I think the author's must be rather busy. I haven't seen anything new since Fractal Brownian Motion from years ago.

I hope they are able to complete the rest of the chapters in the future.

I put this site on the same level as Real Time Rendering, my favourite rendering reference book.


Whatever you do don’t try to zoom in on the text with your phone. I did that and the site had a virtual seizure - so bad I had to refresh the page and resign myself to tiny text.


Can someone explain how they managed to do this? I've never seen anything like it!

Perhaps all the text is rendered via JS and re-rendering in an infinite loop where the CSS switches the padding of the div surrounding the text back and forth by ~5px at each point in the loop?


It could definitely be in an infinite loop if it's running a webgl context.

Many (including myself) have tied into window.requestAnimationFrame(...) recursively forever.

This lets the page breathe, but always call back into your main game loop to update the webgl render context/canvas.


I can’t even scroll the page. Go to the bottom and back up, then it won’t stop shaking.


Guess you're on an iPhone? Seems to work fine in Brave on Android.


I’m on an iPhone and it worked fine for me as well.


The Book of Shaders is in the dark. Too much parallel processing ?


The animated moon at the top of the main page is a WebGL canvas. If your system is wrestling how to render/fallback from it, that could cause the page to hang for many seconds.

Then the JS might be running wild in the background while that is resolved. Make sure you have WebGL enabled and are using a new version of Firefox/Chrome.

Hope that helps!


It eventually loaded for me, but it might take a minute. I'd suggest leaving it open in a tab.


In the same sort of vein, I've been catching up on this game engine series. It's been great so far.

https://www.youtube.com/playlist?list=PLlrATfBNZ98dC-V-N3m0G...


Last time I played with this, I read through the whole thing without at any point realizing that the code was live and could be experimented with. Don't make the same mistake I did!

Also I don't know much about WebGL and am quite curious how this works. Are they compiling these shaders locally in the browser?


> Are they compiling these shaders locally in the browser?

Yes, shader compilation has always been a part of the OpenGL API itself. A conforming implementation must include a compiler.


Patricio pleeeease finish this book!


this is one of those ideas where you have the name of the idea first, then you have the concept.


I haven't read all the posted chapters yet but the content is seems to be easy to grasp.

Most of the content out there on shaders is either too mathematical or too specific


Is this a work in progress? The sections on Image processing / Simulation / 3D Graphics are all empty or have no links.


Shaders are cool - I think? I wanted to use them for generative animations , but (maybe I have it wrong) I could not see a way to store state with each pixel. I wanted the color of the pixels to be a view onto some underlying state at that pixel location - and update that state in a shader manner, so parallel and multi-threaded, with each state step depending only on the state of its neighbors - a generalized pixel if you will.


Sounds like you need a multi-pass shader. As an example, you can store state in one pass, apply operations in another pass, and render in the last pass.

Example: https://shadergif.com/gifs/324


You can't store state in pixels, just use a texture. The value of a pixel in the texture is your 'pixel state'.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: