More examples
mosra opened this issue · 10 comments
A running list of examples and various sources that could be fun to implement, fun to play with and attracting new users. Help welcome -- pick somethings that's not done yet, ask around and contribute. Ideal together with submitting a guest post about the example.
- Object picking example -- the current framebuffer example is prety useless as it does not cover any real-world case, so I'm going to replace it with this, as it is the cornerstone of many 3D editors, CAD applications etc. The point is to employ framebuffer and custom shader with multiple data outputs. Next to color the shader would output object ID for each pixel, which will be then read back and used to select object under mouse cursor. Will probably use just some generic scene (overlapping basic primitives) to make stuff simple.
- SDSM/PSSM shadow mapping example -- based on this paper, displaying some nice scene with interactive camera, debug draw will be very nice too. I will hopefully be able to implement the compute shader thing, otherwise it would be just PSSM. Other approaches:
- PBR example -- based on a lot of papers, tutorials and websites. Either create some nice model in Blender and then apply cool shaders to things, or use some nice glTF scene. Requires PBR material support in Trade and the glTF importer. Links:
- https://interplayoflight.wordpress.com/2013/12/30/readings-on-physically-based-rendering/
- http://www.codinglabs.net/article_physically_based_rendering.aspx
- http://codeflow.org/entries/2011/apr/18/advanced-webgl-part-3-irradiance-environment-map/
- https://learnopengl.com/PBR/Theory and everything after
- https://github.com/Nadrin/PBR
- interactive BRDF explorer like from https://twitter.com/Atrix256/status/1151159522943279114
- very detailed writeup at https://bruop.github.io/ibl/
- Global illumination example -- real-Time Diffuse Global Illumination Using Radiance Hints:
- http://graphics.cs.aueb.gr/graphics/docs/papers/RadianceHintsPreprint.pdf
- https://www.wpi.edu/Pubs/ETD/Available/etd-121815-134638/unrestricted/csun.pdf
- https://users.cg.tuwien.ac.at/zsolnai/wp/wp-content/uploads/2016/02/AdamPapp_cgsem.pdf
- https://users.cg.tuwien.ac.at/zsolnai/wp/wp-content/uploads/2015/02/kevin_streicher_star.pdf
- Ambient Occlusion example -- mosra/magnum-examples/pull/91
- Screen-space beveling as shown in Unigine
- Anti-aliasing technique gallery -- showing off how MSAA, SMAA, TXAA, FXAA, TAA etc. works and compare their quality. Links:
- Animation examples as mentioned in #101
- Deferred rendering example -- g-buffer, many lights, handling anti-aliasing etc. Links:
- Normal mapping / parallax mapping demo -- find a free version of a cobblestone texture, for that
- Also paralax-mapped shadows: http://enbdev.com/doc_normalmappingshadows.htm
- Terrain rendering example -- explaining some advanced functionality like LOD switching, on-the-fly mesh updates, transform feedback or something like that. Links:
- http://udn.epicgames.com/Three/TerrainAdvancedTextures.html
- https://www.assetstore.unity3d.com/en/#!/content/5664
- Turning a heightmap into a subdivided mesh + parallax mapping for efficient rendering
- LOD, data streaming -- make use of the Zürich open data for buildings, for example: https://twitter.com/ChrisGis3D/status/1061953131645452290
- another inspiration: Outtera
- Ray tracing -- making use of compute shaders or the new RTX APIs. Links:
- 2D rendering -- showing basics of 2D game development with Magnum (since there's nothing in this direction at the moment).
- putting textured quads on screen
- animating their position, texture, mouse interaction
- draw order
- Primitives but using the scene graph (like the existing Python example) -- mosra/magnum-examples#82
- Text but 3D (https://github.com/NSkelsey/magnum-examples/blob/master/src/text/TextExample.cpp)
- Simple 2D game (Pong) -- texture loading, input handling, movement calculation, simple animations
- Simple 3D game -- integrate
SokobanPush the Box from the old repo - HDR / Bloom -- rendering an overblown / contrasty model
- Bokeh / DOF -- http://blog.tuxedolabs.com/2018/05/04/bokeh-depth-of-field-in-single-pass.html
- Sky rendering -- https://github.com/andrewwillmott/sun-sky, https://cgg.mff.cuni.cz/projects/SkylightModelling/, http://www.zombieprototypes.com/?p=210
- Metaballs
- Curve rendering -- rendering subdivided Beziers, NURBS, ...
- or integrate https://github.com/sariug/TesselationShaderExample
- Stochastic Shadows -- next step after the Area Lights example, https://eheitzresearch.wordpress.com/705-2/
- Floating-point drift visualization -- additively rotating a cube using matrix/quat, showing the rotation difference after, compared to a ground truth with just adding an angle and calculating the result after. Ideal in combination with the Animation library.
- Interpolation method visualization -- comparing lerp, slerp, sclerp, dlb... Interactive, animation a plus. We also have the Easing library now, could get used there too.
- Hello World using bgfx -- because there's a minimal example, and a tutorial now
- Particle system -- see #50 for original discussion
- Point cloud rendering -- https://github.com/m-schuetz/compute_rasterizer
- Shader-based supersampling -- https://medium.com/@bgolus/sharper-mipmapping-using-shader-based-supersampling-ed7aadb47bec
Porting cool things done with other libs
Mainly to show how the same thing can be done with less (or more?!) code, not with an intention to steal:
- Here Be Dragons -- implement https://github.com/kosua20/herebedragons using Magnum
- Minigolf -- implement https://github.com/mgerdes/minigolf using Magnum
- Game Shaders For Beginners -- https://github.com/lettier/3d-game-shaders-for-beginners
Object picking example is done in mosra/magnum-examples@f45a301. Not yet ported to ES3/WebGL, will do that later.
Added a possible ray-tracing example using compute shaders to the list (http://blog.lwjgl.org/ray-tracing-with-opengl-compute-shaders-part-i/)
Shadow mapping example added via mosra/magnum-examples#24.
Personally, I'd like to see more 2D-focused examples, as many of the current examples are 3D-focused.
Things like displaying a static 2D background, or using multiple images to create a single assembled sprite, would help me greatly for a project I'm working on.
@williamjcm Added to the list, thank you! I might have some people contributing with new example code in the near future, so maybe someone will pick this up before I get to it.
Extended the list with two easy example ideas -- floating point drift visualization and comparison of various interpolation methods. Ideally combining these with the new Animation framework.
I would like to add something to the list (or extend "2D rendering" section): pong. There is a lot of advanced examples but I would like to see how to implement simple "game loop": load some textures (ball, paddle), handle input, calculate movement with frame time, draw everything on screen.
+1 to the 2D resources
After some discussion in the gitter channel related to the TextExample in 2D and some of my own struggles with graphics concepts it would be helpful to have a largish example with a 3D scene inside of which there are 3D objects, bill-boarded objects and labels. These "figures" should all be projected into screen space using a single camera to demonstrate various common projections that are performed in applications to implement them.
For starters, a simple 3D text example that could be expanded lives in my fork of this repo.
Edit -- maybe going further, having multiple cameras and the ability to switch between them would similarly demonstrate the extensibility of the Magnum.