Comments (3)
@jdaniellhebert
Hi, thank you for the kind words. Would you mind posting your entire SetupScene(void) function? That way I can look at some of the objects and their values that you have entered.
In the original SmallPT pathtracer (the code that I used to start my own project here), the rendering is constantly being accumulated to the final image. So that means it is very sensitive to bright lights (over exposure). When you say "whites out" that makes me think that maybe one of the lights in the scene is set too high. But if you can post your changes, I'll be glad to take a look and help you! :)
from three.js-pathtracing-renderer.
Hi Erich, thanks for your reply here are two versions of SetupScene(). One does not have the whiteout accumulation and the other does. I have found that this happens in other cases when I try commenting out only one of the other spheres.
This works:
//-----------------------------------------------------------------------
void SetupScene(void)
//-----------------------------------------------------------------------
{
vec3 z = vec3(0);
vec3 L1 = vec3(1.0, 1.0, 1.0) * 2.0;// Whiteish light
vec3 L2 = vec3(1.0, 0.8, 0.1) * 1.5;// Yellowish light
vec3 L3 = vec3(0.1, 0.7, 1.0) * 1.5;// Blueish light
spheres[0] = Sphere( 4000.0, vec3(0, -4000, 0), z, vec3(0.4,0.4,0.4), CHECK);//Checkered Floor
spheres[1] = Sphere( 500.0, vec3(0.0, 700.0, 0.0), L1, z, DIFF);//spherical white Light1
spheres[2] = Sphere( 100.0, vec3(200.0, 300.0, -200.0), L2, z, DIFF);//spherical yellowish Light2
spheres[3] = Sphere( 100.0, vec3(800.0, 300.0, -200.0), L3, z, DIFF);//spherical blueish Light3
spheres[4] = Sphere( 16.5, vec3(-25.0,16.5,5.0), z, vec3(0.9,0.9,0.9), SPEC);//Mirror sphere
spheres[5] = Sphere( 16.5, vec3(32.0,17.0,30.0), z, vec3(0.9,0.9,0.9), REFR);//Glass sphere //0.6,0.9,0.7
spheres[6] = Sphere( 10.0, vec3(-30.0,12.6,50.0), z, vec3(0.5,0.5,0.5), VOLUME);//Volume-filled sphere
spheres[7] = Sphere( 15.4, debugSpherePos, z, vec3(0.9,0.9,0.9), TRANSLUCENT);//debug translucent sphere
spheres[8] = Sphere( 8.0, vec3(5.0,8.0,35.0), z, vec3(0.9,0.9,0.9), SPECSUB);//shiny covering over sub-surface material
// ellipsoids[0] = Ellipsoid( vec3(30,40,16), vec3(90,5,-20), z, vec3(0.9,0.7,0.1), SPEC);//metallic ellipsoid
// cylinders[0] = Cylinder( 15.0, 30.0, vec3(-80,0,-50), z, vec3(0.5,0.0,0.0), REFR);//red glass Cylinder
// cones[0] = Cone( 20.0, 20.0, vec3(0,0,0), z, vec3(0.0,0.0,0.9), COAT);//blue Cone
planes[0] = Plane( vec4( -1.0,-0.1,0.0,800.0), z, vec3(0.9,0.9,0.9), DIFF);//WhitePlane Right Wall
planes[1] = Plane( vec4( 1.0,-0.1,0.0,800.0), z, vec3(0.9,0.0,0.9), DIFF);//MagentaPlane Left Wall
planes[2] = Plane( vec4( 0.0,-0.1,1.0,800.0), z, vec3(0.9,0.9,0.9), DIFF);//WhitePlane Back Wall
planes[3] = Plane( vec4( 0.0,-0.1,-1.0,800.0), z, vec3(0.0,0.9,0.9), DIFF);//CyanPlane Front Wall
disks[0] = Disk( 16.5 * 16.5, vec3(-100.0,11.0,-10.0), vec3( 1.0,-1.0,0.0 ), z, vec3(0.9,0.0,0.0), DIFF);//RedDisk Left
disks[1] = Disk( 16.5 * 16.5, vec3( 30.0,-10.0,-180.0), vec3( -1.0,0.0,0.3 ), L3, z, DIFF);//DiskLight
// triangles[0] = Triangle( vec3(0.0,0.0,1.0), vec3( 0.0,30.0,-50.0), vec3( 20.0,60.0,-50.0), vec3( -20.0,60.0,-50.0 ), z, vec3(0.0,0.9,0.0), DIFF);//Green Triangle
// quads[0] = Quad( vec3(0.0,0.0,1.0), vec3( -150.0,40.0,-50.0), vec3( -100.0,40.0,-50.0), vec3( -100.0,90.0,-50.0 ), vec3( -150.0,90.0,-50.0 ), z, vec3(0.0,0.0,0.9), DIFF);//Blue Quad
// boxes[0] = Box( vec3(0.0,7.0,-90.0), vec3(50.0,14.0,-180.0), z, vec3(0.2,0.9,0.7), REFR);//Glass Box
// boxes[1] = Box( vec3(2.0,9.0,-92.0), vec3(48.0,12.0,-178.0), z, vec3(0.0,0.0,0.0), DIFF);//Diffuse Box
}
This does not work and whites out. Note I have commented out just one of the spheres in addition to the other items in the first example.
//-----------------------------------------------------------------------
void SetupScene(void)
//-----------------------------------------------------------------------
{
vec3 z = vec3(0);
vec3 L1 = vec3(1.0, 1.0, 1.0) * 2.0;// Whiteish light
vec3 L2 = vec3(1.0, 0.8, 0.1) * 1.5;// Yellowish light
vec3 L3 = vec3(0.1, 0.7, 1.0) * 1.5;// Blueish light
spheres[0] = Sphere( 4000.0, vec3(0, -4000, 0), z, vec3(0.4,0.4,0.4), CHECK);//Checkered Floor
spheres[1] = Sphere( 500.0, vec3(0.0, 700.0, 0.0), L1, z, DIFF);//spherical white Light1
spheres[2] = Sphere( 100.0, vec3(200.0, 300.0, -200.0), L2, z, DIFF);//spherical yellowish Light2
spheres[3] = Sphere( 100.0, vec3(800.0, 300.0, -200.0), L3, z, DIFF);//spherical blueish Light3
spheres[4] = Sphere( 16.5, vec3(-25.0,16.5,5.0), z, vec3(0.9,0.9,0.9), SPEC);//Mirror sphere
spheres[5] = Sphere( 16.5, vec3(32.0,17.0,30.0), z, vec3(0.9,0.9,0.9), REFR);//Glass sphere //0.6,0.9,0.7
spheres[6] = Sphere( 10.0, vec3(-30.0,12.6,50.0), z, vec3(0.5,0.5,0.5), VOLUME);//Volume-filled sphere
spheres[7] = Sphere( 15.4, debugSpherePos, z, vec3(0.9,0.9,0.9), TRANSLUCENT);//debug translucent sphere
// spheres[8] = Sphere( 8.0, vec3(5.0,8.0,35.0), z, vec3(0.9,0.9,0.9), SPECSUB);//shiny covering over sub-surface material
// ellipsoids[0] = Ellipsoid( vec3(30,40,16), vec3(90,5,-20), z, vec3(0.9,0.7,0.1), SPEC);//metallic ellipsoid
// cylinders[0] = Cylinder( 15.0, 30.0, vec3(-80,0,-50), z, vec3(0.5,0.0,0.0), REFR);//red glass Cylinder
// cones[0] = Cone( 20.0, 20.0, vec3(0,0,0), z, vec3(0.0,0.0,0.9), COAT);//blue Cone
planes[0] = Plane( vec4( -1.0,-0.1,0.0,800.0), z, vec3(0.9,0.9,0.9), DIFF);//WhitePlane Right Wall
planes[1] = Plane( vec4( 1.0,-0.1,0.0,800.0), z, vec3(0.9,0.0,0.9), DIFF);//MagentaPlane Left Wall
planes[2] = Plane( vec4( 0.0,-0.1,1.0,800.0), z, vec3(0.9,0.9,0.9), DIFF);//WhitePlane Back Wall
planes[3] = Plane( vec4( 0.0,-0.1,-1.0,800.0), z, vec3(0.0,0.9,0.9), DIFF);//CyanPlane Front Wall
disks[0] = Disk( 16.5 * 16.5, vec3(-100.0,11.0,-10.0), vec3( 1.0,-1.0,0.0 ), z, vec3(0.9,0.0,0.0), DIFF);//RedDisk Left
disks[1] = Disk( 16.5 * 16.5, vec3( 30.0,-10.0,-180.0), vec3( -1.0,0.0,0.3 ), L3, z, DIFF);//DiskLight
// triangles[0] = Triangle( vec3(0.0,0.0,1.0), vec3( 0.0,30.0,-50.0), vec3( 20.0,60.0,-50.0), vec3( -20.0,60.0,-50.0 ), z, vec3(0.0,0.9,0.0), DIFF);//Green Triangle
// quads[0] = Quad( vec3(0.0,0.0,1.0), vec3( -150.0,40.0,-50.0), vec3( -100.0,40.0,-50.0), vec3( -100.0,90.0,-50.0 ), vec3( -150.0,90.0,-50.0 ), z, vec3(0.0,0.0,0.9), DIFF);//Blue Quad
// boxes[0] = Box( vec3(0.0,7.0,-90.0), vec3(50.0,14.0,-180.0), z, vec3(0.2,0.9,0.7), REFR);//Glass Box
// boxes[1] = Box( vec3(2.0,9.0,-92.0), vec3(48.0,12.0,-178.0), z, vec3(0.0,0.0,0.0), DIFF);//Diffuse Box
}
Thanks for your help!
from three.js-pathtracing-renderer.
Hi again, thanks for posting your code - that really helps me see what is happening. At first glance, I think I spot the reason that the second example is malfunctioning. Earlier in my source code, in the path tracing loop of bool SceneIntersect(...), it loops through all the objects according to how many you specify at the top of the script with the #define N_SPHERES (in this case). When the looping int 'i' gets to spheres[8], you have commented its construction out, so it has bad random values probably that have not been initiated.
The most simple fix I can think of is to simply set the #define N_SPHERES value to 8 instead of 9, so the intersect function doesn't try intersecting with undefined objects.
Let me know if this works. If not, I will try running both your scenes on my computer and keep looking for possible bugs.
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.