【Unite Tokyo 2019】Unityでレイトレーシングしよう!レイトレーシング実装と最適化の解説

0.9K Views

September 26, 19

スライド概要

2019/9/25-6に開催されたUnite Tokyo 2019の講演スライドです。
パウロ シルバ(エヌビディア)

こんな人におすすめ
・Unityでレイトレーシングをやってみたい人、もしくは、やってみたけどうまくいかなかった人
・Unityを使って美しいレンダリングをしてみたい人

受講者が得られる知見
・Unityのレイトレーシング機能に関する基本的な理解
・Unityのレイトレーシング機能の効果的な使い方と最適化の方法

Unityのイベント資料はこちらから:
https://www.slideshare.net/UnityTechnologiesJapan/clipboards

profile-image

リアルタイム3Dコンテンツを制作・運用するための世界的にリードするプラットフォームである「Unity」の日本国内における販売、サポート、コミュニティ活動、研究開発、教育支援を行っています。ゲーム開発者からアーティスト、建築家、自動車デザイナー、映画製作者など、さまざまなクリエイターがUnityを使い想像力を発揮しています。

シェア

埋め込む »CMSなどでJSが使えない場合

関連スライド

各ページのテキスト
2.

Real-Time Ray Tracing Paulo Silva Developer Technology Engineer, NVIDIA

3.

Announcements • Target Audience: • • Level: • • • Engineers & Technical Artists Beginner (no programming) Intermediate (some programming) Warning: • This is Beta software and is still changing • Slides will be available • Session recording will also be available 3

4.

Outline • History Of Ray-Tracing • Rasterization vs Ray-Tracing • Basic Example • Scriptable Pipelines & DXR Details • Performance Advice • More Resources 4

5.

History of Ray-Tracing 5

6.

What is Ray-Tracing? • Rendering method • Simulates light path • Most modern movies use it for SFX • Photo-realistic rendering • Car & Architecture visualization 6 Rendered in unity using real-time ray tracing

7.

History • Whitted 1980 • Cook 1984 • Kajiya 1986 • Shiny • Fuzzy • Path Tracing • Reflections • Motion Blur • Rendering Equation • Refractions • Soft Shadows • Diffuse Interreflections • Shadows • Caustics 7

8.

History • Whitted 1980 • Cook 1984 • 8 Kajiya 1986

9.

Rasterization vs Ray-Tracing 9

10.

Rasterization: Very Simplified Vertex Shader Rasterizer 10 Pixel Shader

11.

Ray-Tracing: Very Simplified Trace Rays Intersection Test 11 Shade & Trace

12.

Rasterization vs Ray-Tracing: Key Ideas Rasterizer Ray Tracing Question Which pixel □ does triangle △ cover? Which triangles △ does pixel □ see? Operation Pixel □ in triangle △ Ray → triangle △ intersection Streaming Triangles △ Rays → Inefficiency Overdraw △ Many → collisions Speedups Bounding volume hierarchy BVH (AABBs) (Hierarchical) Z-buffering 12

13.

Rasterization: Hacks SSAO Shadow Maps SSR 13

14.

Rasterization vs Ray-Tracing: AO SSAO Ray-Tracing AO 14

15.

Rasterization vs Ray-Tracing: Shadows Shadow Maps (No baked light maps) Ray-Tracing Shadows 15

16.

Rasterization vs Ray-Tracing: Reflections #1 SSR Ray-Tracing Reflections 16

17.

Rasterization vs Ray-Tracing: Reflections #2 SSR Ray-Tracing Reflections 17

18.

Basic Example 18

19.

Basic Example • No programming needed • Setup needed to get started • Shows off the main features • • • • • Reflections Shadows Ambient Occlusion Global Illumination Compare to Rasterization Cornell Box 19

20.

System Requirements • RTX GPU for complex Ray Tracing Effects* • Windows 10 v1809 • Unity 2019.3b1 20

21.

Setup • In Player settings set: • • • DirectX12 (Experimental) REALTIME_RAYTRACING_SUPPORT ENABLE_RAYTRACING 21

22.

Basic Demo Scene • Let’s create a Cornell Box 22

23.

Basic Demo: Add Ray Tracing • Add the Raytracing Environment 23

24.

Basic Demo: Reflections After Before 24

25.

Basic Demo – Shadows After Before 25

26.

Basic Demo – Indirect Illumination After Before 26

27.

Basic Demo: Raster vs Ray Tracing Ray-Tracing Raster (no baked lights) 27

28.

Scriptable Pipelines & DXR Details 28

29.

Scriptable Pipelines & DXR Details Required for next section: • DXR shader types • Acceleration structures What is DXR? • DXR = D3D12 ray tracing • HDRP uses Scriptable Pipelines • These use DXR ray tracing DXR shaders in HDRP 29

30.

DXR Shaders • Ray Generation • • Closest-hit • • e.g.: sample skybox Any-hit • • e.g.: calculate color Miss shader • • defines how rays start run once per hit for transparency Intersection • Intersect arbitrary shapes DXR Shader Graph 30

31.

DXR Acceleration Structures Acceleration Structure Bounding Boxes are Axis Aligned (AABB) 34

32.

Performance Advice 35

33.

Performance Advice - Reflections Smooth – Coherent Rays Rough – Rays Diverge • • Smooth reflective surfaces are cheaper than rough surfaces Keep shaders simple when using rough surfaces 36

34.

Performance Advice -Transparency Opaque – No Any-Hit call Transparent – many Any-Hits calls • • Keep Any-Hit shaders simple When possible make objects opaque (Use LOD) 37

35.

Performance Advice – Acceleration Structures Static Object • Dynamic Rigid Body Correctly tag objects as static, dynamic, animated 38 Animated Character

36.

Performance Advice – Acceleration Structures AS AS AS AS One Object ☺ Separate Objects ☹ • Group geometry together when possible 39

37.

Performance Advice Performance Quality Ray Count Ray Length Denoiser Quality Small Transparent Objects 40

38.

More Resources 43

39.

More Resources • Ray-Tracing Gems (free pdf): http://www.realtimerendering.com/raytracinggems/ • SIGGRAPH 2018 DXR Tutorial: http://intro-to-dxr.cwyman.org/ • Gameworks Ray-Tracing: https://developer.nvidia.com/gameworks-ray-tracing • DXR Specification: https://microsoft.github.io/DirectX-Specs/d3d/Raytracing.html • Unity HDRP DXR Build: get 2019.3b1 from unity hub, or download the following version https://github.com/Unity-Technologies/Unity-Experimental-DXR 44

40.

Please try real-time ray tracing and make something amazing! Thank You 45