Giter Site home page Giter Site logo

taichi-sggx's Introduction

SGGX Microflake Model

This repo contains a simplest implementation of volume rendering including

As it's for validation use only, only necessary components are included:

  • perspective camera, with simple box reconstruction filter
  • environment map
  • voxel based volume representation
  • transform could be applied on above components
  • single scattering model, path tracing

To run this repo, installing taichi and numpy will be sufficient. Use

python main.py

to render.

Camera

We follow the OpenGL camera convention that the camera space is right-handed and the z-axis faces backwards. For convenience, we consider a image plane at focus and don't consider near and far clip. Please refer to OpenGL Transformation

Environment Map

We use an hdr image as environment map. The environment is considered placed so far away that rays with the same direction result in the same color. For more details, please refer to PBR book.

Heterogeneous Volume

BoundingBox Homogeneous Heterogeneous

We consider scattering, absorptive and non-emissive volume. For basics of volume rendering, please refer to PBR book.

For simplicity, the volume is confined in an AABB and the data is stored in voxels. Each voxel stores 2 3D vectors, standing for extinction coefficient and albedo. Trilinear interpolation is applied for points sampled in the volume. Also we consider uniform phase function, as we don't focus on heterogeneous volume.

With path tracing, we have

BoundingBox Homogeneous Heterogeneous

SGGX Microflake

The SGGX microflake model is implemented as in the supplement material of originial paper.

BoundingBox SGGX

Renderer

The overall rendering equation is

$$ \begin{align}L(\mathbf{x}, \omega) &= T_r(\mathbf{x}, \mathbf{x}_{\infty}(\omega, \mathbf{x}))L_e(\omega) \\ &+ \int_0^{z} T_r(\mathbf{x}, \mathbf{x}_t)\sigma_t(\mathbf{x}_t)\alpha(\mathbf{x}_t)\int_{S^2} f_p(\mathbf{x}_t,\omega,\omega')L_e(\omega') d\omega'dt \end{align} $$

The radiance at point $\mathbf{x}$ from direction $\omega$ is composed of 2 terms. THe first term is the radiance from the background, with $T_r(\mathbf{x},\mathbf{y})$ being the transmittance between points $\mathbf{x}$ and $\mathbf{x}$, $L_e(\omega)$ being the radiance from the environment. As we mentioned, the environment radiance only depends on direction. And $\mathbf{x}_\infty(\omega)$ is the point at infinity in direction $\omega$ from point $\mathbf{x}$.

The second term is the accumulated scattering radiance. $\sigma_t$ is the extincition coefficient, $\alpha$ is the albedo. In SGGX rendering, these two terms may depend on directions. The inner integration is the radiance from all directions scattered to direction $\omega$. $f_p$ is the phase function.

taichi-sggx's People

Contributors

ccetaw avatar

Stargazers

Qianyue He avatar  avatar  avatar  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.