Giter Club home page Giter Club logo

glsl-pathtracer's Introduction

glsl-pathtracer

Yet another toy raytracer!

This project is a simple path-tracing renderer implemented (mostly) in a single GLSL fragment shader. It started as my venture through Ray Tracing in One Weekend with a GPU accelerated twist, then grew some features over a period of a few weeks.

By default, the program will render its progress on a still frame but animations are supported and rendering frames to image files as a means of offline rendering is also possible.

Scenes are mostly represented as Signed Distance Fields, using an s-expression-based scene description language that is used to generate the shader code that evaluates the SDF. For example, the following scene definition

(oUnion
  (oNeg
    (tTrans 0 4 7 
      (mLamb 0.2 0.2 0.5
        (pBox 10 8 15))))
  (tTrans -3 0 0 
    (tRot 0 1 0 0.78 
      (mLamb 0.7 0.3 0.3
        (pBox 2 4 2))))
  (tTrans 3 -2 0 
    (tRot 0 0 1 0.5 
      (tRot 0 1 0 0.78 
        (mLamb 0.3 0.7 0.3
          (pOctahedron 2)))))
  (tTrans 0 -2.5 5 
    (mDiel 1.5
      (pSphere 1.5)))
  (tTrans 6 -2 -1.5 
    (mLamb 0.8 0.8 0.2
      (pSphere 2)))
  (mEmit 1 1 1 100
    (tTrans 0 15 0 
      (pSphere 4))))

generates this scene

Example scene

The documentation for this scene definition language is literally the code that parses it.

Building this yourself

This is a toy, so very little support goes into environments different than my own. This repo is messy enough to contain VS2019 solution/project files, so maybe trying that is a good start. In a nutshell though, anything that can compile the 3 C++ files and link to GLEW and SFML should be good to go.

glsl-pathtracer's People

Contributors

anthonyvd avatar

Watchers

 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.