Browse Source

新增了“Scene.php”、“Batch.php”、“HaltThresHold.php”三个类文件,管线处理类移动到“effect”命名空间下,文件输出类移动到“file”命名空间下

master
yuanjiajia 3 years ago
parent
commit
ef8e6821eb
  1. 32
      examples/print.php
  2. 4
      src/effect/AnalogFilmSimulation.php
  3. 4
      src/effect/BackgroundImg.php
  4. 3
      src/effect/Bloom.php
  5. 21
      src/effect/CammaCorrection.php
  6. 4
      src/effect/ColorAberration.php
  7. 4
      src/effect/ColorLUT.php
  8. 4
      src/effect/IrradianceContourLines.php
  9. 4
      src/effect/Mist.php
  10. 4
      src/effect/NoiseReducerBCD.php
  11. 4
      src/effect/NoiseReducerOIDN.php
  12. 4
      src/effect/Pretreatment.php
  13. 4
      src/effect/Synthesis.php
  14. 4
      src/effect/ToneMapAutoLinear.php
  15. 4
      src/effect/ToneMapCamera.php
  16. 4
      src/effect/ToneMapLinear.php
  17. 4
      src/effect/ToneMapReinhard.php
  18. 4
      src/effect/Vignetting.php
  19. 4
      src/effect/WhiteBalance.php
  20. 3
      src/file/ImageSaverBase.php
  21. 2
      src/file/ImageSaverNumber.php
  22. 3
      src/scene/BaseCfg.php
  23. 36
      src/scene/Batch.php
  24. 21
      src/scene/CammaCorrection.php
  25. 20
      src/scene/Film.php
  26. 6
      src/scene/Filter.php
  27. 31
      src/scene/HaltThresHold.php
  28. 4
      src/scene/HybridBackforWard.php
  29. 2
      src/scene/Native.php
  30. 2
      src/scene/OpenCL.php
  31. 3
      src/scene/Path.php
  32. 2
      src/scene/Sampler.php
  33. 26
      src/scene/Scene.php

32
examples/print.php

@ -4,9 +4,10 @@
namespace Blobt\Luxcore\scene; namespace Blobt\Luxcore\scene;
include dirname(dirname(__FILE__)) . "/vendor/autoload.php"; include dirname(dirname(__FILE__)) . "/vendor/autoload.php";
use Blobt\Luxcore\file;
use Blobt\Luxcore\effect;
/*
//设置打印渲染引擎的配置参数 //设置打印渲染引擎的配置参数
$renderEngine = new RenderEngine(); $renderEngine = new RenderEngine();
echo $renderEngine; echo $renderEngine;
@ -15,17 +16,12 @@ echo $renderEngine;
$openCL = new OpenCL(); $openCL = new OpenCL();
echo $openCL; echo $openCL;
//设置打印GPU渲染设备的配置参数
$native = new Native(['threadsCount' => 64]);
echo $native;
//设置打印光线跟踪的配置参数 //设置打印光线跟踪的配置参数
$path = new Path(['glossinessthreshold' => 0.999]);
$path = new Path();
echo $path; echo $path;
//设置打印 采样器 配置参数 //设置打印 采样器 配置参数
$sampler = new Sampler(['imagemutationrate' => 0.888]);
$sampler->random->overlapping = 32;
$sampler = new Sampler();
echo $sampler; echo $sampler;
//设置打印 灯光策略 配置参数 //设置打印 灯光策略 配置参数
@ -35,15 +31,25 @@ echo $lightStrategy;
//设置打印 文件储存格式 配置参数 //设置打印 文件储存格式 配置参数
$filesaver = new FileSaver(); $filesaver = new FileSaver();
echo $filesaver; echo $filesaver;
*/
//设置打印 渲染终止 配置参数
$batch = new Batch();
$batch->useNoiseThreshold();
echo $batch;
//设置打印 场景属性 配置参数
$scene = new Scene();
echo $scene;
//设置打印 “胶片” 配置参数 //设置打印 “胶片” 配置参数
$film = new Film(); $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; echo $film;
?> ?>

src/scene/AnalogFilmSimulation.php → src/effect/AnalogFilmSimulation.php

src/scene/BackgroundImg.php → src/effect/BackgroundImg.php

src/scene/Bloom.php → src/effect/Bloom.php

21
src/effect/CammaCorrection.php

