This thread is about the development of the PBR viewport.
My first goal was reach somewhat the quality / feature of Marmoset 2 inside the viewport to easily preview game assets and work on shaders inside Blender node editor like you would with Unreal editor for instance.
But recently I oriented my development towards supporting Cycles shading in realtime viewport. This provides a more intuitive and flexible approache to the features. I also started the support of physical lights.
A lot of things are approximated. For instance, the world casts no shadows and Refraction is done only for front facing faces.
But you can edit your mesh
Downloads (Win64 - OSX64 - Linux64):
V0.4 - 06/06/2016
- Oren-nayar Diffuse (Env lighting)
- Velvet Shader (Env lighting + Point lights)
- Toon Shader (Env lighting + Point lights)
- Ashikhmin & Beckmann distributions for isotropic and anisotropic
- Closest Filtering for Texture node
- Material layer overide but only for material. So you can preview one material on every objects without assigning it to each object.
- Linearly Transformed Cosines to shade Area lights with the Glossy GGX (other distributions use the same LUT)
- Material AO to apply occlusion during the shading stage an not at the post process stage. Algorithm is slow but correct (matches cycles)
- Screen Space Reflections for Sharp Glossy shader. Algorithm is from Morgan McGuire blog and the step is always 1px so reflections can’t go far.
- Backface buffer to improve screen space effects.
- Bias parameter to control the accuracy of the Environment Sampling.
- Performance : Use a jitter texture + a sample texture to generate sampling random vectors instead of computing everything inside the shader. (this takes 2 texture slots though)
- Performance : Lights shadowing (and lamp nodetree) are evaluated only once per Material.
- Codebase Change : major thing I did is not using the common uniform interface for passing uniforms related to the sampling and PBR. I also splited the glsl files into more managable ones.
V0.3 - 20/03/2016
- Introduced a probe system that generates probe from the world environment or specific objects
- Spherical harmonics are computed on the gpu and lower resolution (much faster)
- Soft shadows of area lamps : shadow “FOV” controled by near clip plane
- Better Default preview shader for Glossy and Diffuse
- Support Sphere / Spot / Sun (partial) / Area (partial) lights
- Glossy Shader (only Sharp / GGX)
- Diffuse Shader (No roughness in Realistic mode)
- Translucent Shader (Approximated as backlighted Diffuse)
- Refraction Shader (only Sharp)
- Glass Shader (only Sharp)
- Velvet Shader (only Point Lights)
- World Environement Reflection (still not perfect with some caveats)
- Soft shadows of spot lights
- Support Lamp Nodes
- Normal Map Node (now works as expected)
- Color Management settings previewed in the viewport (still WIP)
- Other small things…
V0.1 - 21/06/2014
So what I’ve done so far:
- Rectified some GLSL node to output what they should output.
- IBL specular reflection
- Irradiance from spherical harmonics computed from the HDR (now weighted)
- Lambertian diffusion
- GGX specular distribution
- Dielectric and Metallic
- Newton ring reflection (just a simple little node graph)
- Cubemap support. (Cubemap should be in blender conventional orientation).
- Standard Lights support
- Multithreaded filtering of cubemap mip : You can prefilter the cubemap and have “better” light approximation.
- Fresnel effect intensity input.
- Mapping Node support
- Envmap intensity input.
- Separated outputs for better control.
- Glossiness / Specular Model.
- Energy conservation. (should be off most of the times)
- Choosing Sample Number.
- Horizon occlusion.
- Sampling Setting are stored in Images not in Nodes.
Basicaly everything could be done in node if there is a proper reflection vector and a LOD sample value in the textures node but it would be tedious to do “for” loops with nodes.
My modification of blender’s code are:
- New PBR node type: IBL input and compute Spherical Harmonics.
- GLSL re/coding of the folowing nodes: Texture Coordinate, Geometry, Normal Map, Checker Texture (I found someone who already did afterward)
- Fixed color correction inside the Image Texture Node (was not applied in GLSL).
- Unclamped rectfloat before passing hdr texture to OpenGL and use GL_RGBA16F to have the “whole” (actualy half) hdr range in GLSL
- Disable Canceling Mipmap in paint mode to actualy paint mask for the pbr shader (if not the reflection are not blured anymore).
- Added Cooktorr GGX specular shader for energy preservation and specular distribution. (Only works in GLSL)
- [New] Added cubemap support to blender’s viewport.
- [New] Added normalmap node support to blender’s viewport.