没有合适的资源?快使用搜索试试~ 我知道了~
首页Ray Tracing The Next Week
资源详情
资源评论
资源推荐
Ray Tracing: The Next Week
Peter Shirley
Version 1.43
Copyright 2018. Peter Shirley. All rights reserved.
Code segments in this work:
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
Chapter 0: Overview
In Ray Tracing In One Weekend
, you built a simple brute force path tracer. In this installment
we’ll add textures, volumes (like fog), rectangles, instances, lights, and support for lots of
objects using a BVH. When done, you’ll have a “real” ray tracer.
A heuristic in ray tracing that many people-- including me-- believe, is that most optimizations
complicate the code without delivering much speedup. What I will do in this mini-book is go with
the simplest approach in each design decision I make. Check www.in1weekend.com for
readings and references to a more sophisticated approach. However, I strongly encourage you
to do no premature optimization; if it doesn’t show up high in the execution time profile, it
doesn’t need optimization until all the features are supported!
The two hardest parts of this book are the BVH and the Perlin textures. This is why the title
suggests you take a week rather than a weekend for this endeavor. But you can save those for
last if you want a weekend project. Order is not very important for the concepts presented in this
book, and without BVH and Perlin texture you will still get a Cornell Box!
Acknowledgments: Thanks to Becker for his many helpful comments on the draft and to
Matthew Heimlich for spotting a critical motion blur error. Thanks to Andrew Kensler, Thiago Ize,
and Ingo Wald for advice on ray-AABB tests. Thanks to David Hart and Grue Debry for help with
a bunch of the details. Thanks to Jean Buckley for editing.
Chapter 1: Motion Blur
When you decided to ray trace, you decided visual quality was worth more run-time. In your
fuzzy reflection and defocus blur you needed multiple samples per pixel. Once you have taken a
step down that road, the good news is that almost all effects can be brute-forced. Motion blur is
certainly one of those. In a real camera, the shutter opens and stays open for a time interval,
and the camera and objects may move during that time. Its really an average of what the
camera sees over that interval that we want. We can get a random estimate by sending each
ray at some random time when the shutter is open. As long as the objects are where they
should be at that time, we can get the right average answer with a ray that is at exactly a single
time. This is fundamentally why random ray tracing tends to be simple.
The basic idea is to generate rays at random times while the shutter is open and intersect the
model at that one time. The way it is usually done is to have the camera move and the objects
move, but have each ray exist at exactly one time. This way the “engine” of the ray tracer can
just make sure the objects are where they need to be for the ray, and the intersection guts don’t
change much.
For this we will first need to have a ray store the time it exists at:
Now we need to modify the camera to generate rays at a random time between time1
and
time2
. Should the camera keep track of time1
and time2
or should that be up to the user of
camera when a ray is created? When in doubt, I like to make constructors complicated if it
makes calls simple, so I will make the camera keep track, but that’s a personal preference. Not
many changes are needed to camera because for now it is not allowed to move; it just sends
out rays over a time period.
We also need a moving object. I’ll create a sphere class that has its center move linearly from
center0
at time0
to center1
at time1
. Outside that time interval it continues on, so those times
need not match up with the camera aperture open close.
An alternative to making a new moving sphere class is to just make them all move and have the
stationary ones have the same begin and end point. I’m on the fence about that trade-off
between fewer classes and more efficient stationary spheres, so let your design taste guide you.
The intersection code barely needs a change: center
just needs to become a function
center(time)
:
Be sure that in the materials you have the scattered rays be at the time of the incident ray.
If we take the example diffuse spheres from scene at the end of the last book and make them
move from their centers
at time=0
to center+vec3(0,0.5*drand48(), 0)
at time=1,
with the camera
aperture open over that frame.
And with these viewing parameters gives:
剩余49页未读,继续阅读
刘跃飞
- 粉丝: 33
- 资源: 12
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- ExcelVBA中的Range和Cells用法说明.pdf
- 基于单片机的电梯控制模型设计.doc
- 主成分分析和因子分析.pptx
- 共享笔记服务系统论文.doc
- 基于数据治理体系的数据中台实践分享.pptx
- 变压器的铭牌和额定值.pptx
- 计算机网络课程设计报告--用winsock设计Ping应用程序.doc
- 高电压技术课件:第03章 液体和固体介质的电气特性.pdf
- Oracle商务智能精华介绍.pptx
- 基于单片机的输液滴速控制系统设计文档.doc
- dw考试题 5套.pdf
- 学生档案管理系统详细设计说明书.doc
- 操作系统PPT课件.pptx
- 智慧路边停车管理系统方案.pptx
- 【企业内控系列】企业内部控制之人力资源管理控制(17页).doc
- 温度传感器分类与特点.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0