@ -0,0 +1,21 @@
<?php
namespace Blobt\Luxcore\effect;
use Blobt\Luxcore\scene\BaseCfg;
class CammaCorrection extends BaseCfg
{
/**
* @var string 颜色映射类型为 gamma2.2校正,(固定取值:GAMMA_CORRECTION)
*/
public $type = "GAMMA_CORRECTION";
/**
* @var float gamma值,(取值:0-100的小数)
*/
public $value = 2.2;
}
?>

src/scene/ColorAberration.php → src/effect/ColorAberration.php

src/scene/ColorLUT.php → src/effect/ColorLUT.php

src/scene/IrradianceContourLines.php → src/effect/IrradianceContourLines.php

src/scene/Mist.php → src/effect/Mist.php

src/scene/NoiseReducerBCD.php → src/effect/NoiseReducerBCD.php

src/scene/NoiseReducerOIDN.php → src/effect/NoiseReducerOIDN.php

src/scene/Pretreatment.php → src/effect/Pretreatment.php

src/scene/Synthesis.php → src/effect/Synthesis.php

src/scene/ToneMapAutoLinear.php → src/effect/ToneMapAutoLinear.php

src/scene/ToneMapCamera.php → src/effect/ToneMapCamera.php

src/scene/ToneMapLinear.php → src/effect/ToneMapLinear.php

src/scene/ToneMapReinhard.php → src/effect/ToneMapReinhard.php

src/scene/Vignetting.php → src/effect/Vignetting.php

src/scene/WhiteBalance.php → src/effect/WhiteBalance.php

src/scene/ImageSaverBase.php → src/file/ImageSaverBase.php

src/scene/ImageSaverNumber.php → src/file/ImageSaverNumber.php

3
src/scene/BaseCfg.php

@ -77,7 +77,8 @@ class BaseCfg extends Base
} }
else if(is_null($value)) else if(is_null($value))
{ {
$ret .= "{$className}.{$name} = \"null\"\n";
//$ret .= "{$className}.{$name} = \"null\"\n";
$ret = $ret;
} }
else if(is_float($value)) else if(is_float($value))
{ {

36
src/scene/Batch.php

@ -0,0 +1,36 @@
<?php
namespace Blobt\Luxcore\scene;
use Blobt\Luxcore\core\Base;
class Batch extends BaseCfg
{
/**
* @var integer 采样次数,(取值:大于0的整数)
*/
public $haltspp = 500;
/**
* @var integer 渲染的时间,单位秒,(取值:大于0的整数)
*/
public $halttime = 0;
/**
* @var float 噪波阈值,(取值:浮点型色值)
*/
public $haltthreshold = 0.02;
/**
* @var object 存储一个 haltThresHold类 对象
*/
public $haltthresholdcfg;
public function useNoiseThreshold($config= [])
{
$this->haltthresholdcfg = new HaltThresHold($config);
}
}
?>

21
src/scene/CammaCorrection.php

@ -1,21 +0,0 @@
<?php
namespace Blobt\Luxcore\scene;
class CammaCorrection extends BaseCfg
{
/**
* @var string 颜色映射类型为 线性倍增,(固定取值:TONEMAP_LINEAR)
*/
public $type = "GAMMA_CORRECTION";
/**
* @var float 亮度增益,(取值:0-100的小数)
*/
public $value = 2.2;
}
?>

20
src/scene/Film.php

@ -2,6 +2,8 @@
namespace Blobt\Luxcore\scene; namespace Blobt\Luxcore\scene;
use Blobt\Luxcore\core\Base; use Blobt\Luxcore\core\Base;
use Blobt\Luxcore\file;
use Blobt\Luxcore\effect;
class Film extends BaseCfg class Film extends BaseCfg
{ {
@ -16,6 +18,9 @@ class Film extends BaseCfg
*/ */
public $filter; public $filter;
/** /**
* 渲染图像的宽度,单位像素(取值:大于0的整数) * 渲染图像的宽度,单位像素(取值:大于0的整数)
*/ */
@ -36,6 +41,9 @@ class Film extends BaseCfg
*/ */
public $openclDevice = 0; public $openclDevice = 0;
/** /**
* @var array 渲染图像后期处理配置参数 * @var array 渲染图像后期处理配置参数
*/ */
@ -55,14 +63,14 @@ class Film extends BaseCfg
$this->noiseEstimation = new NoiseEstimation($config); $this->noiseEstimation = new NoiseEstimation($config);
$this->filter = new Filter($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); Base::__construct($config);
} }

6
src/scene/Filter.php

@ -17,7 +17,7 @@ class Filter extends BaseCfg
/** /**
* @var string 使用何种抗锯齿类型 * @var string 使用何种抗锯齿类型
*/ */
public $type = self::TYPE_NONE;
public $type = self::TYPE_BLACKMANHARRIS;
/** /**
* @var float 边缘抗锯齿宽度,单位像素(取值:大于0的数浮点数) * @var float 边缘抗锯齿宽度,单位像素(取值:大于0的数浮点数)
@ -27,12 +27,12 @@ class Filter extends BaseCfg
/** /**
* @var float 高斯类型抗锯齿过滤器的透明度(取值:0.10-10的浮点数) * @var float 高斯类型抗锯齿过滤器的透明度(取值:0.10-10的浮点数)
*/ */
public $gaussianAlpha = 2;
public $gaussianAlpha;
/** /**
* @var float “SINC”类型抗锯齿过滤器的参数,TODO:具体作用尚不明确,(取值:0.10-8的浮点数) * @var float “SINC”类型抗锯齿过滤器的参数,TODO:具体作用尚不明确,(取值:0.10-8的浮点数)
*/ */
public $sincTau = 1;
public $sincTau;
} }

