Rendering an island from Moana in less than 10,000 lines of Swift code

An island from Moana (2048 × 858 pixels, 64 spp) rendered with Gonzales to Google Cloud storage with 8 vCPUs and 64 GB of memory in about 26 hours.  In memory, it takes about 60 GB.  Noise reduction using OpenImageDenoise.
An island from Moana (2048 × 858 pixels, 64 spp) rendered with Gonzales to Google Cloud storage with 8 vCPUs and 64 GB of memory in about 26 hours. It takes about 60 GB in memory. Noise reduction using OpenImageDenoise.

, Walt Disney Animation Studios «», , Hyperion. :





  • Hyperion ();





  • Renderman;





  • PBRT;





  • Embree/OSPRay;





  • A hobby renderer ( Embree);





  • Moana RTX ( Optix);





  • GPU-Mononui ( Optix).





, Gonzales. PBRT, Swift ( C ++ OpenEXR Ptex) () Google Cloud (8 , 64 RAM). , , C/C++, . vi Swift Ubuntu Linux Xcode macOS, .





Swift?

, C C++. - (, ), . , , ( , , ) . C++, , Python ( ), Go ( C) , Rust Swift. Swift - ( «fn main» «impl trait»). , , LLVM Clang, , ) ) . , , , , , , . , , , , , , , , . , .





-

. (file.availableData, : .utf8), , . . Scanner Foundation. InputStream 64- UnsafeMutablePointer <UInt8>.





— . . , . , , , perf. FixedArray Swift. , , , perf.





, Linux macOS, . :





  • Perf: Linux , . , , , , . : , . swiftretain, release, (heap).





  • Valgrind Memcheck: , . , , : , , . Swift: malloc new sharedpointers, — , .





  • Xcode: Time Profiler, Leaks Allocations, , Perf Valgrind, . . , (Visual Studio, GCC IRIX, ? MIPSPro?).





Swift , , . , , . , new shared_pointers , , .





FlameGraph — , , . : . , Protocol Witness, .





- : Gonzales 23 , 57 , 47 2 . . — TrowbridgeReitzDistribution Texture: , , . - : , Gonzalez Primitive, PBRT, , , Boundable, Intersectable, Emitting ( ) . : BoundingHierarchyBuild Boundable Intersectables, BoundingHierarchy. , Boundable Intersectable (var primitives = Boundable&Intersectable).





, BoundingHierarchy [AnyObject&Intersectable]. : 





1. ; 





2. AnyObject ( ), , , (OpaqueExistentialContainer) 40 — Swift , (ClassExistentialContainer) 16 , , Swift . , : .





, 10 000 — Swift. — . PBRT , 1000 paramset.[h|cpp]. Swift :





protocol Parameter {}







extension Array: Parameter {}







typealias ParameterDictionary = Dictionary<String, Parameter>







, , , , . ( , , PBRT-v4.)





C ++ Ptex OpenEXR: C ++ Swift , , , . OpenEXR Ptex , extern "C". C ++ (100 Ptex, 82 OpenEXR) — OpenEXR Ptex.





, Google Compute Engine 8 64 , , — , , , . , , . , , .





  • . . , PBRT-v3, , Ptex. .





  • : Gonzalez , , 177 , . SAH . .





  • : pbrt , «» , . : pbf Swift.





  • : , . ?





  • , . LLVM : in-memory, machine readable () human readable, — . ? PBRT ( ), PBF USD () BHF ( ), .





  • : «», Gonzales , . , . PBRT, Gonzales.





  • Bump mapping: .





  • Displacement mapping: .





  • : , . , . , , , ?





  • . : 4×4, , . , , , — , , . , ( , ) , , , ? ?





  • : OpenImageDenoise, , , Swift. , beauty, albedo normal image , .





  • USD: Universal Scene Description Pixar.





  • : discrepany-based sampling multi-jittered sampling.





  • : PxrUnified ( , … ) Manifold Next Event Estimation. , - , , .





  • . PBRT.





  • : Embree . Gonzales .





  • : , PBRT-v4, , , . , , , Optix , , . , Optix. , , (Swift) ; 448 , -, . , AVX , , . NUMA, ALU . , , : . t , //, Chromium.





. , , -. PBRT — ( , ).








All Articles