diff --git a/examples/renderTest.php b/examples/renderTest.php index cc66a13..84a0499 100644 --- a/examples/renderTest.php +++ b/examples/renderTest.php @@ -7,17 +7,169 @@ use GuzzleHttp\Client; include dirname(dirname(__FILE__)) . "/vendor/autoload.php"; +const OPEN = true; +const CLOSE = false; + -// 创建一个场景 -// $scene = new Scene(); $client = new Client(); $response = $client->get("deep3d.backend-api.dev.com/test/render-task"); - $resContents = $response->getBody()->getContents(); - $resData = json_decode($resContents); -print_r($resData->data->scene); + + + + +// 创建一个场景; +$scene = new Scene(); + + +// 一、创建光场: +// 1、创建 面片光001 +$materials = new materials\Matte(); +$materials->setBaseColor('0 0 0'); +$materials->setTransparencyShadow('1 1 1'); +$materials->setEmission('1 1 1'); +$scene->registerMaterial($materials); +$obj = new objects\Objects(); +$obj->ply = './ply/FaceLight001.ply'; +$obj->setMaterial($materials); +$scene->registerObjects($obj); + +// 2、创建 面片光002 +$materials = new materials\Matte(); +$materials->setBaseColor('0 0 0'); +$materials->setTransparencyShadow('1 1 1'); +$materials->setEmission('0 0 0'); +$materials->emissionCfg = new lights\Emission([ + 'gain' => "30 30 30", +]); +$scene->registerMaterial($materials); +$obj = new objects\Objects(); +$obj->ply = './ply/FaceLight002.ply'; +$obj->setMaterial($materials); +$scene->registerObjects($obj); + +// 3、创建 面片光003 +$materials = new materials\Matte(); +$materials->setBaseColor('0 0 0'); +$materials->setTransparencyShadow('1 1 1'); +$materials->setEmission('1 1 1'); +$materials->emissionCfg = new lights\Emission([ + 'gain' => "50 50 50", +]); +$scene->registerMaterial($materials); +$obj = new objects\Objects(); +$obj->ply = './ply/FaceLight003.ply'; +$obj->setMaterial($materials); +$scene->registerObjects($obj); + +// 4、创建 面片光004 +$materials = new materials\Matte(); +$materials->setBaseColor('0 0 0'); +$materials->setTransparencyShadow('1 1 1'); +$materials->setEmission('0 0 0'); +$materials->emissionCfg = new lights\Emission([ + 'gain' => "4 4 4", +]); +$scene->registerMaterial($materials); +$obj = new objects\Objects(); +$obj->ply = './ply/FaceLight004.ply'; +$obj->setMaterial($materials); +$scene->registerObjects($obj); + +// 5、创建 面片光005 +$materials = new materials\Matte(); +$materials->setBaseColor('0 0 0'); +$materials->setTransparencyShadow('1 1 1'); +$materials->setEmission('1 1 1'); +$materials->emissionCfg = new lights\Emission([ + 'gain' => "10 10 10", +]); +$scene->registerMaterial($materials); +$obj = new objects\Objects(); +$obj->ply = './ply/FaceLight005.ply'; +$obj->setMaterial($materials); +$scene->registerObjects($obj); + +// 6、创建 面片光006 +$materials = new materials\Matte(); +$materials->setBaseColor('0 0 0'); +$materials->setTransparencyShadow('1 1 1'); +$materials->setEmission('1 1 1'); +$materials->emissionCfg = new lights\Emission([ + 'gain' => "8 8 8", + 'mapfile' => "./map/SD-037.exr", + 'gamma' => 1, + 'storage' => "float" +]); +$scene->registerMaterial($materials); +$obj = new objects\Objects(); +$obj->ply = './ply/FaceLight006.ply'; +$obj->setMaterial($materials); +$scene->registerObjects($obj); + +// 7、创建 面片光000 +$materials = new materials\Matte(); +$materials->setBaseColor('0 0 0'); +$materials->setTransparencyShadow('1 1 1'); +$materials->setEmission('1 1 1'); +$materials->emissionCfg = new lights\Emission([ + 'gain' => "3.3 3.3 3.3", +]); +$scene->registerMaterial($materials); +$obj = new objects\Objects(); +$obj->ply = './ply/FaceLight000.ply'; +$obj->setMaterial($materials); +$scene->registerObjects($obj); + +// 8、创建环境光 +$light = new lights\env\HdrImage([ + 'gain' => "1.25 1.25 1.25", + 'transformation' => "0.1736481 -0.9848078 0 0 -0.9848078 -0.1736481 0 0 0 0 1 0 0 0 0 1", + 'file' => "./map/env.png", + 'gamma' => 1, + 'storage' => "byte" +]); +$light->id = 0; +$scene->registerLight($light); + +// 9、创建地面模型 +$mapping = new texture\mapping\Mapping(); +$mapping->useUVMapping2d(0, "0", "0.4 -0.966", "0.3 0.983"); +$texture = new texture\procedural\ImageMap([ + 'file' => "./map/方形阴影遮照.png", + 'gain' => 0.6, + 'gamma' => 1, +]); +$texture->mapping = $mapping; +$scene->registerTexture($texture); +$materials = new materials\Disney([ + 'shadowcatcherEnable' => OPEN, + 'photongiEnable' => CLOSE +]); +$materials->setBaseColor('1 1 1'); +$materials->setTransparencyFront($texture); +$materials->setTransparencyBack($texture); +$scene->registerMaterial($materials); +$obj = new objects\Objects(); +$obj->ply = './ply/ground.ply'; +$obj->setMaterial($materials); +$scene->registerObjects($obj); + + +// 二、添加要渲染的模型 +$loadModel = $resData->data->scene->model; +$loadCamera = $resData->data->scene->camera; + +foreach($loadModel->childsParams as $childParams){ + print_r($childParams); +} + + + + + ?> diff --git a/sceneTemplate/map/SD-037.exr b/sceneTemplate/map/SD-037.exr new file mode 100644 index 0000000..e5c2782 Binary files /dev/null and b/sceneTemplate/map/SD-037.exr differ diff --git a/sceneTemplate/map/env.png b/sceneTemplate/map/env.png new file mode 100644 index 0000000..b0aa992 Binary files /dev/null and b/sceneTemplate/map/env.png differ diff --git a/sceneTemplate/map/方形阴影遮照.png b/sceneTemplate/map/方形阴影遮照.png new file mode 100644 index 0000000..e7b06d2 Binary files /dev/null and b/sceneTemplate/map/方形阴影遮照.png differ diff --git a/sceneTemplate/map/纯白242.png b/sceneTemplate/map/纯白242.png new file mode 100644 index 0000000..6aa89c9 Binary files /dev/null and b/sceneTemplate/map/纯白242.png differ diff --git a/sceneTemplate/ply/FaceLight000.ply b/sceneTemplate/ply/FaceLight000.ply new file mode 100644 index 0000000..f9016aa Binary files /dev/null and b/sceneTemplate/ply/FaceLight000.ply differ diff --git a/sceneTemplate/ply/FaceLight001.ply b/sceneTemplate/ply/FaceLight001.ply new file mode 100644 index 0000000..2f6b86a Binary files /dev/null and b/sceneTemplate/ply/FaceLight001.ply differ diff --git a/sceneTemplate/ply/FaceLight002.ply b/sceneTemplate/ply/FaceLight002.ply new file mode 100644 index 0000000..512c083 Binary files /dev/null and b/sceneTemplate/ply/FaceLight002.ply differ diff --git a/sceneTemplate/ply/FaceLight003.ply b/sceneTemplate/ply/FaceLight003.ply new file mode 100644 index 0000000..8b1649a Binary files /dev/null and b/sceneTemplate/ply/FaceLight003.ply differ diff --git a/sceneTemplate/ply/FaceLight004.ply b/sceneTemplate/ply/FaceLight004.ply new file mode 100644 index 0000000..40e3ce4 Binary files /dev/null and b/sceneTemplate/ply/FaceLight004.ply differ diff --git a/sceneTemplate/ply/FaceLight005.ply b/sceneTemplate/ply/FaceLight005.ply new file mode 100644 index 0000000..8c8a94d Binary files /dev/null and b/sceneTemplate/ply/FaceLight005.ply differ diff --git a/sceneTemplate/ply/FaceLight006.ply b/sceneTemplate/ply/FaceLight006.ply new file mode 100644 index 0000000..b34ac23 Binary files /dev/null and b/sceneTemplate/ply/FaceLight006.ply differ diff --git a/sceneTemplate/ply/ground.ply b/sceneTemplate/ply/ground.ply new file mode 100644 index 0000000..dbd017b Binary files /dev/null and b/sceneTemplate/ply/ground.ply differ diff --git a/src/scene/materials/MaterialsBase.php b/src/scene/materials/MaterialsBase.php index f95a1f6..ad1ba28 100644 --- a/src/scene/materials/MaterialsBase.php +++ b/src/scene/materials/MaterialsBase.php @@ -18,7 +18,7 @@ class MaterialsBase extends BaseCfg const TYPE_METAL = 'metal2'; //金属度流程的金属材质 - const TYPE_MIRROR = 'mirror'; //镜面材质,金属度 + const TYPE_MIRROR = 'mirror'; //镜面材质,金属度流程