diff --git a/CMakeLists.txt b/CMakeLists.txt index 020bf4c..622e443 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.12) project(MiyukiRenderer) @@ -66,21 +66,22 @@ file(GLOB libcoreSource src/core/*.cpp IF(USE_EMBREE) - add_compile_definitions(MYK_USE_EMBREE) IF(EMBREE_FROM_SOURCE) include(ExternalProject) include(${PROJECT_SOURCE_DIR}/cmake/cmake-embree) include_directories(${EMBREE_INCLUDE_DIRS}) + add_compile_definitions(MYK_USE_EMBREE) ELSE() IF(WIN32) set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "C:/Program Files/Intel/Embree3 x64") ENDIF() - find_package(embree 3.6 REQUIRED) + find_package(embree 3.6) IF(NOT embree_FOUND) - message(FATAL_ERROR "Embree 3.6 not found") + message("Embree 3.6 not found; Falling back to custom BVH backend") + ELSE() + add_compile_definitions(MYK_USE_EMBREE) + include_directories(${EMBREE_INCLUDE_DIRS}) ENDIF() - include_directories(${EMBREE_INCLUDE_DIRS}) - ENDIF() ENDIF() diff --git a/data/living_room/image.png b/data/living_room/image.png index 0a4b2c9..eb31b9b 100644 Binary files a/data/living_room/image.png and b/data/living_room/image.png differ diff --git a/data/living_room/scene.json b/data/living_room/scene.json index 1033ffc..a150f20 100644 --- a/data/living_room/scene.json +++ b/data/living_room/scene.json @@ -28,7 +28,7 @@ "integrator": { "type": "PathTracer", "props": { - "spp": 1024, + "spp": 8, "minDepth": 3, "maxDepth": 5 } @@ -51,7 +51,7 @@ "props": { "color": { "props": { - "imagePath": "textures\\apple.jpg" + "imagePath": "./textures/apple.jpg" }, "type": "ImageTextureShader" } @@ -392,7 +392,7 @@ "props": { "color": { "props": { - "imagePath": "textures\\book-spines.jpg" + "imagePath": "./textures/book-spines.jpg" }, "type": "ImageTextureShader" } @@ -526,7 +526,7 @@ "props": { "color": { "props": { - "imagePath": "textures\\carpet-text3b.jpg" + "imagePath": "./textures/carpet-text3b.jpg" }, "type": "ImageTextureShader" } @@ -591,7 +591,7 @@ "props": { "color": { "props": { - "imagePath": "textures\\Shade-paper.jpg" + "imagePath": "./textures/Shade-paper.jpg" }, "type": "ImageTextureShader" } @@ -725,7 +725,7 @@ "props": { "color": { "props": { - "imagePath": "textures\\cushion-green-circles.jpg" + "imagePath": "./textures/cushion-green-circles.jpg" }, "type": "ImageTextureShader" } @@ -790,7 +790,7 @@ "props": { "color": { "props": { - "imagePath": "textures\\cushion-stripe-purple.jpg" + "imagePath": "./textures/cushion-stripe-purple.jpg" }, "type": "ImageTextureShader" } @@ -855,7 +855,7 @@ "props": { "color": { "props": { - "imagePath": "textures\\cushion-purple-yellow-stripe.jpg" + "imagePath": "./textures/cushion-purple-yellow-stripe.jpg" }, "type": "ImageTextureShader" } @@ -1060,7 +1060,7 @@ "props": { "expr": [ "image", - "textures\\wood4.jpg" + "./textures/wood4.jpg" ] }, "type": "ExprShader" @@ -1195,7 +1195,7 @@ "props": { "color": { "props": { - "imagePath": "textures\\shade-stripes.jpg" + "imagePath": "./textures/shade-stripes.jpg" }, "type": "ImageTextureShader" } @@ -1260,7 +1260,7 @@ "props": { "color": { "props": { - "imagePath": "textures\\pic5wide.jpg" + "imagePath": "./textures/pic5wide.jpg" }, "type": "ImageTextureShader" } @@ -1463,7 +1463,7 @@ "props": { "color": { "props": { - "imagePath": "textures\\magazine.jpg" + "imagePath": "./textures/magazine.jpg" }, "type": "ImageTextureShader" } @@ -1597,7 +1597,7 @@ "props": { "color": { "props": { - "imagePath": "textures\\picture11-vert.jpg" + "imagePath": "./textures/picture11-vert.jpg" }, "type": "ImageTextureShader" } @@ -1662,7 +1662,7 @@ "props": { "color": { "props": { - "imagePath": "textures\\photo1.jpg" + "imagePath": "./textures/photo1.jpg" }, "type": "ImageTextureShader" } @@ -1727,7 +1727,7 @@ "props": { "color": { "props": { - "imagePath": "textures\\photo3.jpg" + "imagePath": "./textures/photo3.jpg" }, "type": "ImageTextureShader" } @@ -1792,7 +1792,7 @@ "props": { "color": { "props": { - "imagePath": "textures\\photo2.jpg" + "imagePath": "./textures/photo2.jpg" }, "type": "ImageTextureShader" } @@ -1857,7 +1857,7 @@ "props": { "color": { "props": { - "imagePath": "textures\\photo4.jpg" + "imagePath": "./textures/photo4.jpg" }, "type": "ImageTextureShader" } diff --git a/src/core/accelerators/embree-backend.cpp b/src/core/accelerators/embree-backend.cpp index 89bacdd..7ca002e 100644 --- a/src/core/accelerators/embree-backend.cpp +++ b/src/core/accelerators/embree-backend.cpp @@ -24,12 +24,17 @@ #include #include #include -#include #ifdef MYK_USE_EMBREE +#include +#endif + + + #define QUERY_PROP(prop) log::log("{}: {}\n", #prop, rtcGetDeviceProperty(device, prop) ? true : false) namespace miyuki::core { +#ifdef MYK_USE_EMBREE class EmbreeAccelerator::Impl { RTCDevice device; RTCScene rtcScene = nullptr; @@ -135,12 +140,16 @@ namespace miyuki::core { } #else + EmbreeAccelerator::EmbreeAccelerator(){} + EmbreeAccelerator::~EmbreeAccelerator() {} + bool EmbreeAccelerator::occlude(const struct miyuki::core::Ray &ray) { + MIYUKI_NOT_IMPLEMENTED(); + } void miyuki::core::EmbreeAccelerator::build(miyuki::core::Scene &scene) { MIYUKI_NOT_IMPLEMENTED(); } bool miyuki::core::EmbreeAccelerator::intersect(const miyuki::core::Ray &ray, miyuki::core::Intersection &isct) { MIYUKI_NOT_IMPLEMENTED(); + return false; } - return false; - #endif } \ No newline at end of file diff --git a/src/core/accelerators/embree-backend.h b/src/core/accelerators/embree-backend.h index 7956085..eaf2dee 100644 --- a/src/core/accelerators/embree-backend.h +++ b/src/core/accelerators/embree-backend.h @@ -28,7 +28,8 @@ #include #include -namespace miyuki::core { +namespace miyuki::core{ + class EmbreeAccelerator final : public Accelerator, private NonCopyable{ class Impl; Impl *impl = nullptr; @@ -42,9 +43,9 @@ namespace miyuki::core { bool occlude(const Ray & ray)override; - bool4 intersect4(const Ray4 &ray, Intersection4 &isct) override; + bool4 intersect4(const Ray4 &ray, Intersection4 &isct) override{} - bool8 intersect8(const Ray8 &ray, Intersection8 &isct) override; + bool8 intersect8(const Ray8 &ray, Intersection8 &isct) override{} ~EmbreeAccelerator();