图形学基础 | 光线追踪

学习一下光线追踪的概念与基本原理.
并计划实现一个简单的光线追踪Demo.

什么是光线追踪

什么是光线追踪
解密NVIDIA光线追踪技术

  • 光线追踪是三维计算机图形学中的一种特殊渲染算法. 是一种基于模拟真实光线弹射路径渲染成像的技术.
  • 基本工作原理:从取景器发出一定量的射线,投射到三维物体上,在三维空间中进行反弹,折射,并根据这个物体本身的一些材质属性,再综合光线路径等信息,计算出这个物体最终在画面中每一个像素点的颜色信息。这种模拟真实光线弹射的算法是目前所出现的能够得到较为真实的结果的一种计算方式。
  • 当然,这种算法需要大量的运算,因此早期游戏和硬件无法使用这种算法进行实时渲染。
    在这里插入图片描述

光线追踪的原理

从零开始的简单光线追踪示例

  • 光线追踪希望能模拟光线在真实环境下的折射,反射,漫反射,间接反射等物理现象。如果我们能够模拟整个场景光线的传播,就能得到非常真实的图像
  • 但如果直接从 光源开始发射的光线 经过传播后并不一定会进入摄像机,造成了大量计算浪费。
  • 使用 逆向追踪——即从摄像机开始发射光线进行追踪 ,将有效减少无效计算,即使如此,计算量依然是巨大的,如果每一个像素点发射一条光线进行追踪,并且追踪10次折射或反射的话.生成一张1080P的图,相交的计算量将是 1920 * 1080 * 10 = 20 736 000,约两千万次光线追踪运算。

单独看一个像素上的追踪过程的话:

  1. 从视线方向发射一条射线;
  2. 取得射线与场景最近的交点;
  3. 取得交点的材质颜色;
  4. 如果材质包含反射或折射,则改变光线的方向;
  5. 寻找下一个交点.并重复(2). 直到在场景内找不到交点.或者达到达到最大跟踪次数.

对于(2). 因为需要遍历场景. 开销随场景复杂度上升而上升.
对于一些简单的示例场景中, 可以简化为 射线和球. 或者射线与平面的相交. 求最近的交点.

光线追踪的入门

一篇光线追踪的入门

  • 感觉上面这篇写得很好.

光线追踪Demo

smallpt: Global Illumination in 99 lines of C++

Peter Shirley 撰写的三本书

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
For those that do not know me: My name is Jacco Bikker, also known as 'Phantom'. I work as '3D tech guy' at Overloaded, a company that develops and distributes games for mobile phones. I specialize at 3D Symbian games, which require highly optimized fixed-point, non-HW-accelerated 3D engines, crammed into 250Kb installers. So basically I'm having fun. As software rendering used to be my spare time activity, I was looking for something else. I tried some AI, which was great fun, and recently I dove into a huge pile of research papers on raytracing and related topics; such as global illumination, image based lighting, photon maps and so on. One document especially grabbed my attention. It's titled: "State-of-the-Art in Interactive Ray Tracing", and was written by Wald & Slusallek. I highly recommend this paper. Basically, it summarizes recent efforts to improve the speed of raytracing, and adds a couple of tricks too. But it starts with a list of benefits of raytracing over rasterization-based algorithms. And one of those benefits is that when you go to extremes, raytracing is actually faster than rasterizing. And they prove it: Imagine a huge scene, consisting of, say, 50 million triangles. Toss it at a recent GeForce with enough memory to store all those triangles, and write down the frame rate. It will be in the vicinity of 2-5. If it isn't, double the triangle count. Now, raytrace the same scene. These guys report 8 frames per second on a dual PIII/800. Make that a quad PIII/800 and the speed doubles. Raytracing scales linearly with processing power, but only logarithmically with scene complexity. Now that I got your attention, I would like to move on to the intended contents of this crash course in raytracing.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值