-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for Chunky 2.4.0, save denoised images in the snapshot di…
…rectory.
- Loading branch information
Showing
12 changed files
with
330 additions
and
407 deletions.
There are no files selected for viewing
42 changes: 0 additions & 42 deletions
42
src/chunky-1/java/de/lemaik/chunky/denoiser/AlbedoTracer.java
This file was deleted.
Oops, something went wrong.
29 changes: 0 additions & 29 deletions
29
src/chunky-1/java/de/lemaik/chunky/denoiser/DenoiserTabImpl.java
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
43 changes: 0 additions & 43 deletions
43
src/chunky-2/java/de/lemaik/chunky/denoiser/AlbedoTracer.java
This file was deleted.
Oops, something went wrong.
55 changes: 55 additions & 0 deletions
55
src/main/java/de/lemaik/chunky/denoiser/AlbedoRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package de.lemaik.chunky.denoiser; | ||
|
||
import se.llbit.chunky.block.Air; | ||
import se.llbit.chunky.block.Water; | ||
import se.llbit.chunky.renderer.PathTracingRenderer; | ||
import se.llbit.chunky.renderer.WorkerState; | ||
import se.llbit.chunky.renderer.scene.PreviewRayTracer; | ||
import se.llbit.chunky.renderer.scene.RayTracer; | ||
import se.llbit.chunky.renderer.scene.Scene; | ||
import se.llbit.math.Ray; | ||
|
||
public class AlbedoRenderer extends PathTracingRenderer { | ||
|
||
public static final String ID = "ALBEDO"; | ||
|
||
public AlbedoRenderer() { | ||
super(ID, "Albedo map", "Renderer for albedo maps (used for denoising)", | ||
new AlbedoTracer()); | ||
} | ||
|
||
private static class AlbedoTracer implements RayTracer { | ||
|
||
@Override | ||
public void trace(Scene scene, WorkerState state) { | ||
Ray ray = state.ray; | ||
if (scene.isInWater(ray)) { | ||
ray.setCurrentMaterial(Water.INSTANCE, 0); | ||
} else { | ||
ray.setCurrentMaterial(Air.INSTANCE, 0); | ||
} | ||
|
||
while (true) { | ||
if (!PreviewRayTracer.nextIntersection(scene, ray)) { | ||
if (ray.getPrevMaterial().isWater()) { | ||
// set water color to white | ||
ray.color.set(1, 1, 1, 1); | ||
} else if (ray.depth == 0) { | ||
// direct sky hit | ||
if (!scene.transparentSky()) { | ||
scene.sky().getSkyColorInterpolated(ray); | ||
} | ||
} | ||
// ignore indirect sky hits | ||
break; | ||
} | ||
|
||
if (ray.getCurrentMaterial() != Air.INSTANCE && ray.color.w > 0.0D) { | ||
break; | ||
} | ||
|
||
ray.o.scaleAdd(1.0E-4D, ray.d); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.