|
|
@ -245,74 +245,74 @@ foreach($taskModel->childsParams as $childParams){ |
|
|
|
|
|
|
|
|
|
|
|
// 三、创建相机
|
|
|
|
$camera = new camera\Perspective( // 创建一个相机
|
|
|
|
$camera = new camera\Perspective( |
|
|
|
[ |
|
|
|
'autovolumeEnable' => 0, // 关闭自动体积效果
|
|
|
|
'lookatOrig' => "-3.197486 -4.560584 0.8914337", // 视点坐标位置
|
|
|
|
'lookatTarget' => "-2.632151 -3.747173 0.7544713", // 目标点坐标位置
|
|
|
|
'up' => "0.0781663 0.1124666 0.9905763", // 旋转参数
|
|
|
|
'screenwindow' => "-1 1 -1 1", // 视野比例
|
|
|
|
'autofocusEnable' => 0, // 关闭自动对焦
|
|
|
|
'fieldofview' => 3.40608, // 视野角度大小
|
|
|
|
'cliphither' => 0.1 // 剪切成像起始位置,单位跟随系统
|
|
|
|
'autovolumeEnable' => 0, |
|
|
|
'lookatOrig' => "-3.197486 -4.560584 0.8914337", |
|
|
|
'lookatTarget' => "-2.632151 -3.747173 0.7544713", |
|
|
|
'up' => "0.0781663 0.1124666 0.9905763", |
|
|
|
'screenwindow' => "-1 1 -1 1", |
|
|
|
'autofocusEnable' => 0, |
|
|
|
'fieldofview' => 3.40608, |
|
|
|
'cliphither' => 0.1 |
|
|
|
] |
|
|
|
); |
|
|
|
$camera->bokeh->blades = 0; // 模拟镜头模糊效果的光圈数
|
|
|
|
$scene->registerCamera($camera); // 将相机注册到 scene 中
|
|
|
|
$camera->bokeh->blades = 0; |
|
|
|
$scene->registerCamera($camera); |
|
|
|
|
|
|
|
|
|
|
|
// 四、设置渲染参数
|
|
|
|
$render = ''; |
|
|
|
$renderEngine = new RenderEngine(); // 设置 渲染引擎 的配置参数,默认使用了 PATHOCL,意义着将使用 GPU 设备渲染
|
|
|
|
$renderEngine = new RenderEngine(); |
|
|
|
$render .= $renderEngine; |
|
|
|
|
|
|
|
$openCL = new OpenCL(); // 设置 GPU 渲染参数,这里使用一个默认的参数
|
|
|
|
$openCL = new OpenCL(); |
|
|
|
$render .= $openCL; |
|
|
|
|
|
|
|
$path = new Path(); // 设置 光线跟踪 参数,这里使用一个默认的参数
|
|
|
|
$path = new Path(); |
|
|
|
$render .= $path; |
|
|
|
|
|
|
|
$sampler = new Sampler(); // 设置 采样器 配置参数,默认使用 Sobol 类型的自适应采样器
|
|
|
|
$sampler = new Sampler(); |
|
|
|
$render .= $sampler; |
|
|
|
|
|
|
|
$lightStrategy = new LightStrategy(); // 设置 灯光策略 类型,默认使用 LOG_POWER 类型
|
|
|
|
$lightStrategy = new LightStrategy(); |
|
|
|
$render .= $lightStrategy; |
|
|
|
|
|
|
|
$filesaver = new FileSaver(); // 设置 文件储存格式 配置参数
|
|
|
|
$filesaver = new FileSaver(); |
|
|
|
$render .= $filesaver; |
|
|
|
|
|
|
|
$batch = new Batch(); // 设置 渲染终止 参数,
|
|
|
|
$batch->haltspp = 1000; // 设置 每像素 采样达 800 则终止渲染
|
|
|
|
// $batch->halttime = 2000; // 设置 渲染 超时参数,
|
|
|
|
$batch = new Batch(); |
|
|
|
$batch->haltspp = 1000; |
|
|
|
// $batch->halttime = 2000;
|
|
|
|
$render .= $batch; |
|
|
|
|
|
|
|
$sceneCfg = new render\Scene(); // 设置 场景属性 参数
|
|
|
|
$sceneCfg = new render\Scene(); |
|
|
|
$render .= $sceneCfg; |
|
|
|
|
|
|
|
|
|
|
|
$film = new Film(); // 添加一个渲染胶片
|
|
|
|
$film->width = 3000; // 设置渲染胶片宽度,单位像素
|
|
|
|
$film->heigth = 3000; // 设置渲染胶片宽度,单位像素
|
|
|
|
$img = new Image(); // 添加一个图像输出
|
|
|
|
$film = new Film(); |
|
|
|
$film->width = 3000; |
|
|
|
$film->heigth = 3000; |
|
|
|
$img = new Image(); |
|
|
|
$img->effect = [new Pretreatment(),new ToneMapLinear(),new CammaCorrection()]; |
|
|
|
// 为该图像添加效果管线
|
|
|
|
$film->addImage($img); // 将该图像输出添加到渲染胶片
|
|
|
|
|
|
|
|
$film->addImage(new Image(['type' => Image::TYPE_OBJECT_ID])); // 为渲染胶片添加一个 通道图类型 的图像输出
|
|
|
|
$film->addImage(new Image(['type' => Image::TYPE_RGBA])); // 添加一个 透明底 的图像输出
|
|
|
|
|
|
|
|
$img = new Image(); // 添加一个图像输出,使用默认参数
|
|
|
|
$img->effect[] = new NoiseReducerOIDN(); // 添加降噪效果管线,使用默认参数
|
|
|
|
$img->effect[] = new Pretreatment(); //
|
|
|
|
$img->effect[] = new ToneMapLinear(); // 添加一亮度效果管线,使用默认参数
|
|
|
|
$img->effect[] = new Synthesis(); // 添加一个合成效果管线,使用默认参数
|
|
|
|
$img->effect[] = new BackgroundImg( // 添加一个背景图像,使用默认参数
|
|
|
|
|
|
|
|
$film->addImage($img, $sceneTemplatePath); |
|
|
|
|
|
|
|
$film->addImage(new Image(['type' => Image::TYPE_OBJECT_ID]), $sceneTemplatePath); |
|
|
|
$film->addImage(new Image(['type' => Image::TYPE_RGBA]), $sceneTemplatePath); |
|
|
|
|
|
|
|
$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 render\effect\CammaCorrection(); // 添加一个 gamma 校正,,使用默认参数
|
|
|
|
$film->addImage($img); // 将该图像输出添加到渲染胶片
|
|
|
|
$img->effect[] = new CammaCorrection(); |
|
|
|
$film->addImage($img, $sceneTemplatePath); |
|
|
|
$render .= $film; |
|
|
|
|
|
|
|
|
|
|
|