Skip to content
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

Add a more accurate fog implementation #1660

Draft
wants to merge 49 commits into
base: master
Choose a base branch
from

Conversation

Peregrine05
Copy link
Member

@Peregrine05 Peregrine05 commented Oct 29, 2023

This PR is draft because changes are pending.

Fixes #665.

This PR adds more accurate fog implementation that interacts with indirect lighting and emitter lighting correctly *(It does not yet work with Emitter Sampling Strategy). This fog implementation works independently of the old fog implementation, so both can be used together if so desired.

Old:
image

New:
image

The bounds of the fog is controlled by fog volumes. Each fog volume has its own independent properties, which include material and color properties. Four shapes of volume may be used. These are EXPONENTIAL, LAYER, SPHERE, and CUBOID.

This PR also applies the fog implementation to the clouds (which is toggleable), and adds more configuration options to the clouds. These include the ability to add multiple layers of clouds to the scene, the ability to scale the clouds per-dimension rather than just on the X- and Z-dimensions in conjunction, and the ability to set the color and material per cloud layer.

A new material property specific to the fog material, called Anisotropy, controls the direction light that hits the fog is likely to be scattered. The range of the property is [-1, 1]. Negative values increase the probability that light is scattered toward the direction from which it came, and positive values increase the probability that light is scattered into the direction to which it goes.

This denoiser build works for this PR.
chunky-denoiser-dev-fog-5.zip
Set the file extension to .jar before using it (GitHub refuses to allow JAR files to be uploaded).

JustinTimeCuber and others added 30 commits July 15, 2023 13:25
# Conflicts:
#	chunky/src/java/se/llbit/chunky/renderer/scene/PathTracer.java
# Conflicts:
#	chunky/src/java/se/llbit/math/Ray.java
Co-Authored-By: Justin Barker <[email protected]>
Add spherical and cuboid fog volumes.
- Re-enabled use of old (fast) fog.
- Made PathTracer `addSkyFog()` in diffuse reflections.
- Added an option to render particle fog in the render preview to the `Advanced` tab.
- Set the default uniform fog density to 0.05.
- Fixed the sphere implementation.
- Moved all fog controls to a new `Fog` tab.
- Renamed the `Sky & Fog` tab to `Sky`.
Implement JsonSerializable and add GUI
Includes changes from chunky-dev#1621.

Co-Authored-By: Justin Barker <[email protected]>
@Peregrine05 Peregrine05 changed the title More accurate fog implementation Add a more accurate fog implementation Oct 29, 2023
* @return Next intersection
*/
public static boolean nextIntersection(Scene scene, Ray ray) {
public static boolean nextIntersection(Scene scene, Ray ray, Random random, IntersectionConfig config) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better for this to give the intersection with the entire fog volume instead of needing to pass in a random and intersect in here. That would give ray tracers more flexibility on what it wants to do with the fog (ie ignore it, intersect with fog, calculate attenuation of fog, etc).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Limitations of the current fog implementation
4 participants