diff --git a/examples/print.php b/examples/print.php index f7e1798..c06be61 100644 --- a/examples/print.php +++ b/examples/print.php @@ -4,9 +4,10 @@ namespace Blobt\Luxcore\scene; include dirname(dirname(__FILE__)) . "/vendor/autoload.php"; +use Blobt\Luxcore\file; +use Blobt\Luxcore\effect; -/* //设置打印渲染引擎的配置参数 $renderEngine = new RenderEngine(); echo $renderEngine; @@ -15,17 +16,12 @@ echo $renderEngine; $openCL = new OpenCL(); echo $openCL; -//设置打印GPU渲染设备的配置参数 -$native = new Native(['threadsCount' => 64]); -echo $native; - //设置打印光线跟踪的配置参数 -$path = new Path(['glossinessthreshold' => 0.999]); +$path = new Path(); echo $path; //设置打印 采样器 配置参数 -$sampler = new Sampler(['imagemutationrate' => 0.888]); -$sampler->random->overlapping = 32; +$sampler = new Sampler(); echo $sampler; //设置打印 灯光策略 配置参数 @@ -35,15 +31,25 @@ echo $lightStrategy; //设置打印 文件储存格式 配置参数 $filesaver = new FileSaver(); echo $filesaver; -*/ + +//设置打印 渲染终止 配置参数 +$batch = new Batch(); +$batch->useNoiseThreshold(); +echo $batch; + +//设置打印 场景属性 配置参数 +$scene = new Scene(); +echo $scene; //设置打印 “胶片” 配置参数 $film = new Film(); -$film->outputs[] = new ImageSaverBase(['type' => ImageSaverBase::TYPE_RGBA ]); -$film->outputs[] = new ImageSaverBase(['type' => ImageSaverBase::TYPE_MATERIAL_ID ]); -$film->outputs[] = new ImageSaverNumber(['index' => 2 ]); -$film->imagepipelines['002'] = [new NoiseReducerOIDN(),new Pretreatment(),new ToneMapAutoLinear(),new ToneMapLinear(),new AnalogFilmSimulation(),new IrradianceContourLines(),new CammaCorrection()]; +$film->outputs[] = new file\ImageSaverBase(['type' => file\ImageSaverBase::TYPE_RGBA ]); +$film->outputs[] = new file\ImageSaverBase(['type' => file\ImageSaverBase::TYPE_MATERIAL_ID ]); + +$film->outputs[] = new file\ImageSaverNumber(['index' => 2 ]); +$film->imagepipelines['002'] = [new effect\NoiseReducerOIDN(),new effect\Pretreatment(),new effect\ToneMapLinear(),new effect\AnalogFilmSimulation(),new effect\CammaCorrection()]; + echo $film; ?> diff --git a/src/scene/AnalogFilmSimulation.php b/src/effect/AnalogFilmSimulation.php similarity index 97% rename from src/scene/AnalogFilmSimulation.php rename to src/effect/AnalogFilmSimulation.php index 2c1a25d..c8ee527 100644 --- a/src/scene/AnalogFilmSimulation.php +++ b/src/effect/AnalogFilmSimulation.php @@ -1,7 +1,7 @@ diff --git a/src/scene/ColorAberration.php b/src/effect/ColorAberration.php similarity index 83% rename from src/scene/ColorAberration.php rename to src/effect/ColorAberration.php index a27f1ea..63bfd03 100644 --- a/src/scene/ColorAberration.php +++ b/src/effect/ColorAberration.php @@ -1,7 +1,7 @@ haltthresholdcfg = new HaltThresHold($config); + } + +} + +?> diff --git a/src/scene/CammaCorrection.php b/src/scene/CammaCorrection.php deleted file mode 100644 index d5f7779..0000000 --- a/src/scene/CammaCorrection.php +++ /dev/null @@ -1,21 +0,0 @@ - diff --git a/src/scene/Film.php b/src/scene/Film.php index 5e6ac4c..d940c1f 100644 --- a/src/scene/Film.php +++ b/src/scene/Film.php @@ -2,6 +2,8 @@ namespace Blobt\Luxcore\scene; use Blobt\Luxcore\core\Base; +use Blobt\Luxcore\file; +use Blobt\Luxcore\effect; class Film extends BaseCfg { @@ -16,6 +18,9 @@ class Film extends BaseCfg */ public $filter; + + + /** * 渲染图像的宽度,单位像素(取值:大于0的整数) */ @@ -36,6 +41,9 @@ class Film extends BaseCfg */ public $openclDevice = 0; + + + /** * @var array 渲染图像后期处理配置参数 */ @@ -55,14 +63,14 @@ class Film extends BaseCfg $this->noiseEstimation = new NoiseEstimation($config); $this->filter = new Filter($config); - $this->outputs[] = new ImageSaverNumber(['index' => 0]); - $this->imagepipelines['000'] = [new Pretreatment(),new ToneMapLinear(),new CammaCorrection()]; + $this->outputs[] = new file\ImageSaverNumber(['index' => 0]); + $this->imagepipelines['000'] = [new effect\Pretreatment(),new effect\ToneMapLinear(),new effect\CammaCorrection()]; - $this->outputs[] = new ImageSaverBase(['type' => 'ALBEDO']); - $this->outputs[] = new ImageSaverBase(['type' => 'AVG_SHADING_NORMAL']); + $this->outputs[] = new file\ImageSaverBase(['type' => 'ALBEDO']); + $this->outputs[] = new file\ImageSaverBase(['type' => 'AVG_SHADING_NORMAL']); - $this->outputs[] = new ImageSaverNumber(['index' => 1]); - $this->imagepipelines['001'] = [new NoiseReducerOIDN(),new Pretreatment(),new ToneMapLinear(),new CammaCorrection()]; + $this->outputs[] = new file\ImageSaverNumber(['index' => 1]); + $this->imagepipelines['001'] = [new effect\NoiseReducerOIDN(),new effect\Pretreatment(),new effect\ToneMapLinear(),new effect\CammaCorrection()]; Base::__construct($config); } diff --git a/src/scene/Filter.php b/src/scene/Filter.php index e8f1ab2..07a094d 100644 --- a/src/scene/Filter.php +++ b/src/scene/Filter.php @@ -17,7 +17,7 @@ class Filter extends BaseCfg /** * @var string 使用何种抗锯齿类型 */ - public $type = self::TYPE_NONE; + public $type = self::TYPE_BLACKMANHARRIS; /** * @var float 边缘抗锯齿宽度,单位像素(取值:大于0的数浮点数) @@ -27,12 +27,12 @@ class Filter extends BaseCfg /** * @var float 高斯类型抗锯齿过滤器的透明度(取值:0.10-10的浮点数) */ - public $gaussianAlpha = 2; + public $gaussianAlpha; /** * @var float “SINC”类型抗锯齿过滤器的参数,TODO:具体作用尚不明确,(取值:0.10-8的浮点数) */ - public $sincTau = 1; + public $sincTau; } diff --git a/src/scene/HaltThresHold.php b/src/scene/HaltThresHold.php new file mode 100644 index 0000000..15677c2 --- /dev/null +++ b/src/scene/HaltThresHold.php @@ -0,0 +1,31 @@ + diff --git a/src/scene/HybridBackforWard.php b/src/scene/HybridBackforWard.php index 75c6d49..40144cf 100644 --- a/src/scene/HybridBackforWard.php +++ b/src/scene/HybridBackforWard.php @@ -13,12 +13,12 @@ class HybridBackforWard extends BaseCfg /** * @var float 设置 不跟踪光线 所占最大百分比 (取值:0-1) */ - public $partition = 0.8; + public $partition = 0; /** * @var float设置区分图像的 平坦区域和非平坦区域 的阀值 (取值:0-1) */ - public $glossinessthreshold = 0.45; + public $glossinessthreshold = 0.05; } diff --git a/src/scene/Native.php b/src/scene/Native.php index 0661f5c..a2f0362 100644 --- a/src/scene/Native.php +++ b/src/scene/Native.php @@ -8,7 +8,7 @@ class Native extends BaseCfg /** * @var integer //使用多少线程数(取值范围: 大于或等于1的整数) */ - public $threadsCount = 4; + public $threadsCount; } diff --git a/src/scene/OpenCL.php b/src/scene/OpenCL.php index 6544ca0..35e2641 100644 --- a/src/scene/OpenCL.php +++ b/src/scene/OpenCL.php @@ -23,7 +23,7 @@ class OpenCL extends BaseCfg /** * @var integral GPU渲染模式下,设置CPU是否渲染和多少线程渲染(取值范围: 大于或等于0的整数) */ - public $nativeThreadsCount = 4; + public $nativeThreadsCount; /** diff --git a/src/scene/Path.php b/src/scene/Path.php index ac84b0f..5cb6cd0 100644 --- a/src/scene/Path.php +++ b/src/scene/Path.php @@ -16,6 +16,9 @@ class Path extends BaseCfg */ public $hybridBackforWard; + + + /** * @var bool 是否限制 单象素光线 最大跟踪数量 */ diff --git a/src/scene/Sampler.php b/src/scene/Sampler.php index c05faaf..b6e525c 100644 --- a/src/scene/Sampler.php +++ b/src/scene/Sampler.php @@ -38,8 +38,6 @@ class Sampler extends BaseCfg public function __construct($config = []) { $this->sobol = new Sobol($config); - $this->random = new Random($config); - $this->metropolis = new Metropolis($config); Base::__construct($config); } diff --git a/src/scene/Scene.php b/src/scene/Scene.php new file mode 100644 index 0000000..79867c3 --- /dev/null +++ b/src/scene/Scene.php @@ -0,0 +1,26 @@ +