Skip to content

A platform to try compute shader filters for image post-processing methods

License

Notifications You must be signed in to change notification settings

teamclouday/ImageProcess

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ImageProcess

A platform to try compute shader filters for image post-processing methods

Now supporting multiple compute shader image filters as a pipeline
For example:

[0] edge detection filter (compute)
[1] sharpen filter (compute)
[Final] output (vertex-fragment)

Orders can be modified


Build

git submodule update --init --recursive
mkdir build && cd build
cmake ..
make -j4

Or (if there's no make)

cmake --build . --config Release

Requirements

  • C++ compiler supporting cpp11
  • GPU supporting OpenGL 4.5

Usage

  • R to reload shader file
  • F12 to toggle UI display

Filter Format

The following is an example of a input -> output filter with no processing

#version 450 core

layout (local_size_x=32, local_size_y=32, local_size_z=1) in;

layout (rgba32f, binding=0) readonly  uniform image2D imageIn;
layout (rgba32f, binding=1) writeonly uniform image2D imageOut;

// support uniform (int, float) controls
// support initial values
// control via ImGui
uniform int control1;
uniform float control2;
uniform int control3 = 12;
uniform float control4 = 5.2;

void main()
{
    ivec2 baseUV = ivec2(gl_GlobalInvocationID.xy);
    baseUV = clamp(baseUV, ivec2(0,0), imageSize(imageIn));
    vec3 imgColor = imageLoad(imageIn, baseUV).rgb;
    imageStore(imageOut, baseUV, vec4(imgColor, 1.0));
}

Demo

demo

About

A platform to try compute shader filters for image post-processing methods

Topics

Resources

License

Stars

Watchers

Forks