diff --git a/.vscode/launch.json b/.vscode/launch.json index 7a000ab..869de0a 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/printScene.php", + "program": "${workspaceFolder}/examples/configNative.php", "cwd": "${workspaceFolder}", "port": 9055 } diff --git a/examples/configNative.php b/examples/configNative.php new file mode 100644 index 0000000..77a2458 --- /dev/null +++ b/examples/configNative.php @@ -0,0 +1,36 @@ +type = render\RenderEngine::TYPE_PATHCPU; //设置渲染引擎类型为 PATHCPU + +echo $renderengine; //输出渲染引擎参数 + + + +/** + * 配置CPU渲染参数 + */ +$device = new render\Native(); //实例一个Path类对象 + +$device->threadsCount = 32; //设置CPU参与渲染的线程数,如果设置的值大于实际的物理线程数,渲染引擎则使用实际的线程数参与渲染 + //如果设置为0,渲染引擎则默认使用1个线程数参与渲染 + +echo $device; //输出GPU渲染参数 + +?> diff --git a/examples/configOpenCL.php b/examples/configOpenCL.php new file mode 100644 index 0000000..1cc275d --- /dev/null +++ b/examples/configOpenCL.php @@ -0,0 +1,43 @@ +type = render\RenderEngine::TYPE_PATHGPU; //设置渲染引擎类型为 PATHOCL + +echo $renderengine; //输出渲染引擎参数 + + + +/** + * 配置GPU渲染参数 + */ +$device = new render\OpenCL(); //实例一个Path类对象 + +$device->gpuUse = baseCfg::OPEN; //使用GPU + +$device->devicesSelect = "1"; //设置使用GPU设备的ID号 + +$device->cpuUse = baseCfg::OPEN; //使用CPU + +$device->nativeThreadsCount = 32; //设置CPU参与渲染的线程数,如果设置的值大于实际的物理线程数,渲染引擎则使用实际的线程数参与渲染 + //如果设置为0,则关闭CPU渲染 + +echo $device; //输出GPU渲染参数 + +?> diff --git a/examples/configPath.php b/examples/configPath.php new file mode 100644 index 0000000..5e424b1 --- /dev/null +++ b/examples/configPath.php @@ -0,0 +1,58 @@ +pathDepth = new render\PathDepth(); //实例一个 PathDepth(光线跟踪深度)类对象,使光线跟踪参数可以设置 + +$path->pathDepth->total = 12; //设置 漫反射、光泽反射、高光反射 的最大跟踪不能超过12,如果漫反射、光泽反射、高光反射当中有高于这个值的设置, + //那么其实际最大跟踪深度则限制为这个数值 + +$path->pathDepth->diffuse = 8; //设置 漫反射跟踪深度为 8 + +$path->pathDepth->glossy = 8; //设置 光泽反射跟踪深度为 8 + +$path->pathDepth->glossy = 15; //设置 高光反射跟踪深度为 15,但受 total的限制,其实际跟踪深度为 12 + + + + +$path->hybridBackforWard = new render\HybridBackforWard(); //实例一个 HybridBackforWard类对象,使自适应光线跟踪 参数可以设置 + +$path->hybridBackforWard->enable = BaseCfg::OPEN; //开启 自适应光线跟踪 + +$path->hybridBackforWard->partition = 0.2; //设置 不跟踪光线 为百分之20 + +$path->hybridBackforWard->glossinessthreshold = 0.02; //设置区分图像的 平坦区域和非平坦区域 的阀值为0.02 + + + + +$path->forceblackbackgroundEnable = BaseCfg::OPEN; //开启 限制 每个象素最大 光线跟踪数量 + +$path->clampingVarianceMaxvalue = 1200; //设置 每个像素 最大跟踪光线 数量为1200 + + + + +$path->photonGI = new render\cache\PhotonGI(); //实例一个PhotonGI类对象,开启全局光缓存功能 + +$path->photonGI->persistentFile = "../temp.pgi"; //将全局光缓存保个子为 temp.pgi + +echo $path; //输出光线跟综参数 + +?> diff --git a/examples/printRender.php b/examples/printRender.php index fcda354..6b91bb6 100644 --- a/examples/printRender.php +++ b/examples/printRender.php @@ -51,6 +51,9 @@ $film->addImage($img); $film->addImage(new render\Image(['type' => 'ALBEDO'])); $film->addImage(new render\Image(['type' => 'AVG_SHADING_NORMAL'])); +$film->addImage(new render\Image(['type' => 'OBJECT_ID'])); + + $img = new render\Image(); $img->effect = [new render\effect\NoiseReducerOIDN(),new render\effect\Pretreatment(),new render\effect\ToneMapLinear(),new render\effect\CammaCorrection()]; $film->addImage($img); diff --git a/src/scene/render/Batch.php b/src/scene/render/Batch.php index da19c8a..e459c1c 100644 --- a/src/scene/render/Batch.php +++ b/src/scene/render/Batch.php @@ -8,9 +8,10 @@ class Batch extends BaseCfg { /** - * @var integer 采样次数,(取值:大于等于0的整数) - */ - public $haltspp = 500; + * @var string 每像素光线跟踪采样数与光线跟踪自适应采样数量,取值:一组大于等于0的分别表示降噪彩样次数和灯光采样次数的整数值字符串,0表示不启用这个参数,大于0表示启这个参数 + * 其中,必须在光线跟踪则启用时, 光线跟数量自适应 参数才可以设置大于零的整数。 + */ + public $haltspp = "500 0"; /** * @var integer 渲染的时间,单位秒,(取值:大于等于0的整数) diff --git a/src/scene/render/HybridBackforWard.php b/src/scene/render/HybridBackforWard.php index 1c82226..a625a8a 100644 --- a/src/scene/render/HybridBackforWard.php +++ b/src/scene/render/HybridBackforWard.php @@ -7,7 +7,7 @@ class HybridBackforWard extends BaseCfg { /** - * @var bool 是否开启 自适应光线跟踪 参数设置 + * @var bool 是否开启 光线跟踪采样数量自适应 参数设置 */ public $enable = self::OPEN; @@ -17,7 +17,7 @@ class HybridBackforWard extends BaseCfg public $partition = 0; /** - * @var float设置区分图像的 平坦区域和非平坦区域 的阀值 (取值:0-1) + * @var float 设置区分图像的 平坦区域和非平坦区域 的阀值 (取值:0-1) */ public $glossinessthreshold = 0.05; diff --git a/src/scene/render/OpenCL.php b/src/scene/render/OpenCL.php index c7494d8..3da7b2f 100644 --- a/src/scene/render/OpenCL.php +++ b/src/scene/render/OpenCL.php @@ -26,24 +26,10 @@ class OpenCL extends BaseCfg */ public $nativeThreadsCount; - - /** - * 使用cpu渲染 - */ - public function useCpu() - { - $this->cpuUse = self::OPEN; - $this->gpuUse = self::CLOSE; - } - /** - * 使用gpu渲染 + * @var bool 否是使用 GUP设备 降噪 */ - public function useGpu() - { - $this->cpuUse = self::CLOSE; - $this->gpuUse = self::OPEN; - } + public $outofcoreEnable; } diff --git a/src/scene/render/Path.php b/src/scene/render/Path.php index 431e026..8dd6769 100644 --- a/src/scene/render/Path.php +++ b/src/scene/render/Path.php @@ -13,7 +13,9 @@ class Path extends BaseCfg public $pathDepth; /** - * @var object 存储一个 HybridBackforWard类 对象,在调试模式下不需要输出这些字符串 + * @var object 存储一个 HybridBackforWard类 对象,(光线跟踪采样数量自适应)、(在全局光调试模式下不需要输出这些字符串)、 + * (当同时启用本参数与降噪器参数时,那么抗锯齿类型只能选 NONE(无),(如果在本参数处于关闭时, 渲染终止参数不 + * 能设置 光线跟踪采样数量自适应 大于零的整数。)) */ public $hybridBackforWard; @@ -22,12 +24,12 @@ class Path extends BaseCfg /** - * @var bool 是否限制 单象素光线 最大跟踪数量 + * @var bool 是否限制 每个象素 最高亮度,(可减少画面过亮的荧火虫现象) */ public $forceblackbackgroundEnable = self::OPEN; /** - * @var integer 单象素光线 的最大跟踪数量 (取值:大于0的整数) + * @var float 每个像素 最高亮度 (取值:大于0的HDR灰度值) */ public $clampingVarianceMaxvalue = 1000; diff --git a/src/scene/render/PathDepth.php b/src/scene/render/PathDepth.php index 0f5b1bf..65d6739 100644 --- a/src/scene/render/PathDepth.php +++ b/src/scene/render/PathDepth.php @@ -22,7 +22,7 @@ class PathDepth extends BaseCfg public $glossy = 5; /** - * 限制 光泽反射光线 最大跟踪深度为(取值:大于或等于1的整数) + * 限制 高光反射光线 最大跟踪深度为(取值:大于或等于1的整数) */ public $specular = 6; } diff --git a/src/scene/render/Random.php b/src/scene/render/Random.php index f7cf22a..3ef9b54 100644 --- a/src/scene/render/Random.php +++ b/src/scene/render/Random.php @@ -34,7 +34,7 @@ class Random extends BaseCfg public $superSampling = self::POW_TWO_ZERO; /** - * @var integer TODO:具体作用尚不明确(默认16) + * @var integer TODO:分块大小(单位像素), */ public $tileSize = 16; diff --git a/src/scene/render/Sobol.php b/src/scene/render/Sobol.php index ec9e591..b250057 100644 --- a/src/scene/render/Sobol.php +++ b/src/scene/render/Sobol.php @@ -28,18 +28,19 @@ class Sobol extends BaseCfg public $overlapping = self::PROGRESSIVE; /** - * @var integer 这是 “$overlapping”参数的倍数(此参数只在GPU渲染模式可设置) + * @var integer 这是 “$overlapping”参数的倍数,所得到的乘积就是单个像素的最大跟踪光线的数量,当渲染引擎为PATHCPU + * 时,其值只能为1,当渲染引擎为PATHOCL时,其值可以是除1之外的几个2的n次方数“4、8、16、32、64” */ public $superSampling = self::POW_TWO_ZERO; /** - * @var integer TODO:具体作用尚不明确(默认16) + * @var integer TODO:分块大小(单位像素) */ public $tileSize = 16; /** - * @var integer TODO:具体作用尚不明确,(当“$overlapping”优化类型为“PROGRESSIVE”,此值被设为16; - * 当“$overlapping”优化类型为“CACHE_FRIENDLY”,此值被设为1) + * @var integer TODO:容器大小,(当“$overlapping”优化类型为“PROGRESSIVE”,此值被设为16; + * 当“$overlapping”优化类型为“CACHE_FRIENDLY”,此值被设为1) */ public $bucketSize = 1; diff --git a/src/scene/render/cache/Caustic.php b/src/scene/render/cache/Caustic.php index 1238d2a..247bb7d 100644 --- a/src/scene/render/cache/Caustic.php +++ b/src/scene/render/cache/Caustic.php @@ -7,9 +7,9 @@ class Caustic extends BaseCfg { /** - * @var bool 是否打开本类的参数控制(默认:false) + * @var bool 是否打开本类的(焦散光)属性控制(默认:false) */ - public $enabled = false; + public $enabled = self::OPEN; /** * @var integer TODO:最大尺寸(百万),具体作用尚未明确(默认取值:100000) diff --git a/src/scene/render/cache/Indirect.php b/src/scene/render/cache/Indirect.php index 9dccd1a..ab21b30 100644 --- a/src/scene/render/cache/Indirect.php +++ b/src/scene/render/cache/Indirect.php @@ -7,9 +7,9 @@ class Indirect extends BaseCfg { /** - * @var bool 是否打开本类的参数控制(默认:false) + * @var bool 是否打开本类(间接光)的属性控制(默认:false) */ - public $enabled = false; + public $enabled = self::OPEN; /** * @var integer TODO:最大尺寸(百万),具体作用尚未明确(固定取值:0) diff --git a/src/scene/render/cache/PhotonGI.php b/src/scene/render/cache/PhotonGI.php index c73bae6..d760f6b 100644 --- a/src/scene/render/cache/PhotonGI.php +++ b/src/scene/render/cache/PhotonGI.php @@ -9,6 +9,14 @@ class PhotonGI extends BaseCfg //全局光缓存类 + /** + * 调试类型 + */ + const TYPE_OFF = null; + const TYPE_SHOWINDIRECT = "showindirect"; + const TYPE_SHOWINDIRECTPATHMIX = "showindirectpathmix"; + const TYPE_SHOWCAUSTIC = "showcaustic"; + /** * @var float 最大光子计数,(取值:大于等于1百万) */ @@ -25,10 +33,16 @@ class PhotonGI extends BaseCfg public $glossinessusagethreshold = 0.05; /** - * @var string 储存光子缓存文件的路径及文件名,如果字符串为空,则表示不储存光子缓存文件 + * @var string 储存光子缓存文件的路径及文件名,如果字符串为空,则表示不储存光子缓存文件,只有Indirect、Caustic + * 至少开启一样,才会有全局光缓存文件输出 */ public $persistentFile = ''; + /** + * @var string 调试类型,取值是一个 调试类型 的字符串常量 + */ + public $debugType = self::TYPE_OFF; + /** * @var object 存储一个 Indirect类 对象 */