NOTE: this post was rewritten since this thread was originally started.
This is a 2d filter that does raymarching in screen space. Ray to Depth-Buffer intersections are found through a simple raymarch and refined with binary search.
Glossiness is achieved through the emission of multiple rays with importance sampled directions; Currently, the GGX NDF is used for this purpose. A home-brewed hashing function is the source source of the pseudo-random numbers used in sampling and jittering.
Schlick’s approximation is sampled once per ray to ensure proper weighting of rays.
The filter expects three properties to be added to the object containing the filter actuator:
- Float - roughness (roughness of the reflections)
- Float - reflectance (reflectance at normal incidence)
- Integer - samples (amount of rays used per pixel)
There are also some settings within the filter that should be modified to match your camera setup.
16 samples. 9 resolve samples. roughness 0.2.
REFLECTIONS ONLY - 16 samples. 9 resolve samples. roughness 0.1.
A word on performance:
It runs really poorly (16 samples at 2fps on my pc, 2 samples at around 20). use only one or two samples and some amount of resolve samples. The new RNG and resolve filter makes using such low sample counts actually feasible.
-Turn it into a surface shader, this should enable normal, roughness, and specular maps to be used.
Get the filter here : LINK
This filter uses the functions used for reconstruction of screen space made by martinsh for his deferred render filter, as well as a modification of one of the functions made by TheLumCoin.
If you want to use this on your project, please let me know and credit me if you do.
NOTE: resolve was done in a separate filter pass using this filter
-Implemented Cook-Torrance BRDF
-Implemented Schlick’s approximation to Smith’s shadowing factor
-Cleaned up implementation
-Corrected gamma correction
-Somewhat improved interface
-Implemented a better fallback method that suddenly stopped working and i don’t know why but nothing else broke so i am just leaving it in in its current broken state.
-Added simple jittering.
-Added GGX sampling (and a few others if you are willing to look through the code. )
-Added Blinn based glossy reflections and importance sampling.
-Improved all kinds of stuff.
-Added binary search to the ray-buffer intersection. To disable this just set startScale (line 24) to 1.0.
-Original “alpha” release.