Browse Source

渲染测式 案例 开发

master
yuanjiajia 1 year ago
parent
commit
d48386bee9
  1. 96
      examples/renderTest.php
  2. 2
      src/scene/render/Batch.php
  3. 4
      src/scene/render/Path.php
  4. 2
      src/scene/render/cache/lightStrategy/Entry.php
  5. 2
      src/scene/render/cache/lightStrategy/LightStrategy.php
  6. 2
      src/scene/render/cache/photonGI/Caustic.php
  7. 2
      src/scene/render/cache/photonGI/Indirect.php
  8. 2
      src/scene/render/cache/photonGI/PhotonGI.php

96
examples/renderTest.php

@ -20,6 +20,7 @@ use Blobt\Luxcore\scene\render\FileSaver;
use Blobt\Luxcore\scene\render\Film;
use Blobt\Luxcore\scene\render\Image;
use Blobt\Luxcore\scene\render\LightStrategy;
use Blobt\Luxcore\scene\render\Native;
use Blobt\Luxcore\scene\render\OpenCL;
use Blobt\Luxcore\scene\render\Path;
use Blobt\Luxcore\scene\render\RenderEngine;
@ -268,63 +269,94 @@ $camera = new camera\Perspective(
'cliphither' => 0.1,
]
);
$camera->bokeh->blades = 0;
$scene->registerCamera($camera);
$camera->bokeh->blades = 0;
$scene->registerCamera($camera);
// 四、设置渲染参数
// // gpu 渲染
// $render = '';
// $renderEngine = new RenderEngine();
// $render .= $renderEngine;
// $openCL = new OpenCL();
// $render .= $openCL;
// $lightStrategy = new LightStrategy();
// $render .= $lightStrategy;
// $path = new Path();
// $render .= $path;
// $sampler = new Sampler();
// $render .= $sampler;
// $filesaver = new FileSaver();
// $render .= $filesaver;
// $batch = new Batch();
// $batch->haltspp = 200;
// // $batch->halttime = 2000;
// $render .= $batch;
// $sceneCfg = new render\Scene();
// $render .= $sceneCfg;
// cpu 渲染
$render = '';
$renderEngine = new RenderEngine();
$renderEngine = new RenderEngine();
$renderEngine->type = RenderEngine::TYPE_PATHCPU;
$render .= $renderEngine;
$openCL = new OpenCL();
$render .= $openCL;
$native = new Native();
$render .= $native;
$lightStrategy = new LightStrategy();
$render .= $lightStrategy;
$path = new Path();
$render .= $path;
$path = new Path();
$render .= $path;
$sampler = new Sampler();
$sampler = new Sampler();
$render .= $sampler;
$lightStrategy = new LightStrategy();
$render .= $lightStrategy;
$filesaver = new FileSaver();
$filesaver = new FileSaver();
$filesaver->renderengineType = FileSaver::TYPE_PATHCPU;
$render .= $filesaver;
$batch = new Batch();
$batch->haltspp = 200;
// $batch->halttime = 2000;
$batch = new Batch();
$batch->haltspp = 200;
// $batch->halttime = 2000;
$render .= $batch;
$sceneCfg = new render\Scene();
$sceneCfg = new render\Scene();
$render .= $sceneCfg;
// 图像输出设置
$imageOutPath = $sceneTemplatePath.'/imageOut';
$film = new Film();
$film->width = 1024;
$film->heigth = 1024;
$img = new Image();
$film = new Film();
$film->width = 1024;
$film->heigth = 1024;
$img = new Image();
$img->effect = [new Pretreatment(),new ToneMapLinear(),new CammaCorrection()];
$film->addImage($img, $imageOutPath);
$film->addImage($img, $imageOutPath);
$film->addImage(new Image(['type' => Image::TYPE_OBJECT_ID]), $imageOutPath);
$film->addImage(new Image(['type' => Image::TYPE_RGBA]), $imageOutPath);
$film->addImage(new Image(['type' => Image::TYPE_OBJECT_ID]), $imageOutPath);
$film->addImage(new Image(['type' => Image::TYPE_RGBA]), $imageOutPath);
$img = new Image();
$img->effect[] = new NoiseReducerOIDN();
$img->effect[] = new Pretreatment();
$img->effect[] = new ToneMapLinear();
$img->effect[] = new Synthesis();
$img = new Image();
$img->effect[] = new NoiseReducerOIDN();
$img->effect[] = new Pretreatment();
$img->effect[] = new ToneMapLinear();
$img->effect[] = new Synthesis();
$img->effect[] = new BackgroundImg(
[
'file' => "./map/纯白242.png"
]
);
$img->effect[] = new CammaCorrection();
$film->addImage($img, $imageOutPath);
$img->effect[] = new CammaCorrection();
$film->addImage($img, $imageOutPath);
$render .= $film;

2
src/scene/render/Batch.php

@ -7,7 +7,7 @@ class Batch extends BaseCfg
{
/**
* @var string 每像素光线跟踪平均采样数 每像素光线跟踪自适应采样数,取值:一组大于等于0的分别表示 每像素光线跟踪平均采样数
* @var string 每像素光线跟踪采样数 每像素光线跟踪自适应采样数,取值:一组大于等于0的分别表示 每像素光线跟踪平均采样数
* 每像素光线跟踪自适应采样数 整数值字符串,0表示不启用这个参数,大于0表示启这个参数,其中,必须在 光线跟踪 参数中启
* 光线跟踪自适应采样数量 时, 每像素光线跟踪自适应采样数量 参数才可以设置大于零的整数。
* 1、不启用噪波阈值状态下,如果渲染图像已满足采样条件,则触发终止渲染。

4
src/scene/render/Path.php

@ -23,12 +23,14 @@ class Path extends BaseCfg
/**
* @var bool 是否限制 每个象素 最高亮度,开启可减少画面过亮的荧火虫现象。
* @var bool 是否限制 每个象素 最高亮度,开启可减少画面过亮的荧火虫现象;
* 在全局光调试模式下不需要输出这些字符串。
*/
public $forceblackbackgroundEnable = self::OPEN;
/**
* @var float 每个像素 最高亮度 (取值:大于0的HDR灰度值)
* 在全局光调试模式下不需要输出这些字符串。
*/
public $clampingVarianceMaxvalue = 1000;

src/scene/render/cache/Entry.php → src/scene/render/cache/lightStrategy/Entry.php

src/scene/render/cache/LightStrategy.php → src/scene/render/cache/lightStrategy/LightStrategy.php

src/scene/render/cache/Caustic.php → src/scene/render/cache/photonGI/Caustic.php

src/scene/render/cache/Indirect.php → src/scene/render/cache/photonGI/Indirect.php

src/scene/render/cache/PhotonGI.php → src/scene/render/cache/photonGI/PhotonGI.php

Loading…
Cancel
Save