Giter Site home page Giter Site logo

linecode / duengine Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ruofeidu/duengine

0.0 2.0 0.0 209.72 MB

An efficient interactive C++ renderer for ShaderToy-alike demos with 2D/CubeMap/Video/Camera/LightField textures. (Partially used in my I3D 2018 papers)

Home Page: http://duruofei.com

C++ 97.61% C 1.61% Python 0.79%

duengine's Introduction

DuEngine

DuEngine is an efficient and interactive C++ graphics engine for rendering, managing, recording image and video screenshots of ShaderToy-like demos with custom 2D/3D/Video textures.

LightFieldSingle

Compilation

Dependencies: OpenGL 4.5+, Glew, OpenCV 3.0+, GLM, Freeglut, and Visual Studio 2015+.

  1. To compile the project, simply run OpenSolution.cmd, or locate the solution file at DuEngine/DuEngine.sln
  2. To test the project, run RunTest.cmd, or UnitTests/debug.cmd, then you will see the renderer with all sorts of input channels.

If the compilation fails, please fix the following five environment variables:

  • OPENCV_INC: Directory to OpenCV include folder.
  • GLEW_INC: Directory to Glew, Freeglut, and GLM headers.
  • OPENCV_LIB: Directory to OpenCV libraries.
  • GLEW_LIB: Directory to Glew and Freeglut libraries.
  • PATH: Add the executable DLLs of OpenCV and GLUT into the PATH variable.

Create New Demos

Dependency: Python

To create a new ShaderToy demo, just click _create.cmd in any category folder like "Ray Tracing". In the console, please input your desired shader name, like "Test". The Python script will automatically generate Test.glsl, Test.ini, and Test.cmd files. Note that the GLSL file is the main Shadertoy alike GLSL code, the INI file is the config file which defines the input channels, and the CMD file is a shortcut for you to run the demo.

The detailed input format for _create.cmd is:

_create [FILE_NAME] [NUM_CHANNELS, 1 by default] [NUM_BUFFERS, 0 by default] [LINK_TO_SHADERTOY_FOR_REFERENCE]

Features

Config file

This renderer provides an easy-to-use interface to link any GLSL demos with built-in, and custom 2D, video, 3D, and cubemap textures. It supports most of the preset textures from the ShaderToy, which are located in DuEngine/presets.

To run the engine with a config file, simply run

DuEngine config.ini

The config file reads like as follows:

# This is a comment, $Name corresponds to the file name of the INI file.
shader_frag         =   $Name.glsl

# Specify the number of channels for the main framebuffer. 
channels_count      =   5

# Specify the number of framebuffers for multi-pass rendering
buffers_count       =   4

# Here are some examples of the channel type.
# We pre-define most of the ShaderToy presets. Visit *DuEngine/Texture.cpp* for a glance:
iChannel0_type      =   noise
# iChannel0_type    =   key, font, stpeter, sjtu...

# For a custom texture file, you need to tell the type and filename with extension.
iChannel1_type      =   rgb
iChannel1_tex       =   whatever.png

# The filters and wraps are loaded by default, but you can also change them.
iChannel1_filter        =  mipmap
iChannel1_wrap          =   repeat

# For videos, you can add fps, startFrame, and endFrame.
iChannel2_type          =   video
iChannel2_tex           =   whatever.mp4
iChannel2_fps           =   25
iChannel2_startFrame    =   1
iChannel2_endFrame      =   100

# To read from a frame buffer, use A-Z.
iChannel3_type      =   A

# To read from a video sequence, use %d as the wildcard
iChannel4_type      =   videoseq
iChannel4_tex       =   myfolder/file%d.png

# Each frame buffer can have an arbitrary number of channels.
A_channels_count    =   1
A_iChannel0_type    =   london
B_channels_count    =   1
B_iChannel0_type    =   A
C_channels_count    =   1
C_iChannel0_type    =   B
D_channels_count    =   1
D_iChannel0_type    =   C

# You can ignore the following default parameters starting from this line:
window_width        =   1920
window_height       =   1080

# If your textures are located outside the presets folder, type something like
resources_path      =   ../resources/

Multipass

Full-featured multipass rendering, e.g., see ShaderOfWeek/Goo.cmd for an example.

Screenshots and Recording

Press F2 to take a screen shot. In the configuration file, please add the following lines to record a video / sequences of images:

recording       =   true
record_start    =   1
record_end      =   500
# Use true for generating a single video file; false for generating sequences of images
record_video    =   true

The video will be stored in record by default.

Functional Keys

F1      =   Reset the time and textures;
F2      =   Take screenshot;
F5      =   Recompile the shader;
F6      =   Pause / Play all videos;
F9      =   (Debug) Print iFrame;
F10     =   (Debug) Print iMouse;
F11     =   Toggle the fullscreen mode;

In the end, here stores some of my GLSL code written in Shadertoy.com My ShaderToy Public Profile

Demos and Blog Posts

Interactive Poisson Blending

Unified Gnomonic and Stereographic Projections

Dotted Drawing Sketch

Instgram Brannan Filter

BirthdayCakeNoOcclude

Code Golf: Halftone Image

Artisitc404

LightFieldSingle

  • Light Field Rendering VolumeRendering
  • Volume Rendering

Masterpieces from ShaderToy

  • Please refer to the GLSL code for author names.
  • Most of the shaders is under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License.
  • A few of the shaders are under MIT License. Alps LadyBug Venice WindWakerOcean RayTracing Bridge Bidirectional Path Tracing

Author

Ruofei Du

License

Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License.

duengine's People

Contributors

ruofeidu avatar stareadrf avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.