You are browsing as a guest. Sign up (or log in) to start making projects!

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.

Open comments for this post

25m 18s logged

Rotatable Camera!

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. :)

0
0
157
Super Star

As a prize for your great work, look out for a bonus prize in the mail :)

Ship #2

Path-Tracer Final Ship!!!!!!!!!!!

Ok so it seems like I am able to ship my project now even though my other ship is still pending; I won’t complain. :)

My project is not a game. It is the actual 3d render engine that I built from the ground up in java without any external library. It allows you to make and render any scene you can think of - as long as it is made of spheres ;) I even added multi threading to improve performance but it is still limited to CPU only so don’t expect crazy speeds although I am fairly happy with how well it runs!

This path tracer has been a really interesting project for me, It started out when I made a path tracer in scratch ages ago. For the Stardance challenge I decided to try and remake and improve on the idea. Since I had just learnt Java at school I decided that that would be a good language to work with - anything should run faster than scratch (with Turbowarp). You should be able to see the scratch version in my scratch profile if you look; you should find the link in this projects description.

Over the past weeks I have had multiple long car journeys on long weekends and things. I ended up putting a lot of time into this project while offline and in the car on my laptop (for many hours straight!).

Anyway, what is my project:

I have built a path tracer. A path tracer is a rendering system/method (also known as ray tracing - coined by Nvidia) and it is a way of rendering scenes with realistic lighting by simulation the physical rays of light and how they bounce. You can read more on how it works (and how to make one) with the main article that I used :https://raytracing.github.io/books/RayTracingInOneWeekend.html
My Github README has lots more information and instructions.

Features

  • Multi Threading
  • Matte materials using lambertian scattering
  • Reflective Metal Surfaces with variable fuzziness
  • Performance metric display
  • Running average accumulation
  • Optional tone mapping
  • Comprehensive customizability and scene editor.
  • Alternative noiseless render for the editor preview.
  • Camera movement
  • MENUS!!!!!

I would appreciate it if you gave it a try to see what you can render. Enjoy. :)

  • 5 devlogs
  • 25h
Try project → See source code →
Open comments for this post

1h 15m logged

DONE!!!!!!!!!!!!!

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.

Main Changes

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.

0
0
18
Open comments for this post

2h 52m 26s logged

More Small Changes

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. :)

0
0
27
Open comments for this post

17h 6m 31s logged

HUGE CHANGES

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.

The Editor UI

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.

The Editor Preview Render

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.

Problems & Future Changes

  • One of the things that i find annoying about the preview render is that there is some fairly obvious screen tearing on parts of moving spheres. This doesn’t affect the final render but is just a bit annoying
  • When going to render the scene the first frame may contain some black lines that remain as ghosts for the a while until enough frames have been rendered over them and the colours average out.
  • There is currently no way to change the resolution without editing the source code. It defaults to 480 x 270. A quarter of the standard 1920 x 1080.
  • The sphere editing menu can jump around when choosing changing the selected sphere.
  • I would like to add an option to hide or show the debug performance metrics.

Extra Info
Not much here :)

  • In the images you can see both a editor preview render with all of the menus open and a quick render of the scene to compare to the preview.
  • In the editor the big sphere that is tinted white is the one that is selected, the white tint pulses on and off.
0
0
26
Open comments for this post

1h 28m 6s logged

Tonemap Update and Code Reformatting

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.

0
0
19
Open comments for this post

2h 45m logged

Java Path-Tracer

A simple Java Path-tracer for rendering cool scenes written in a single java class.

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. :)

0
0
20
Open comments for this post

8h 1m 50s logged

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.

0
0
33
Open comments for this post

10h 10m 33s logged

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. :)

0
0
21

Delete project?

Are you sure you want to permanently delete this project? This action cannot be undone.

All devlogs, followers, and associated data will be removed.

Followers

Loading…