Coder Social home page Coder Social logo

jan-van-bergen / sphericalharmoniclighting Goto Github PK

View Code? Open in Web Editor NEW
65.0 4.0 12.0 64.25 MB

Global Illumination using Spherical Harmonics

C++ 42.93% GLSL 0.05% C 55.77% CMake 0.37% Objective-C 0.87%
global-illumination spherical-harmonics raytracing

sphericalharmoniclighting's Introduction

Spherical Harmonic Lighting

An experimental project to explore global illumination techniques that use Spherical Harmonics.

Features

  • Radiance is calulcated per vertex. The transfer function takes into account the surface normal for direct diffuse lighting. It also takes into account indirect shadowing. This is achieved by performing a raytracing precalculation step.
  • Diffuse as well as Glossy BDRF support.
  • Interreflection, called Self-Transfer in the original paper but in this implementation different objects can affect each others transfer functions.
  • Raytracing is accelerated using a BVH.
  • Spherical Harmonic coefficients can be efficiently rotated using recurrence relations as described in a paper by Ivanic.
  • Lighting is performed on the GPU. The Spherical Harmonic coefficients are stored in a Texture Buffer Object.
  • The engine supports two different types of Light. The first is a simple directional light, the calculation of which is fully synthetic. The second is a probe light, which is based on a provided light probe image, such as those found at http://www.pauldebevec.com/Probes.

Images

Default Diffuse Lighting

Note the soft shadow being cast from the monkey head onto the ground.

Default Lighting

HDR Probe Diffuse Lighting

Rendered using the Grace Cathedral light probe.

HDR Probe Lighting

Default Glossy Lighting

Default Glossy

HDR Probe Glossy Lighting

Rendered using the Grace Cathedral light probe.

HDR Probe Glossy

Diffuse Interreflection

Note the ambient lighting that is being reflected from the green cube and the red floor onto the monkey head.

Diffuse Self Transfer

Glossy Interreflection

Note the ambient lighting that is being reflected from the green cube and the red floor onto the monkey head.

Glossy Interreflection

BVH

A debug rendering of the BVH (Bounding Volume Hierarchy) structure used to raytrace the monkey head mesh.

BVH

Building

The project should work out of the box with Visual Studio 2017 or above.

The program makes use of .dat files to store the transfer coefficients of each model. These files are not included in the git repository and will be reconstructed upon running the program for the first time. This process might take a little while to complete.

Dependencies

  • Assimp
  • GLEW
  • GLM
  • SDL 2
  • STB Image

References

sphericalharmoniclighting's People

Contributors

jan-van-bergen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

sphericalharmoniclighting's Issues

Hey any idea why does glossy result look darker than diffuse?

I have referred to your implementation for implementing PRT. I observe that glossy results seem to be darker than the diffuse. I don't think it is because of the noise.
Do let me know.

Also, one suggestion is that your GLSL shader implementations seem to be confined for a texture of size V x (#SH coeffs) which is a problem if the mesh size goes over 32k (as that is the maximum size of texture indexing you get IG in modern Cards) Maybe changing the layout of the texture might help.

License for the code in this repository?

Hi,

I have implemented a novel version of PRT on the top of this repository.
I would like to make my project publicly available with clarification of the copyright of your code.
What kind of the copyright licence would you apply to this repository?

I will greatly appreciate it.

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.