-
Notifications
You must be signed in to change notification settings - Fork 81
Refactor the path tracer #1830
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Refactor the path tracer #1830
Conversation
Current bugs: - Water is invisible - Entities are visible through blocks (probably due to intersection order and not testing against distance to previous intersection test) - Sky / sunlight is visible through blocks
(they didn't fix clouds)
This prevents total internal reflection on most underwater surfaces where its presence doesn't make sense.
Fix file permissions
|
To build and run the PR, follow the instructions below. Download ControlsFX from here: https://repo1.maven.org/maven2/org/controlsfx/controlsfx/11.2.1/controlsfx-11.2.1.jar Create a new folder somewhere, such as Build Chunky with In the Your Java options should look something like:
|
Glass panes are not water-tight, and have quads in strange places, leading to broken intersections and refractions. For the moment, disabling refration in glass panes is the simpler and easier option. Glass panes are too thin for the refraction to be noticeable in most cases, anyway.
Also fixes an issue when loading a scene from JSON, where if multiple postprocessing filters of the same class were present in the JSON, the same postprocessing filter instance would be loaded multiple times, leading to separate GUI entries being linked to the same filter.
|
Conflicts have been resolved. |
Closes #26
Closes #361
Closes #502
Closes #612
Closes #636
Closes #665
Closes #893
Closes #980
Closes #1162
Closes #1230
Closes #1258
Closes #1409
Closes #1476
Closes #1477
Closes #1482
Closes #1515
Closes #1591
Possibly closes #1617
Possibly closes #1642
Closes #1669
Closes #1671
Closes #1494 in favor of this
Closes #1577 in favor of this
Closes #1601 in favor of this
Includes the changes from #1627, and adds a GUI for the reference color system.
Closes #1660 in favor of this
Closes #1668 in favor of this
Closes #1673 in favor of this
Includes the changes from #1809
The primary purpose of this PR is to refactor the path tracer to use a simple ray, and intersection records. The new ray stores a
Vector3origin, aVector3direction, the material it is traversing, and a flags integer. The IntersectionRecord stores distance, geometry normal, shading normal, uv coordinates, material, color, and a flags integer.I fixed a few other problems, but unfortunately did not think to change branches while doing so.
Notably:
I made use of the ControlsFX library for the
ToggleSwitchcontrol, which is a better design choice than aCheckBoxwhen the effects of the control are realized immediately, rather than later.The
Lightingtab was removed. Its contents pertaining to the sky and to the sun were relocated to the newEnvironmenttab. The contents pertaining to emitters were relocated to the newEmitterstab.The
Sky & Fogtab was removed. Its contents pertaining to the sky were relocated to theEnvironmenttab. Its contents pertaining to fog and clouds were relocated to the newFog & Cloudstab.The
Water visibility,Water opacity, and water color controls were removed, in favor of using material properties to control these properties. Notably, biome-tinted water is no longer possible, but it doesn't look realistic to begin with.More material properties were added to the
Materialstab.Materials can be right-clicked in the render preview to be edited through a dialog box. The advantages of this approach are that individual blockstates can be edited, which is something that the
Materialstab does not support. While changes to octree materials are saved to the blockPalette, allowing them to persist through scene saves and restarts, they are not saved to the scene.json, making external editing difficult. Also, individual materials in the BVH can be edited; however, since individual BVH materials are not saved to the scene.json, these changes will not persist through scene saves and restarts.These material properties are:
Emittance color: Changes the tint of the color of emitted light.Emitter mapping offset: See Color-based, per-material emittance mapping #1627 for details.Emitter mapping type: See Color-based, per-material emittance mapping #1627 for details.Use reference colors: Extracted this option to its own control, so that it can be used in conjunction with the other emitter mapping types.Alpha: Changes the opacity of the texture.Subsurface scattering: Changes the percentage of rays that have their normal inverted, so that they scatter to the other side of the texture.Diffuse color: Changes the tint of diffuse reflections.Specular: Changes the percentage of rays that are specularly reflected with no texture tinting.Transmission smoothness: Changes the smoothness for transmitted and refracted rays.Opaque: This option requires a chunk reload for its effects to be realized.Hidden: Prevents intersections with this material entirely.Volume density: When the current ray medium is the selected material, this sets the density of the volume scatter medium.Absorption: Rays travelling through the medium will be attenuated if the value is greater than 0.Metalness: Changes the percentage of specularly-reflected rays that are texture-tinted.Transmission metalness: Changes the percentage of specularly-transmitted or refracted rays that are texture tinted.The reference color GUI should be self-explanatory.
Other things of note are:
Branched path tracing is not functional at the moment. The infrastructure is still present in the renderer, but it is not implemented in the path tracer. As such, branch count is hard-coded to 1, and the control is hidden.
Fancier translucency is removed, because the new path tracer should handle transparent colors correctly* (At least it seems to do so.)
The sun sampling options have been changed.
Sample through opacitydoes what Chunky's currentFASTdoes.Sample onlystops when it hits certain interactions (like glass).Diffusetreats the sun as part of the skymap.Mixallows diffuse sun intersections after hitting those certain interactions thatSample onlydoes not handle, but prevents diffuse sun intersections when sampling the sun directly is possible. Overall, the results should be the same as withDiffuse.Draw sunenables or disables sunlight entirely, through adding or removing the sun texture from the skymap. It does not stop "sun sampling", however, as Chunky will still sample the sky where the sun is. This can be used to sample an HDRi, for example.Use flat textureoverrides the sun texture provided by the resource pack with a simple solid color square. It is enabled by default, and should be used when you want a specific sun color.Sunlight colortints the sun texture whenUse flat textureis disabled, and controls the sun color directly when it is enabled.The
Nishitasky model now has many more customization options available.There may still be plenty of bugs, so this PR could use some testing.