Java Path Tracer
- 8 Devlogs
- 44 Total hours
Once again this is an improvement of a project I made in scratch. It is a Pathtracer render that can simulate light and make cool images.
Once again this is an improvement of a project I made in scratch. It is a Pathtracer render that can simulate light and make cool images.
I know that I can’t get extra stardust for time spent now but I just had to add a little bit more. On the GitHub if you use the source code (rather than a release) you can now click and drag on the screen to rotate the camera!
This was something that didn’t actually take to long, probably could of done it earlier. Anyway, you can use it now. Enjoy. :)
As a prize for your great work, look out for a bonus prize in the mail :)
I am finally at a point where I am happy with everything my path tracer can do! I just went through and commented almost everything so the code should be somewhat easier for someone to understand. And I added camera controls for better framing of the scene.
This is where I would ship my project as everything is now done. Sadly I previously shipped this project around 2 weeks ago and it still hasn’t been accepted. Everything at this point is ready for the ship but the end of stardance is coming up very soon, I hope there is a way I can ship this in time. If anyone has any advice please tell me. I have sent a message on #ask-the-shpipwrights But still no response.
I added a slider in the extra settings menu to change the FOV to better frame your renders. ranges from 1 to 1000 as I think that should provide enough range for almost any scenario.
I added camera movement with UHJKYI keys to move the camera to any position you want. Sorry the keys are a bit weird but WASDQE were already used for moving the spheres around.
In the past 2ish hours I have not done much significant work but I have managed to fix a bunch of bugs and make the experience more intuitive. I improved the look of very fuzzy metals and added an option to hide the debug text - through the extra settings menu.
That is about it for now. :)
I have been on holiday for the weekend and have not been able to post a devlog as I was offline and my time has gone above 10 hours. Does anyone know how I could still get stardust for the extra time? Anyway, it has been a bit since my last devlog and I can assure you that I have added many new features targeted at making the system easier to use. Almost everything is changeable without even looking at the code. Also, I’m not sure if they were in the last devlog but I added a time rendered metric in the top left to give more of an idea of performance in my images.
I poured many hours into making a (hopefully) intuitive system to edit the scene to be rendered. You can now select any sphere with the arrow keys and move it with WASD. You can also open a menu to change it’s properties like radius, colour, and material.
I wanted there to be a real time preview of the scene whyle you are editing it. Due to the accumulative nature of my Path Tracer, running it in real time would look incredibly noisy and fickery. I opted to try and make a totally new rendering system that can approximate the result in a single frame. At the moment this works great for everything except fuzzie metals - they just show as smooth.
Extra Info
Not much here :)
I haven’t done much in the way of large changes since last devlog but I have been reformatting much of my code to make it easier to read and use. The code should now look a lot cleaner. I also fixed the tonemapper as it was over over exposing the brighter spheres.
I also added a new tone map option that seems to be significantly better at representing bright colours than my prior two. The first one is purely clamping the HDR value to sRGB. As you may guess this leads to bright lights of most colours appearing white. I did have an alternative Reinhard tonemapper (v / (v + 1)) but that made everything look gray and desaturated as it applied the map to every colour channel individually causing all colours to look similar. The fix was to run the tone map with the brightest colour of the channel.
This new screenshot is done with the new tonemapper and is a great example of the new glass refraction. It is a bit dark sorry. This took >30min to render.
The main thing I have spent my time on is adding in a glass material. It has proved to be more of a pain than I originally thought. The book series Ray Tracing in One Weekend has once again proved very useful.
Anyway, whyle developing it I would repetitively get a material that looks somewhat like glass (or some weird blob) or something that was overly noisy. at one point my glass started emitting blue and yellow light (not much of a clue why that happened. After a good few hours of hassle I finally got it refracting properly. The rest of the features (total internal reflection & reflection) were fairly straightforward after that. Even caustics (the focused light under a glass sphere) work really well.
I also found that my metal bounce rays for fuzzie metals weren’t being normalised properly causing weird ring artefacts. That was an easy fix luckily.
I think this project is coming along well. Here is a new Hi-Res test scene that I let my laptop suffer on for quite a while. for reference this is an 8th gen i5 laptop and this scene took around 15 minutes to render. I did have a fair bit of other stuff open though. Enjoy. :)
Over the past few days i have made a few improvements. I have focused a bit more on the performance side of things and implemented (fairly bad) CPU multi threading as it was running single threaded before. This resulted in a 2-3x performance increase even though I went from 1 to 8 threads. I believe this is due to my bad code and the fact I create 8 new Thread objects every frame.
Other than performance optimisations I also expanded the functionality of the renderer. I added Lambertian scattering for more accurate matte surfaces. I gave metal a fuzziness propitiate that allows for more surface options. I also started to implement glass (which is an absolute pain) but it is still broken at the moment (see screenshots) :) I also did some general housekeeping and cleaned up the code making it easier to read.
The code is now visible on github for anyone who is interested.
This is my shot at making a (somewhat optimised) Path Tracer in Java. I have previously made one in scratch and am trying to make a better foundation to work off of so I can add more advanced features. I had already started making the ray traversal code but forgot to log it; my current time is a little on the low side. I primarily work of the online books ‘Ray Tracing In One Weekend’ as they contain most of the info I need. At the moment only spheres are supported and only can be matte or a light. Even now I have been able to make some cool renders of random spheres. I will soon add more surfaces (mirror, glass, etc), anti aliasing, and multi thread support for better performance. If I can I will add support for polygons and thus 3d models. I hope this is as cool to you as it is to me. Thanks for reading. :)