Minimal D3D11 reference implementation: An uncluttered Direct3D 11 setup & basic rendering primer / API familiarizer. Complete, runnable Windows application contained in a single function and laid out in a linear, step-by-step fashion that should be easy to follow from the code alone. ~215 LOC. No modern C++ / OOP / obscuring cruft. View on YouTube
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace UnityEngine.Rendering.Universal | |
{ | |
public enum BufferType | |
{ | |
CameraColor, | |
Custom | |
} | |
public class DrawFullScreenFeature : ScriptableRendererFeature | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The following code is licensed under the MIT license: https://gist.github.com/TheRealMJP/bc503b0b87b643d3505d41eab8b332ae | |
// Samples a texture with Catmull-Rom filtering, using 9 texture fetches instead of 16. | |
// See http://vec3.ca/bicubic-filtering-in-fewer-taps/ for more details | |
float4 SampleTextureCatmullRom(in Texture2D<float4> tex, in SamplerState linearSampler, in float2 uv, in float2 texSize) | |
{ | |
// We're going to sample a a 4x4 grid of texels surrounding the target UV coordinate. We'll do this by rounding | |
// down the sample location to get the exact center of our "starting" texel. The starting texel will be at | |
// location [1, 1] in the grid, where [0, 0] is the top left corner. | |
float2 samplePos = uv * texSize; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/**** Minimal OpenVR example : outputs textures to the headset, a different color in each eye. No head tracking or input anywhere. Bare minimum. ****/ | |
/// header only extension loader and object oriented bindings -- ref : https://github.com/VirtuosoChris/glhpp | |
#define GL_ALT_GL_API 1 | |
#define GL_ALT_GLES_API 2 | |
#include <glalt/gl4.5.h> // opengl api | |
#include <glalt/glext.h> | |
#include <opengl.hpp> // object oriented bindings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The documentation for Gerrit when it comes to formatting comments is quite lacking. Here is short list created by trial and error and looking at the source code in: | |
./gerrit-gwtexpui/src/main/java/com/google/gwtexpui/safehtml/client/SafeHtml.java | |
Lists: | |
* List item 1 | |
* List item 2 | |
- List item 1 | |
- List item 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include "bgfx/bgfx.h" | |
#include "bgfx/platform.h" | |
#include "bx/math.h" | |
#include "GLFW/glfw3.h" | |
#define GLFW_EXPOSE_NATIVE_WIN32 | |
#include "GLFW/glfw3native.h" | |
#define WNDW_WIDTH 1600 | |
#define WNDW_HEIGHT 900 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using UnityEditor; | |
using UnityEngine; | |
using Object = UnityEngine.Object; | |
public class MaterialGradientDrawer : MaterialPropertyDrawer { | |
private int resolution; |
Water/Ocean:
- https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.161.9102&rep=rep1&type=pdf (y.2000)
- https://fileadmin.cs.lth.se/graphics/theses/projects/projgrid/projgrid-hq.pdf (pre-tessellation water rendering)
- https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.162.2833&rep=rep1&type=pdf (interactive water (using above method to render))
- http://www.cs.nthu.edu.tw/~chunfa/ICME2006.pdf
- http://graphics.cs.aueb.gr/graphics/docs/papers/GraphiCon09_PapadopoulosPapaioannou.pdf (water with caustics)
- https://artis.inrialpes.fr/Publications/2006/BD06a/water06.pdf
Tessellation:
- http://heim.ifi.uio.no/~erikd/pdf/silhouetteGPUdraft.pdf (silhouette refinement)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// NOTE: ScriptableRenderPass template created for Unity 2020.1 and URP 8 | |
// SOURCES: some used references to investigate what kind of different setups people use, lots of variety out there! | |
// https://gist.github.com/Refsa/54da34a9e2fc8e45472286572216ad17 | |
// https://gist.github.com/wonkee-kim/1792cd4fced96f98ae4a09ec500a3177 | |
// https://zhuanlan.zhihu.com/p/232450616 (in chinese, but provides some code for custom render pass) | |
// https://samdriver.xyz/articles/scriptableRender.htm (2019.3) | |
// https://gist.github.com/Elringus/69f0da9c71306f1ea0f575cc7568b31a (LWRP) | |
// https://github.com/Unity-Technologies/UniversalRenderingExamples/tree/release/2020.1 (2020.1 branch for SRP 8.2.0) |
NewerOlder