Coder Social home page Coder Social logo

Comments (3)

mrdoob avatar mrdoob commented on July 30, 2024 2

Looking good!! 👌

from three.js-pathtracing-renderer.

erichlof avatar erichlof commented on July 30, 2024 1

Hi @mrdoob ,
What a great idea! Yes, as the number of demos has grown, I was thinking that there is a lot of repeated boiler-plate shader code as well as init code in the init() function (the javascript portion located later in the demo .html files). I didn't want to have to enclose every shader code line in strings "", but from what you posted as an example, maybe I can just turn it into a THREE.ShaderChunk .

This would significantly reduce the demos code length, as well as make the main path tracing renderer more reusable, especially when I make small changes to it.

Thanks for the suggestion, I will try to get a pathtracingRenderer.js file up and running.
-Erich

from three.js-pathtracing-renderer.

erichlof avatar erichlof commented on July 30, 2024

Hi @mrdoob ,
Just a follow up - I took your suggestion to heart and refactored the pathtracing engine functions using a more modular approach with #includes.
I have updated the Cornell box demo as the first demo to use this new code base:
Cornell Box Demo using #includes

and here is the new source code:
Demo source code
and the file with common pathtracing functions, setup uniforms, and defines:
common pathtracing functions

Thanks again for the suggestion! It cut down the amount of demo .html code significantly. Plus, it's nice having the common pathtracing utility functions all located in 1 file. This will make small changes and maintenance much easier. Now, I have to convert all the other demo .html files 1 by 1, but the updates will be worth it later on down the line.

p.s. Can't wait for WebGL 2.0 support in three.js (it will allow me to add robust LBVH acceleration structures using bit manipulations and Morton codes in the WebGL shaders, all on the GPU!) :-)

Take care,
-Erich

from three.js-pathtracing-renderer.

Related Issues (20)

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.