@@ -191,6 +191,10 @@ public class Scene implements JsonSerializable {
191191 * Recursive ray depth limit (not including Russian Roulette).
192192 */
193193 protected int rayDepth = PersistentSettings .getRayDepthDefault ();
194+ /**
195+ * Minimum number of ray bounces before Russian Roulette starts.
196+ */
197+ protected int minRayDepth = PersistentSettings .getMinRayDepthDefault ();
194198 protected String worldPath = "" ;
195199 protected int worldDimension = 0 ;
196200 protected RenderMode mode = RenderMode .PREVIEW ;
@@ -1685,13 +1689,32 @@ public synchronized void setRayDepth(int value) {
16851689 }
16861690 }
16871691
1692+ /**
1693+ * Set the minimum recursive ray depth before Russian Roulette starts
1694+ */
1695+ public synchronized void setMinRayDepth (int value ) {
1696+ value = Math .max (1 , value );
1697+ if (minRayDepth != value ) {
1698+ minRayDepth = value ;
1699+ PersistentSettings .setMinRayDepth (minRayDepth );
1700+ refresh ();
1701+ }
1702+ }
1703+
16881704 /**
16891705 * @return Recursive ray depth limit
16901706 */
16911707 public int getRayDepth () {
16921708 return rayDepth ;
16931709 }
16941710
1711+ /**
1712+ * @return Minimum ray depth before Russion Roulette is applied
1713+ */
1714+ public int getMinRayDepth () {
1715+ return minRayDepth ;
1716+ }
1717+
16951718 /**
16961719 * Clear the scene refresh flag
16971720 */
@@ -1939,6 +1962,7 @@ public synchronized void copyTransients(Scene other) {
19391962 sppTarget = other .sppTarget ;
19401963 branchCount = other .branchCount ;
19411964 rayDepth = other .rayDepth ;
1965+ minRayDepth = other .minRayDepth ;
19421966 mode = other .mode ;
19431967 pictureExportFormat = other .pictureExportFormat ;
19441968 cameraPresets = other .cameraPresets ;
@@ -2624,6 +2648,7 @@ public void setUseCustomWaterColor(boolean value) {
26242648 json .add ("sppTarget" , sppTarget );
26252649 json .add ("branchCount" , branchCount );
26262650 json .add ("rayDepth" , rayDepth );
2651+ json .add ("minRayDepth" , minRayDepth );
26272652 json .add ("pathTrace" , mode != RenderMode .PREVIEW );
26282653 json .add ("dumpFrequency" , dumpFrequency );
26292654 json .add ("saveSnapshots" , saveSnapshots );
@@ -2880,6 +2905,7 @@ public synchronized void importFromJson(JsonObject json) {
28802905 sppTarget = json .get ("sppTarget" ).intValue (sppTarget );
28812906 branchCount = json .get ("branchCount" ).intValue (branchCount );
28822907 rayDepth = json .get ("rayDepth" ).intValue (rayDepth );
2908+ minRayDepth = json .get ("minRayDepth" ).intValue (minRayDepth );
28832909 if (!json .get ("pathTrace" ).isUnknown ()) {
28842910 boolean pathTrace = json .get ("pathTrace" ).boolValue (false );
28852911 if (pathTrace ) {
0 commit comments