31
src/scene/HaltThresHold.php

@ -0,0 +1,31 @@
<?php
namespace Blobt\Luxcore\scene;
use Blobt\Luxcore\core\Base;
class HaltThresHold extends BaseCfg
{
/**
* @var integer TODO:具体作用尚未明确,(取值:大于1的整数)
*/
public $hwarmup = 64;
/**
* @var integer TODO:具体作用尚未明确,(取值:大于16的整数)
*/
public $step = 64;
/**
* @var bool TODO:具体作用尚未明确,(默认取值:true)
*/
public $filterEnable = true;
/**
* bool 当渲染器状态达到此类参数设置的值,是否停止渲染,(默认取值:true)
*/
public $stoprenderingEnable = true;
}
?>

4
src/scene/HybridBackforWard.php

@ -13,12 +13,12 @@ class HybridBackforWard extends BaseCfg
/** /**
* @var float 设置 不跟踪光线 所占最大百分比 (取值:0-1 * @var float 设置 不跟踪光线 所占最大百分比 (取值:0-1
*/ */
public $partition = 0.8;
public $partition = 0;
/** /**
* @var float设置区分图像的 平坦区域和非平坦区域 的阀值 (取值:0-1 * @var float设置区分图像的 平坦区域和非平坦区域 的阀值 (取值:0-1
*/ */
public $glossinessthreshold = 0.45;
public $glossinessthreshold = 0.05;
} }

2
src/scene/Native.php

@ -8,7 +8,7 @@ class Native extends BaseCfg
/** /**
* @var integer //使用多少线程数(取值范围: 大于或等于1的整数) * @var integer //使用多少线程数(取值范围: 大于或等于1的整数)
*/ */
public $threadsCount = 4;
public $threadsCount;
} }

2
src/scene/OpenCL.php

@ -23,7 +23,7 @@ class OpenCL extends BaseCfg
/** /**
* @var integral GPU渲染模式下,设置CPU是否渲染和多少线程渲染(取值范围: 大于或等于0的整数) * @var integral GPU渲染模式下,设置CPU是否渲染和多少线程渲染(取值范围: 大于或等于0的整数)
*/ */
public $nativeThreadsCount = 4;
public $nativeThreadsCount;
/** /**

3
src/scene/Path.php

@ -16,6 +16,9 @@ class Path extends BaseCfg
*/ */
public $hybridBackforWard; public $hybridBackforWard;
/** /**
* @var bool 是否限制 单象素光线 最大跟踪数量 * @var bool 是否限制 单象素光线 最大跟踪数量
*/ */

2
src/scene/Sampler.php

@ -38,8 +38,6 @@ class Sampler extends BaseCfg
public function __construct($config = []) public function __construct($config = [])
{ {
$this->sobol = new Sobol($config); $this->sobol = new Sobol($config);
$this->random = new Random($config);
$this->metropolis = new Metropolis($config);
Base::__construct($config); Base::__construct($config);
} }

26
src/scene/Scene.php

@ -0,0 +1,26 @@
<?php
namespace Blobt\Luxcore\scene;
use Blobt\Luxcore\core\Base;
class Scene extends BaseCfg
{
/**
* @var string 设置场景文件名
*/
public $file = 'scene.scn';
/**
* @var float TODO:具体作用尚未明确,(默认取值:1e-05
*/
public $epsilonMin = 1e-05;
/**
* @var float TODO:具体作用尚未明确,(默认取值:0.1
*/
public $epsilonMax = 0.1;
}
?>
Loading…
Cancel
Save