diff --git a/SeeSharp/Integrators/Bidir/BidirBase.cs b/SeeSharp/Integrators/Bidir/BidirBase.cs
index 1902d43..4c3f3f0 100644
--- a/SeeSharp/Integrators/Bidir/BidirBase.cs
+++ b/SeeSharp/Integrators/Bidir/BidirBase.cs
@@ -186,7 +186,6 @@ public override void Render(Scene scene) {
ProgressBar progressBar = new(prefix: "Rendering...");
progressBar.Start(NumIterations);
- RNG camSeedGen = new(BaseSeedCamera);
RenderTimer timer = new();
Stopwatch lightTracerTimer = new();
Stopwatch pathTracerTimer = new();
@@ -211,7 +210,7 @@ public override void Render(Scene scene) {
LightPaths.NumPaths = NumLightPaths.Value;
lightTracerTimer.Start();
- LightPaths.TraceAllPaths(iter,
+ LightPaths.TraceAllPaths(BaseSeedLight, iter,
(origin, primary, nextDirection) => NextEventPdf(primary, origin));
ProcessPathCache();
lightTracerTimer.Stop();
diff --git a/SeeSharp/Integrators/Bidir/LightPathCache.cs b/SeeSharp/Integrators/Bidir/LightPathCache.cs
index 7a42dfe..dd62fce 100644
--- a/SeeSharp/Integrators/Bidir/LightPathCache.cs
+++ b/SeeSharp/Integrators/Bidir/LightPathCache.cs
@@ -16,12 +16,6 @@ public class LightPathCache {
///
public int MaxDepth;
- ///
- /// Seed that is hashed with the iteration and path index to generate a random number sequence
- /// for each light path.
- ///
- public uint BaseSeed = 0xC030114u;
-
///
/// The scene that is being rendered
///
@@ -124,11 +118,12 @@ public virtual (Ray, RgbColor, float) SampleBackground(ref RNG rng) {
///
/// Resets the path cache and populates it with a new set of light paths.
///
+ /// Base seed for the random number generator, hashed with the iteration to obtain the actual seed.
/// Index of the current iteration, used to seed the random number generator.
///
/// Delegate that is invoked to compute the next event sampling density
///
- public virtual void TraceAllPaths(uint iter, LightPathWalk.NextEventPdfCallback nextEventPdfCallback) {
+ public virtual void TraceAllPaths(uint seed, uint iter, LightPathWalk.NextEventPdfCallback nextEventPdfCallback) {
if (PathCache == null)
PathCache = new PathCache(NumPaths, Math.Min(MaxDepth + 1, 10));
else if (NumPaths != PathCache.NumPaths) {
@@ -141,7 +136,7 @@ public virtual void TraceAllPaths(uint iter, LightPathWalk.NextEventPdfCallback
LightPathWalk walkModifier = new(PathCache, nextEventPdfCallback);
Parallel.For(0, NumPaths, idx => {
- var rng = new RNG(BaseSeed, (uint)idx, iter);
+ var rng = new RNG(seed, (uint)idx, iter);
TraceLightPath(ref rng, idx, walkModifier);
});
diff --git a/SeeSharp/Integrators/Bidir/PhotonMapper.cs b/SeeSharp/Integrators/Bidir/PhotonMapper.cs
index eb658a4..81e6e14 100644
--- a/SeeSharp/Integrators/Bidir/PhotonMapper.cs
+++ b/SeeSharp/Integrators/Bidir/PhotonMapper.cs
@@ -54,14 +54,13 @@ public override void Render(Scene scene) {
MaxDepth = MaxDepth,
NumPaths = NumLightPaths,
Scene = scene,
- BaseSeed = BaseSeedLight
};
if (photonMap == null) photonMap = new();
for (uint iter = 0; iter < NumIterations; ++iter) {
scene.FrameBuffer.StartIteration();
- lightPaths.TraceAllPaths(iter, null);
+ lightPaths.TraceAllPaths(BaseSeedLight, iter, null);
ProcessPathCache();
TraceAllCameraPaths(iter);
scene.FrameBuffer.EndIteration();