From b2255b06b21b8b293bae42c63f60905767251129 Mon Sep 17 00:00:00 2001 From: yuanjiajia <1139393632@qq.com> Date: Tue, 12 Apr 2022 09:37:59 +0800 Subject: [PATCH] =?UTF-8?q?Batch=E3=80=81HaltThresHold=E7=B1=BB=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E6=94=B9=E4=BF=AE=E4=BA=86=E6=B3=A8=E9=87=8A=E8=AF=B4?= =?UTF-8?q?=E6=98=8E=EF=BC=8C=E6=96=B0=E5=A2=9E=E4=B8=80=E4=B8=AAconfigBat?= =?UTF-8?q?ch.php=E7=A4=BA=E4=BE=8B=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/launch.json | 2 +- examples/configBatch.php | 32 ++++++++++++++++++++++++++++++ src/scene/render/Batch.php | 7 ++++--- src/scene/render/HaltThresHold.php | 10 ++++++---- 4 files changed, 43 insertions(+), 8 deletions(-) create mode 100644 examples/configBatch.php diff --git a/.vscode/launch.json b/.vscode/launch.json index 9b2e80e..f3698e2 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -11,7 +11,7 @@ "name": "Launch currently open script", "type": "php", "request": "launch", - "program": "${workspaceFolder}/examples/configLightStrategy.php", + "program": "${workspaceFolder}/examples/configBatch.php", "cwd": "${workspaceFolder}", "port": 9055 } diff --git a/examples/configBatch.php b/examples/configBatch.php new file mode 100644 index 0000000..137c900 --- /dev/null +++ b/examples/configBatch.php @@ -0,0 +1,32 @@ +halttime = 600; //设置渲染时间超时600秒(此参数优先级最高,如果渲染时间超时,则立即终止渲染,而不管其他条件是否已经设置或已经满足) + +$batch->haltspp = "500 200"; //设置每像素平均采样数达到500,且每像素自适应采样达200: + // 1、不启用噪波阈值状态下,如果渲染图像已满足采样条件,则触发终止渲染。 + // 2、启用噪波阈值状态下,如果渲染图像已满足采样条件,且图像噪波低于噪波阈值($stoprenderingEnable参数为 + // false状态时),触发终止渲染。 + +$batch->haltthreshold = "0.004"; //默认情况下,设置当图像噪波低于这个阈值时,则触发终止渲染,而不管 采样数 是否已设置或是否已满足。 + +$batch->haltthresholdcfg = new render\HaltThresHold(); //当使用噪波值作为终止渲染的条件时,配一个 噪波阈值类 的参数,HaltThresHold类的具体参数可查看其注释说明。 + +$batch->haltthresholdcfg->stoprenderingEnable = BaseCfg::CLOSE; //设置当图像噪波低于这个阈值时,且渲染图像已满足采样条件,才触发终止渲染。 + +echo $batch; //输出采样器配置参数 + + +?> diff --git a/src/scene/render/Batch.php b/src/scene/render/Batch.php index e459c1c..9745618 100644 --- a/src/scene/render/Batch.php +++ b/src/scene/render/Batch.php @@ -8,13 +8,14 @@ class Batch extends BaseCfg { /** - * @var string 每像素光线跟踪采样数与光线跟踪自适应采样数量,取值:一组大于等于0的分别表示降噪彩样次数和灯光采样次数的整数值字符串,0表示不启用这个参数,大于0表示启这个参数 - * 其中,必须在光线跟踪则启用时, 光线跟数量自适应 参数才可以设置大于零的整数。 + * @var string 每像素光线跟踪平均采样数 与 每像素光线跟踪自适应采样数,取值:一组大于等于0的分别表示 每像素光线跟踪平均采样数 和 + * 每像素光线跟踪自适应采样数 整数值字符串,0表示不启用这个参数,大于0表示启这个参数,其中,必须在 光线跟踪 参数中启 + * 用 光线跟踪自适应采样数量 时, 每像素光线跟踪自适应采样数量 参数才可以设置大于零的整数。 */ public $haltspp = "500 0"; /** - * @var integer 渲染的时间,单位秒,(取值:大于等于0的整数) + * @var integer 渲染超时的设置,单位秒,(取值:大于等于0的整数) */ public $halttime = 0; diff --git a/src/scene/render/HaltThresHold.php b/src/scene/render/HaltThresHold.php index c6438a4..9d7514e 100644 --- a/src/scene/render/HaltThresHold.php +++ b/src/scene/render/HaltThresHold.php @@ -7,22 +7,24 @@ class HaltThresHold extends BaseCfg { /** - * @var integer TODO:具体作用尚未明确,(取值:大于1的整数) + * @var integer TODO:第一次测试需要收集样本数(取值:大于1的整数)。在进行第一次收集测试之前要渲染多少个样本。请注意,第一 + * 次实际噪声检查仅出现在第二次测试(预热步骤)样本之后,具体作用尚不确明。 */ public $hwarmup = 64; /** - * @var integer TODO:具体作用尚未明确,(取值:大于16的整数) + * @var integer TODO:每次测试所需样本数。如果场景渲染非常缓慢且快速,则在收集测试之间渲染的采样将使用较小的值。具体作用尚未 + * 明确,取值:大于16的整数。 */ public $step = 64; /** - * @var bool TODO:具体作用尚未明确,(默认取值:true) + * @var bool TODO:是否加入抗锯齿作为影响终止渲染条件的因素。(默认取值:true) */ public $filterEnable = true; /** - * bool 当渲染器状态达到此类参数设置的值,是否停止渲染,(默认取值:true) + * @var bool 当渲染器状态达到此类参数设置的值,是否停止渲染,(默认取值:true) */ public $stoprenderingEnable = true;