Giter Site home page Giter Site logo

selfshadow / ltc_code Goto Github PK

View Code? Open in Web Editor NEW
397.0 18.0 48.0 7.59 MB

Code for "Real-Time Polygonal-Light Shading with Linearly Transformed Cosines"

License: Other

C++ 2.57% C 0.14% Lua 0.04% PHP 61.12% JavaScript 27.87% CSS 0.47% HTML 5.08% GLSL 2.72%

ltc_code's Introduction

Overview

This repository contains an (evolving) reference implementation for the following publications:

Notes:

  • The Linearly Transformed Cosine (LTC) tables in this implementation differ in their parameterisation and storage compared to the original paper. See fitting code and WebGL demos for details.

WebGL Demos

Quad lights
Line lights
Disk lights

ltc_code's People

Contributors

selfshadow 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ltc_code's Issues

Black spot when using disk light

When increase the height and width of the disk light, (e.g. width == height == 400 and the disk is parallel to the illuminated surface and the light is pointing down), a lot of black spot apprear in the center of the illuminated area.

Dose anyone know how to fix it?

image

filter code

Hello, where can I find the filter code of light source texture? Thanks a lot!

Metalness

Hello. If we use LTCs method to calculate BRDF integral, how to reflect the influence of metalness on the integral results? It seems that the factor of metalness is not taken into account when fitting matrix M. Thanks!

WebGL Demo links out of date

Hello!

First, thanks for the awesome work on LTC! Very cool!

I noticed there seem to be three different versions of the WebGL demos, which is causing me a little grief when using them as an implementation reference.

One's here:
https://blog.selfshadow.com/sandbox/ltc.html

Which is linked to from here: https://blogs.unity3d.com/2016/05/26/real-time-polygonal-light-shading-with-linearly-transformed-cosines/

That version uses

mat3 Minv = mat3(
            vec3(  1,   0, t.y),
            vec3(  0, t.z,   0),
            vec3(t.w,   0, t.x)
        );

Then there are the demos linked to by the readme on this repository which are here:
https://blog.selfshadow.com/ltc/webgl/ltc_quad.html

Those use the following for MinV:

mat3 Minv = mat3(
            vec3(t1.x,  0, t1.y),
            vec3(  0, t1.z,   0),
            vec3(t1.w,  0, t2.x)
        );

Then finally there is the official implementation implemented within the WebGL folder of this repository, which use this for MinV:

mat3 Minv = mat3(
            vec3(t1.x, 0, t1.y),
            vec3(  0,  1,    0),
            vec3(t1.z, 0, t1.w)
        );

This is really confusing. I ran into an issue where I was using the newer lookup table from this repository with an out of date linear transformation scheme from the Unity blog post. Is there a way we could get these three sets of WebGL demos updated and consistent?

Texture Prefilter Tool is giving incorrect results

So I created a new C++ project and copied the texture prefilter tool code to it. I also grabbed the CImg.h and the required stb headers to run it. However when I try to prefilter a texture, the resulting textures have incorrect colors, I am not quite sure what is causing this

Some Confuse about fit code

Hello,I recnetly read your paper "Real-Time Polygonal-Light Shading with Linearly Transformed Cosines" and your code, I have some confusions about the implements of the fit code.

1.why the matrix M in implement is diffrent from in the paper? The matrix M in implements is like this ,
M_Code
and the matrix M in the paper is like this
paper_M

  1. what's the meaning of the vector X Y Z
    XYZ

3.why the function eval implemented is diffrent from the paper?
D.why the res is divided by Jacobian howerver the paper says it should be multiplied by Jacobian
paper_D

Thank you for your reply.

Darker at grazing angle compared to groundtruth

Hi,

I tried this code with a diffuse only surface and an area light at grazing angle, the result is much darker compared to Monte Carlo groundtruth.

I understand this method is an approximation, but is there a way to improve its accuracy at grazing angle?

Light source below the ground

Hello, may I ask you a question? If there is only one light source and one horizontal plane in the scene, and the light source is below the horizontal plane, is it possible that some of the light source will be above the horizontal plane after multiplying the LTC matrix M ?If so, the horizontal plane will be illuminated. Do I need to tailor the polygonal light source before multiplying matrix M?

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.