That's a very cool intro to a variety of shader techniques, especially post-processing effects. What's even more wild, is that modern engines include all of this stuff out of the box, you just have to tick a few check boxes to enable them in your game. :) For example, check out these postprocessing filters built into Unity and Unreal - a ton of person-hours went into these: https://docs.unity3d.com/Manual/PostProcess…
I agree with you, however in almost all commercial games that I worked on, we do write our own shaders. For simple shaders, artists use directly a graphical tool included in unity for shaders authoring without writing any code, for complex ones we write our own code.
3D Game Shaders for Beginners
31–40 of 46 posts
Re: 3D Game Shaders for Beginners
#32Re: 3D Game Shaders for Beginners
#33That's a very cool intro to a variety of shader techniques, especially post-processing effects. What's even more wild, is that modern engines include all of this stuff out of the box, you just have to tick a few check boxes to enable them in your game. :) For example, check out these postprocessing filters built into Unity and Unreal - a ton of person-hours went into these: https://docs.unity3d.com/Manual/PostProcess…
I agree with you, however in almost all commercial games that I worked on, we do write our own shaders. For simple shaders, artists use directly a graphical tool included in unity for shaders authoring without writing any code, for complex ones we write our own code.
But post fx like bloom or vignette? I'm okay using a stock shader for that, it's not worth spending the time on building one from scratch. :)
Re: 3D Game Shaders for Beginners
#34Am I just out of touch with what the kids today are doing, or is this formatting really as bonkers as it seems? int main ( int argc , char *argv[] ) { // ... LColor backgroundColor = LColor ( generateLightColorPart(207, 1) , generateLightColorPart(154, 1) , generateLightColorPart(108, 1) , 1 ); // ... } I can (sort of) see that this makes it easy to comment out parameters - except for the first one...
FWIW, everything seen here has options in Clang Format: https://clang.llvm.org/docs/ClangFormatStyleOptions.html
Personally, I like what this looks like. Leading commas are nice in situations where the first argument is fixed, but the remaining arguments move a lot while I’m tweaking & refactoring. I also like leading operators in long multi line math expressions, it’s easier to see at a glance how everything is combined when the operators are in front. I also like seeing arguments aligned, it’s easier to spot mistakes, easier to move things around, easier to use column selection, etc.
I rarely actually use the formatting I like because at work my team uses clang format so we’re standardized. Despite whatever formatting opinions I like, I love not arguing about formatting and having the formatter dictate and handle it for everyone.
Re: 3D Game Shaders for Beginners
#35This is really nice! The same techniques can be used in WebGL 2.0 which is at ES 3.1 on canary versions of WebKit. I had a hell of a time using the experimental compute shader API to implement a cellular automata framework [1] The big issue with using WebGL at the current moment, to do large scale sims, is that fragment shaders dont have an entire workload barrier capability - so you cant do interdependent work. Comp…
(I didn't know it was on the horizon until I saw your link). I wonder if getting to ES 3.2 is on the horizon as well? That would bring geometry and tessellation shader support.
Re: 3D Game Shaders for Beginners
#36This is really nice! The same techniques can be used in WebGL 2.0 which is at ES 3.1 on canary versions of WebKit. I had a hell of a time using the experimental compute shader API to implement a cellular automata framework [1] The big issue with using WebGL at the current moment, to do large scale sims, is that fragment shaders dont have an entire workload barrier capability - so you cant do interdependent work. Comp…
I have been wondering why WebGL isn't getting updated to ES 3.1 (and 3.2). Good to see at least 3.1 parity is coming: https://www.khronos.org/registry/webgl/specs/latest/2.0-comp... (I didn't know it was on the horizon until I saw your link). I wonder if getting to ES 3.2 is on the horizon as well? That would bring geometry and tessellation shader support.
> Using geometry shading will generally lead to worse performance, high memory bandwidth, and increased system power consumption. Assert if geometry shaders are used
Geometry shaders are not what you want. They should not have been included in GL ES, and I will fight their inclusion into WebGL 2.1.
Tessellation shaders are better, but still kinda ultimately useless.
Re: 3D Game Shaders for Beginners
#37Am I just out of touch with what the kids today are doing, or is this formatting really as bonkers as it seems? int main ( int argc , char *argv[] ) { // ... LColor backgroundColor = LColor ( generateLightColorPart(207, 1) , generateLightColorPart(154, 1) , generateLightColorPart(108, 1) , 1 ); // ... } I can (sort of) see that this makes it easy to comment out parameters - except for the first one...
Re: 3D Game Shaders for Beginners
#38Earlier quoted context omitted.
Especially if it's a 'smaller' game with mechanics that are unique. I just wonder if there are any good resources for the basics that a game engine needs.
The advantage of writing your own "game engine" is that it would only have the exact set of features you need for your game, and it would make the things you need to achieve as fast and as easy as possible. This means traditional advice for "the basics of a good game engine" doesn't really apply, because if you're just making a bog standard game engine you're wasting your time and making a crappier version of Unity o…
- "How do I render things?"
- "How do I integrate sound?"
- "How should I handle events?"
Re: 3D Game Shaders for Beginners
#39Earlier quoted context omitted.
that's great but there's lots of reasons you may want to roll your own engine
Especially if it's a 'smaller' game with mechanics that are unique. I just wonder if there are any good resources for the basics that a game engine needs.
For a deep dive into all game engine topics I would recommend the Handmade Hero dev streams: https://handmadehero.org
(Note that Handmade is not a useful model for an actual game production, it's more like a platform for investigating cutting-edge engine topics, so you can pick and choose parts to get what you need. It's been going for years and remains mostly a tech demo.)
Re: 3D Game Shaders for Beginners
#40Earlier quoted context omitted.
Especially if it's a 'smaller' game with mechanics that are unique. I just wonder if there are any good resources for the basics that a game engine needs.
THREE.js[0] is high enough level that it solves some basic problems (hierarchies of objects, basic materials, basic lighting, rendering pipeline) and low enough level that you still have high granularity control (you can roll your own shaders, lighting, render order, etc). I don't know if anything like THREE exists for OpenGL, though. The upshot of THREE is its super easy to develop with (alls you need is a browser).…
(I am a security analyst, not an engineer, but I'm transitioning to engineering roles now, so this might change in future, who knows :) )