All Projects → nama-gatsuo → ofxDeferredShading

nama-gatsuo / ofxDeferredShading

Licence: other
an openFrameworks addon for shading, lighting, lens simulation.

Programming Languages

C++
36643 projects - #6 most used programming language
GLSL
2045 projects

Projects that are alternatives of or similar to ofxDeferredShading

ofxCorkCsg
A constructive solid geometry (mesh boolean) addon for openFrameworks.
Stars: ✭ 43 (-44.87%)
Mutual labels:  openframeworks, openframeworks-addon
ofxCameraAnaglyph
Anaglyph Camera for Stereo 3D Rendering for OpenFrameworks
Stars: ✭ 25 (-67.95%)
Mutual labels:  openframeworks, openframeworks-addon
ofxOpenCvDnnObjectDetection
OpenCV based DNN Object Detection Library for Openframeworks
Stars: ✭ 34 (-56.41%)
Mutual labels:  openframeworks, openframeworks-addon
ofxOilPaint
An oil painting simulation addon for openFrameworks
Stars: ✭ 45 (-42.31%)
Mutual labels:  openframeworks, openframeworks-addon
ofxTouchPad
Multitouch support for touchpads.
Stars: ✭ 23 (-70.51%)
Mutual labels:  openframeworks, openframeworks-addon
ofxShadertoy
Addon for openFrameworks that sets up and loads Shadertoy (http://www.shadertoy.com) shaders
Stars: ✭ 77 (-1.28%)
Mutual labels:  glsl, openframeworks-addon
ofxPubSubOsc
bind OSC messages and values with only writing tiny codes on setup once.
Stars: ✭ 72 (-7.69%)
Mutual labels:  openframeworks, openframeworks-addon
mathematical-sculptures
Generate custom parametric surfaces ✒️💠
Stars: ✭ 26 (-66.67%)
Mutual labels:  glsl
kotlin-glsl
Write your GLSL shaders in Kotlin.
Stars: ✭ 30 (-61.54%)
Mutual labels:  glsl
goworld
Experimental OpenGL-based 3D Engine witten in Go
Stars: ✭ 23 (-70.51%)
Mutual labels:  glsl
sph vulkan
SPH simulation in Vulkan compute shader.
Stars: ✭ 29 (-62.82%)
Mutual labels:  glsl
limitless-engine
OpenGL C++ Graphics Engine
Stars: ✭ 95 (+21.79%)
Mutual labels:  glsl
haxe-glsl-parser
GLSL ES 1.0 parser in Haxe
Stars: ✭ 27 (-65.38%)
Mutual labels:  glsl
recoded
Re-coded by the School for Poetic Computation—crowdsourced recreations of early digital works using new tools
Stars: ✭ 57 (-26.92%)
Mutual labels:  openframeworks
Paint3D
A program allowing painting textures of different channels SIMULTANEOUSLY on a 3d model
Stars: ✭ 24 (-69.23%)
Mutual labels:  glsl
redcube
JS renderer based on GLTF to WebGPU or WebGL backends.
Stars: ✭ 86 (+10.26%)
Mutual labels:  glsl
Voxel
Sandbox survival game created with Light Engine (Development halted due to other projects)
Stars: ✭ 18 (-76.92%)
Mutual labels:  glsl
ShaderView
ShaderView is an Android View that makes it easy to use GLSL shaders for your app. It's the modern way to use shaders for Android instead of RenderScript.
Stars: ✭ 53 (-32.05%)
Mutual labels:  glsl
parametric surfaces
Parametric surfaces drawn using the Rust + WASM toolchain with WebGL, React, and TypeScript.
Stars: ✭ 43 (-44.87%)
Mutual labels:  glsl
music visualizer
Shader viewer / music visualizer for Windows and Linux
Stars: ✭ 137 (+75.64%)
Mutual labels:  glsl

ofxDeferredShading

Here is demo.

Concept

Modern OpenGL compatible

I was satisfied with ofxPostPrpcessing long time, which is fabulous and has so many beautiful vfx in it. I really appreciate the author and contributors. But there is little problem when I use my own shaders with it. It is not written in "modern" shader version so cannot coexist with the "programmble renderer". At this moment, however we have to decide to abandon legacy but helpful functions including ofLight, glBegin()-glEnd()...

Photo-realistic in Real-time

And the addon mentioned above has only few effects for photo-real purpose such like "casting shadow". So I decided to reproduce and regather PostProcesses focusing "photo-real" rendering and compatible in modern version.

Now it contains

  • Edge detection
  • Multiple point-lights with attenuation
  • Casting shadow with directional light
    • plus Volumetric light using shadow map
  • SSAO: Screen Space Ambient Occlusion
  • Depth of Field
    • plus Foreground blurring
    • plus Bokeh point rendering
  • Bloom (Kawase's)
  • Volumetric fog

Support

  • openFrameworks 0.10.0~ (using glm library)

Usage

  • specify modern version of OpenGL in main.cpp
int main( ){
    ofGLWindowSettings settings;
    settings.setGLVersion(4, 1); // now we use OpenGL 4.1
    settings.setSize(1024, 768);

    ofCreateWindow(settings);
    ofRunApp(new ofApp());
}
  • declare instances in ofApp.h
    • it's safer to use std::shared_ptr
// declare in ofApp.h
ofxDeferredProcessing deferred;
ofPtr<ofxDeferred::SsaoPass> ssao;
ofPtr<ofxDeferred::PointLightPass> points;
ofPtr<ofxDeferred::ShadowLightPass> shadow;
ofPtr<ofxDeferred::HdrBloomPass> bloom;
...
  • init and create Passes in ofApp::setup(), and get reference of Passes
deferred.init(ofGetWidth(), ofGetHeight());
ssao = deferred.createPass<ofxDeferred::SsaoPass>();
points = deferred.createPass<ofxDeferred::PointLightPass>();
shadow = deferred.createPass<ofxDeferred::ShadowLightPass>();    
bloom = deferred.createPass<ofxDeferred::HdrBloomPass>();
  • set parameters via reference
ssao->setOcculusionRadius(5.0);
ssao->setDarkness(1.0);
  • draw objects between begin() and end().

  • If you want to HDR color, just specify vertex color bright enough (can be more than 1.0) through ofFloatColor's parameters.

  • if you want to use cast shadow (ShadowLightPass), you need another draw call for shadow map.

    // for shadow map
    shadowLightPass->beginShadowMap();
        drawObjs(); // draw something
        lightPass->drawLights(); // draw light bulbs
    shadowLightPass->endShadowMap();
    
    // for rendering pass
    deferred.begin(cam);
        drawObjs(); // exactly the same call above
        lightPass->drawLights();
    deferred.end();
  • Also, you can use own shader for mesh rendering. In this case, you need to write pixel data into color buffer properly like below.

#version 400

uniform int shadowFlag;

in vec4 vPos;
in vec4 vNormal;
in vec4 vColor;
in float vDepth;

layout (location = 0) out vec4 outputColor0; // Color
layout (location = 1) out vec4 outputColor1; // Position
layout (location = 2) out vec4 outputColor2; // Normal and Depth

void main(){

    if (shadowFlag == 1) {
        outputColor0.r = vDepth;
        outputColor0.a = 1.;
    } else {
        outputColor0 = vColor;
        outputColor1 = vPos;
        outputColor2 = vec4(vNormal.xyz, vDepth);
    }

}

Reference

Render Pass

Effects

Author

Ayumu Nagamatsu

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].