diff --git a/.vscode/launch.json b/.vscode/launch.json index 869de0a..9b2e80e 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/configNative.php", + "program": "${workspaceFolder}/examples/configLightStrategy.php", "cwd": "${workspaceFolder}", "port": 9055 } diff --git a/examples/configLightStrategy.php b/examples/configLightStrategy.php new file mode 100644 index 0000000..ce9bb11 --- /dev/null +++ b/examples/configLightStrategy.php @@ -0,0 +1,29 @@ +type = render\LightStrategy::TYPE_UNIFORM; //修改灯光策略为 UNIFORM; + + + +// 现在修改灯光策略为 DLS_CACHE,并开启直接光缓存 +$lightStrategy = new render\cache\LightStrategy(); //当需要开启开直接光缓存时,灯光策略类型必须为 DLS_CACHE类型,因此cache\LightStrategy类 继承了 LightStrategy类, + //并在重写的构造函数中设置 $type属性为 DLS_CACHE类型。 + +$lightStrategy->persistentFile = "../Untitled.dlsc"; //设置设置直接光缓存文件保存路径 + +echo $lightStrategy; //输出灯光策略配置参数 + + +?> diff --git a/examples/configNative.php b/examples/configNative.php index 77a2458..c556f6b 100644 --- a/examples/configNative.php +++ b/examples/configNative.php @@ -8,7 +8,7 @@ namespace Blobt\Luxcore\scene; include dirname(dirname(__FILE__)) . "/vendor/autoload.php"; /** - * 配置CPU渲染参数,需要使用CPU设备渲染时,必须先设置渲染引擎类型为 PATHCPU + * 配置CPU渲染参数。需要使用CPU设备渲染时,必须先设置渲染引擎类型为 PATHCPU */ diff --git a/examples/configOpenCL.php b/examples/configOpenCL.php index 1cc275d..26b6858 100644 --- a/examples/configOpenCL.php +++ b/examples/configOpenCL.php @@ -8,8 +8,8 @@ namespace Blobt\Luxcore\scene; include dirname(dirname(__FILE__)) . "/vendor/autoload.php"; /** - * 配置GPU渲染参数,需要使用GPU设备渲染时,必须先设置渲染引擎类型为 PATHOCL - * 使用GPU渲染时,同时也可以使用CPU同时渲染,只需将OpenCL类的$nativeThreadsCount属性设置设置为null、或大于0的整数既可 + * 1、配置GPU渲染参数。需要使用GPU设备渲染时,必须先设置渲染引擎类型为 PATHOCL + * 2、使用GPU渲染时,同时也可以使用CPU同时渲染,只需将OpenCL类的$nativeThreadsCount属性设置设置为null、或大于0的整数既可 */ diff --git a/examples/configPath.php b/examples/configPath.php index 5e424b1..ed0bd64 100644 --- a/examples/configPath.php +++ b/examples/configPath.php @@ -10,7 +10,7 @@ include dirname(dirname(__FILE__)) . "/vendor/autoload.php"; /** * @var object 配置光线跟综参数 - * 当渲染器开启了全局光缘存并处于调试模式下,自适应跟踪参数不能设置与输出。 + * 当渲染器开启了全局光缘存并处于调试模式下,光线跟踪自适应彩样数量及最大亮度嵌制参数不能设置与输出。 */ $path = new render\Path(); //实例一个Path类对象 @@ -31,9 +31,9 @@ $path->pathDepth->glossy = 15; //设置 高光 -$path->hybridBackforWard = new render\HybridBackforWard(); //实例一个 HybridBackforWard类对象,使自适应光线跟踪 参数可以设置 +$path->hybridBackforWard = new render\HybridBackforWard(); //实例一个 HybridBackforWard类对象,使 光线跟踪自适应彩样数量 参数可以设置 -$path->hybridBackforWard->enable = BaseCfg::OPEN; //开启 自适应光线跟踪 +$path->hybridBackforWard->enable = BaseCfg::OPEN; //开启 光线跟踪自适应彩样数量 $path->hybridBackforWard->partition = 0.2; //设置 不跟踪光线 为百分之20 @@ -42,9 +42,9 @@ $path->hybridBackforWard->glossinessthreshold = 0.02; //设置区分 -$path->forceblackbackgroundEnable = BaseCfg::OPEN; //开启 限制 每个象素最大 光线跟踪数量 +$path->forceblackbackgroundEnable = BaseCfg::OPEN; //开启 限制 每个像素 最大亮度嵌制参数 -$path->clampingVarianceMaxvalue = 1200; //设置 每个像素 最大跟踪光线 数量为1200 +$path->clampingVarianceMaxvalue = 1200; //设置 最大亮度嵌制参数 为1200(这是一个DHR类型灰度色值) diff --git a/examples/configSampler.php b/examples/configSampler.php new file mode 100644 index 0000000..f5b2631 --- /dev/null +++ b/examples/configSampler.php @@ -0,0 +1,27 @@ +type = render\Sampler::TYPE_RANDOM; //设置采样器类型为 RANDOM,采样器类型有三个可选的类型,分别为 sobol、RANDOM、METROPOLIS。 + +$sampler->sampling = new render\Random(); //为 RANDOM类型采样器 配置参数,其 RANDOM类中的各种属性,可以查看 RANDOM类 的注释说明。其值为三个可选的 + //采样器类(分别是 Sobol、Random类、Metropolis类)的实例化对象,需要与 $type 的値保持对应。 + +echo $sampler; //输出采样器配置参数 + + +?> diff --git a/src/scene/render/Film.php b/src/scene/render/Film.php index 88e9a8f..1e75590 100644 --- a/src/scene/render/Film.php +++ b/src/scene/render/Film.php @@ -54,6 +54,7 @@ class Film extends BaseCfg public $outputs = []; /** + * @param array $config 接收一个数组,可以初始化当前实例化对象的各种属性 * @param object $noiseEstimation 如需自定义NoiseEstimation参数,可以传入一个 NoiseEstimation类对象,否则使用一个默认的NoiseEstimation参数 * @param object $filter 如需自定义抗锯齿参数,可以传入一个 Filter类对象,否则使用一个默认的抗锯齿参数 */ diff --git a/src/scene/render/HaltThresHold.php b/src/scene/render/HaltThresHold.php index df89bce..c6438a4 100644 --- a/src/scene/render/HaltThresHold.php +++ b/src/scene/render/HaltThresHold.php @@ -2,7 +2,6 @@ namespace Blobt\Luxcore\scene\render; use Blobt\Luxcore\scene\BaseCfg; -use Blobt\Luxcore\core\Base; class HaltThresHold extends BaseCfg { diff --git a/src/scene/render/Image.php b/src/scene/render/Image.php index 9509d5d..f6c94b2 100644 --- a/src/scene/render/Image.php +++ b/src/scene/render/Image.php @@ -143,7 +143,7 @@ class Image extends BaseCfg public $effect; /** - * 设置默认的图像输出文件名及格式 + * @param array $config 接收一个数组,可以初始化当前实例化对象的各种属性 */ public function __construct($config = []) { diff --git a/src/scene/render/LightStrategy.php b/src/scene/render/LightStrategy.php index 6f1305b..eda729e 100644 --- a/src/scene/render/LightStrategy.php +++ b/src/scene/render/LightStrategy.php @@ -15,7 +15,7 @@ class LightStrategy extends BaseCfg * @var string 使用何种灯光策略(可取值是 LOG_POWER、POWER、UNIFORM、DLS_CACHE 四个字符串之一,当值是 DLS_CACHE 时,直接光子缓存配置参数开启) */ public $type = self::TYPE_LOG_POWER; - + } ?> diff --git a/src/scene/render/Native.php b/src/scene/render/Native.php index cf97e2a..d50a056 100644 --- a/src/scene/render/Native.php +++ b/src/scene/render/Native.php @@ -7,7 +7,10 @@ class Native extends BaseCfg { /** - * @var integer //使用多少线程数(取值范围: 大于或等于1的整数) + * @var integer 设置CPU参与渲染的线程数。 + * 1、如果设置的值大于实际的物理线程数,渲染引擎则使用实际的线程数参与渲染; + * 2、如果设置为0,渲染引擎则默认使用1个线程数参与渲染; + * 3、如果省略此参数,渲染器则以最大线程数渲染 */ public $threadsCount; diff --git a/src/scene/render/OpenCL.php b/src/scene/render/OpenCL.php index 3da7b2f..27ccbf3 100644 --- a/src/scene/render/OpenCL.php +++ b/src/scene/render/OpenCL.php @@ -17,12 +17,15 @@ class OpenCL extends BaseCfg public $gpuUse = self::OPEN; /** - * @var string 控制使用哪些GPU设备的字符串(取值:是一段能标识系统中一个或多个GPU设备的ID字符串) + * @var string 控制使用哪些GPU设备(取值:是一段能标识系统中一个或多个GPU设备的ID字符串) */ public $devicesSelect = '1'; /** - * @var integral GPU渲染模式下,设置CPU是否渲染和多少线程渲染(取值范围: 大于或等于0的整数) + * @var integral 设置CPU参与渲染的线程数。 + * 1、如果设置的值大于实际的物理线程数,渲染引擎则使用实际的线程数参与渲染; + * 2、如果设置为0,渲染引擎则关团CPU参与渲染; + * 3、如果省略此参数,渲染器则默认打开CPU并且以最大线程数渲染。 */ public $nativeThreadsCount; diff --git a/src/scene/render/Path.php b/src/scene/render/Path.php index 8dd6769..c13b680 100644 --- a/src/scene/render/Path.php +++ b/src/scene/render/Path.php @@ -8,23 +8,22 @@ class Path extends BaseCfg { /** - * @var object 存储一个 PathDepth类 对象 + * @var object 存储一个 PathDepth类 对象, */ public $pathDepth; /** - * @var object 存储一个 HybridBackforWard类 对象,(光线跟踪采样数量自适应)、(在全局光调试模式下不需要输出这些字符串)、 - * (当同时启用本参数与降噪器参数时,那么抗锯齿类型只能选 NONE(无),(如果在本参数处于关闭时, 渲染终止参数不 - * 能设置 光线跟踪采样数量自适应 大于零的整数。)) + * @var object 光线跟踪采样数量自适应,存储一个 HybridBackforWard类 对象。 + * 1、在全局光调试模式下不需要输出这些字符串; + * 2、当同时启用本参数与降噪器参数时,那么抗锯齿类型只能选 NONE(无); + * 3、如果在本参数处于关闭时, 渲染终止参数不能设置 光线跟踪采样数量自适应 大于零的整数。 */ public $hybridBackforWard; - - /** - * @var bool 是否限制 每个象素 最高亮度,(可减少画面过亮的荧火虫现象) + * @var bool 是否限制 每个象素 最高亮度,开启可减少画面过亮的荧火虫现象。 */ public $forceblackbackgroundEnable = self::OPEN; @@ -35,9 +34,8 @@ class Path extends BaseCfg - /** - * @var object 存储一个 GhotonGI类 对象 + * @var object 全局光缓存配置参数,存储一个 GhotonGI类 对象。 */ public $photonGI; @@ -45,8 +43,9 @@ class Path extends BaseCfg /** + * @param array $config 接收一个数组,可以初始化当前实例化对象的各种属性 * @param object $pathDepth 如需自定义追踪深度参数,可以传入一个 PathDepth类对象,否则使用一个默认的追踪深度参数 - * @param object $hybridBackforWard 如需自定义HybridBackforWard参数,可以传入一个 HybridBackforWard类对象,否则使用一个默认的HybridBackforWard参数 + * @param object $hybridBackforWard 如需自定义 光线跟踪采样数量自适应 参数,可以传入一个 HybridBackforWard类对象,否则使用一个默认的 光线跟踪采样数量自适应 参数 */ public function __construct($config = [],PathDepth $pathDepth = null,HybridBackforWard $hybridBackforWard = null) { diff --git a/src/scene/render/Sampler.php b/src/scene/render/Sampler.php index 8e325c8..9a2238c 100644 --- a/src/scene/render/Sampler.php +++ b/src/scene/render/Sampler.php @@ -7,45 +7,32 @@ use Blobt\Luxcore\core\Base; class Sampler extends BaseCfg { - //渲染器的两个采样类型:SOBOL和RANDOM - const TYPE_SOBOL = 'SOBOL'; - const TYPE_METROPOLIS = 'METROPOLIS'; - const TYPE_RANDOM = 'RANDOM'; - - /** - * @var string 使用何种采样类型,默认是 SOBOL + * 三个采样器类型 */ - public $type = self::TYPE_SOBOL; + const TYPE_SOBOL = 'SOBOL'; //优化的随机噪声模式。支持噪声感知自适应采样。 + const TYPE_RANDOM = 'RANDOM'; //仅当使用BCD去噪器时,可以使用这个随机噪声模式,否则为Sobol。支持降噪自适应采样。 + const TYPE_METROPOLIS = 'METROPOLIS'; //取样器,将样本聚焦在图像中不受噪声影响的较亮部分。适合渲染焦散。不支持自适应降噪采样。 - /** - * @var object 一个 sobol类 的实例对象 - */ - public $sobol; /** - * @var object 一个 random类 的实例对象 + * @var string 使用何种采样类型,默认是 SOBOL */ - public $random; + public $type = self::TYPE_SOBOL; /** - * @var object 一个 metropolis类 的实例对象 + * @var object 采样为“sobol”类型时的一个 sobol类 的实例对象 */ - public $metropolis; + public $sampling = null; /** - * @param object 如需配置一个自定义采样器参数,可以传入一个 采样器类型的对象,否则使用一个默认的采样器参数 + * @param array $config 接收一个数组,可以初始化当前实例化对象的各种属性 + * @param object 如需配置一个自定义采样器参数,可以传入一个 采样器类型的对象和一个 采样器类型字符串,否则使用一个默认的采样器参数 */ public function __construct($config = [],$sampler = null) { - if($sampler != null) - { - if( $sampler instanceof Sobol ) $this->sobol = $sampler; - else if( $sampler instanceof Random ) $this->random = $sampler; - else if( $sampler instanceof Metropolis ) $this->metropolis = $sampler; - else throw new \Exception("You initialize the sampler to pass a ".$sampler->getInstanceClassName()." object, not the sampler type"); - } - else $this->sobol = new Sobol(); + if($sampler != null) $this->sampling = $sampler; + else $this->sampling = new Sobol(); Base::__construct($config); } diff --git a/src/scene/render/cache/LightStrategy.php b/src/scene/render/cache/LightStrategy.php index cefb2c1..b66a595 100644 --- a/src/scene/render/cache/LightStrategy.php +++ b/src/scene/render/cache/LightStrategy.php @@ -41,6 +41,7 @@ class LightStrategy extends render\LightStrategy public $entry; /** + * @param array $config 接收一个数组,可以初始化当前实例化对象的各种属性 * @param object $entry 如需自定义Entry参数,可以传入一个 Entry类对象,否则使用一个默认的Entry参数 */ public function __construct($config = [],Entry $entry = null) diff --git a/src/scene/render/cache/PhotonGI.php b/src/scene/render/cache/PhotonGI.php index d760f6b..9fa72d9 100644 --- a/src/scene/render/cache/PhotonGI.php +++ b/src/scene/render/cache/PhotonGI.php @@ -44,18 +44,19 @@ class PhotonGI extends BaseCfg public $debugType = self::TYPE_OFF; /** - * @var object 存储一个 Indirect类 对象 + * @var object 间接光缓存配置,存储一个 Indirect类 对象 */ public $indirect; /** - * @var object 存储一个 Caustic类 对象 + * @var object 焦散光缓存配置,存储一个 Caustic类 对象 */ public $caustic; /** - * @param object $indirect 如需自定义Indirect参数,可以传入一个 Indirect类对象,否则使用一个默认的Indirect参数 - * @param object $caustic 如需自定义Caustic参数,可以传入一个 Caustic类对象,否则使用一个默认的Caustic参数 + * @param array $config 接收一个数组,可以初始化当前实例化对象的各种属性 + * @param object $indirect 如需自定义Indirect参数,可以传入一个 Indirect类对象,否则使用一个默认的 间接光缓存配置 + * @param object $caustic 如需自定义Caustic参数,可以传入一个 Caustic类对象,否则使用一个默认的 焦散光缓存配置 */ public function __construct($config = [],Indirect $indirect = null,Caustic $caustic = null) {