没有合适的资源?快使用搜索试试~ 我知道了~
首页Ray Tracing - The Next Week
资源详情
资源评论
资源推荐
Ray Tracing: The Next Week
Peter Shirley
Version 1.41
Copyright 2018. Peter Shirley. All rights reserved.
Pay What You Want. ptrshrl@gmail.com at paypal
50% of all payments donated to programming education related not-for-profits
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页未读,继续阅读
chaxi5771
- 粉丝: 0
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- RTL8188FU-Linux-v5.7.4.2-36687.20200602.tar(20765).gz
- c++校园超市商品信息管理系统课程设计说明书(含源代码) (2).pdf
- 建筑供配电系统相关课件.pptx
- 企业管理规章制度及管理模式.doc
- vb打开摄像头.doc
- 云计算-可信计算中认证协议改进方案.pdf
- [详细完整版]单片机编程4.ppt
- c语言常用算法.pdf
- c++经典程序代码大全.pdf
- 单片机数字时钟资料.doc
- 11项目管理前沿1.0.pptx
- 基于ssm的“魅力”繁峙宣传网站的设计与实现论文.doc
- 智慧交通综合解决方案.pptx
- 建筑防潮设计-PowerPointPresentati.pptx
- SPC统计过程控制程序.pptx
- SPC统计方法基础知识.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0