Comments (3)
Looking good!! 👌
from three.js-pathtracing-renderer.
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.
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)
- muti material not supported
- WebGPU port HOT 3
- More abstractions HOT 9
- Using more information from earlier samples HOT 3
- More samples per frame option HOT 63
- More compatibility with three js APIs HOT 2
- Stop a caustic ray if it crosses a surface HOT 3
- Just wondering how you handled something HOT 14
- Blue noise HOT 8
- GLTF viewer textures HOT 3
- sampler2D array HOT 14
- How to use this pathtracer in Freeciv 3D version? HOT 2
- [question] how to debug glsl in chrome? HOT 2
- GLTF_Model_Viewer didn't get the right result? HOT 6
- How to incorporate it into project? HOT 9
- statistical tool: bootstrapping
- Shadow Catcher HOT 1
- Support for a THREE.ParametricGeometry HOT 1
- GLTF_Viewer is not able to load textures HOT 1
- image stretched for BHV point light source HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from three.js-pathtracing-renderer.