Blender渲染
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

132 lines
4.1 KiB

  1. <?php
  2. namespace Blobt\Luxcore\scene;
  3. include dirname(dirname(__FILE__)) . "/vendor/autoload.php";
  4. echo '>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>渲染配置参数>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>';
  5. echo "\n\n\n\n";
  6. /*
  7. //设置打印 渲染引擎 的配置参数
  8. $renderEngine = new render\RenderEngine();
  9. echo $renderEngine;
  10. //设置打印GPU渲染设备的配置参数
  11. $openCL = new render\OpenCL();
  12. echo $openCL;
  13. //设置打印光线跟踪的配置参数
  14. $path = new render\Path();
  15. echo $path;
  16. //设置打印 采样器 配置参数
  17. $sampler = new render\Sampler();
  18. echo $sampler;
  19. //设置打印 灯光策略 配置参数
  20. $lightStrategy = new render\LightStrategy();
  21. echo $lightStrategy;
  22. //设置打印 文件储存格式 配置参数
  23. $filesaver = new render\FileSaver();
  24. echo $filesaver;
  25. //设置打印 渲染终止 配置参数
  26. $batch = new render\Batch();
  27. echo $batch;
  28. //设置打印 场景属性 配置参数
  29. $scene = new render\Scene();
  30. echo $scene;
  31. //设置打印 “胶片” 配置参数
  32. $film = new render\Film();//添加一个胶片,
  33. $img = new render\Image();
  34. $img->effect = [new render\effect\Pretreatment(),new render\effect\ToneMapLinear(),new render\effect\CammaCorrection()];
  35. $film->addImage($img);
  36. $film->addImage(new render\Image(['type' => 'ALBEDO']));
  37. $film->addImage(new render\Image(['type' => 'AVG_SHADING_NORMAL']));
  38. $img = new render\Image();
  39. $img->effect = [new render\effect\NoiseReducerOIDN(),new render\effect\Pretreatment(),new render\effect\ToneMapLinear(),new render\effect\CammaCorrection()];
  40. $film->addImage($img);
  41. echo $film;
  42. */
  43. echo "\n\n\n\n";
  44. echo '>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>场景配置参数>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>';
  45. echo "\n\n\n\n";
  46. $scene = new Scene();//创建一个场景,
  47. //添加第一个模型
  48. $obj = new objects\Objects( [ 'ply' => 'mesh-10086.ply','appliedtransformation' => '1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1' ] ); //创建一个的模型
  49. $cloudsMap = new texture\map\Clouds(); //创建一个 Clouds类的贴图对象
  50. $scene->registerTexture($cloudsMap); //将这个对象注册到 Scene
  51. $imageMap = new texture\map\ImageMap(); //创建一个 ImageMap类的贴图对象
  52. $scene->registerTexture($imageMap); //将这个对象注册到 Scene
  53. $blend = new texture\map\Blend(); //创建一个 Blend类的贴图对象
  54. $scene->registerTexture($blend); //将这个对象注册到 Scene
  55. $disney = new materials\Disney(); //创建一个 Disney 材质对象
  56. $disney->setBaseColor($cloudsMap); //为 basecolor 指定一个贴图对象,如果这个对象没有注册到Scene,则 set函数抛出异常,以下同理
  57. $disney->setMetallic($blend);
  58. $disney->setBumptex($imageMap);
  59. $scene->registerMaterial($disney); //将这个对象注册到 Scene
  60. $metal = new materials\Metal(); //创建一个 Disney 材质对象
  61. $metal->setRefraction($imageMap);
  62. $metal->setBumptex($cloudsMap);
  63. $scene->registerMaterial($metal); //将这个对象注册到 Scene
  64. $mix = new materials\Mix(); //创建 Mix 材质对象
  65. $mix->setMaterial1($disney); //为材质通道1 指定一个键名
  66. $mix->setMaterial2($metal); //为材质通道2 指定一个键名
  67. $mix->setAmount($blend ); //指定混合系数为 0.6
  68. $scene->registerMaterial($mix); //将这个对象注册到 Scene
  69. $obj->setMaterial($mix) ; //为模型的指定一个混合材质
  70. $scene->registerObjects($obj); //将模型添加到场景中
  71. // //添加第二个模型
  72. // $obj = new objects\Objects( [ 'ply' => 'mesh-119.ply','appliedtransformation' => '1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1' ] ); //创建一个的模型,
  73. // $obj->material = new materials\Metal( ['fresnel' => "2517393611944Fresnel"] ); //为模型创建一个 金属 类型的材质
  74. // $scene->addObject($obj); //将模型添加到场景中
  75. echo $scene;
  76. ?>