【计算机图形学】《五讲速通CG重点》第三讲-Rendering

news2024/11/14 22:51:22

 如果这篇文章对你有帮助,欢迎点赞与收藏~

目录

Rasterization

1 Points

2 Line

2.1 DDA(差分)

2.2 Bresenham’s algorithm:

2.3 Mid-point algorithm (0-45°)

3 Triangles

4 Polygon

5 Triangulation

6 Interpolation

7 Anti-aliasing

7.1 Box filtering

7.2 Weighted filtering

Light Science

1 Visual cues to 3D geometry

2 Illumination model (compare)

3 Local illumination model

4 Light Sources

4.1 Point light

4.2 Directional light

4.3 Spotlight

5 Phone reflection model (empirical model)

5.1 Ambient

5.2 Diffuse

5.3 Specular reflection

6 Blinn-Phone reflection model

7 Flat shading

8 Gourand shading

9 Phone shading

Texture mapping

1 Use of texture mapping

2 Texture vs material

3 Surface texture mapping:

3.1 UV Interpolation

3.2 UV Mapping

4 Aliasing of textures

4.1 Texture prefiltering

4.2 Mipmapping

5 Other mapping

5.1 Bump mapping

5.2 Displacement mapping

5.3 Environment mapping

5.4 Cubic mapping

Physically-based Rendering(新增,极易考到)

1 Equation

2 BRDF

3 Transmission

4 Randiance and Irradiance

划重点


Rasterization

First job: enumerate the pixels covered by a primitive

Second job: interpolate values across the primitive

1 Points

Inside + right-down point + right edge + down edge

2 Line

Given segment endpoints (x1,y1;x2,y2) are all integers

下面开始展开

2.1 DDA(差分)

float point computation, round operation

2.2 Bresenham’s algorithm:

If a < b ,then upper pixel

If a > b, then lower pixe

In order to avoid computing float point, multiple the Δx

2.3 Mid-point algorithm (0-45°)

Midpoint Circle Algorithm

公式:

递推公式:

3 Triangles

Draw edges vertically and fill in horizontal spans for each scan line

4 Polygon

Inside or outside test:

Send a ray from that specific point,

  if the intersections are odd---inner

  If the intersections are even ---- outer

Pay attention the ray can’t touch a vertex or tangent with an edge.

Triangle method works only for convex ones

Polygon fill in:

When touching a vertex, with adjacent two edges on one size, the vertex should be viewed as two vertices.

5 Triangulation

Ear-clipping : 每次选取凸顶点从原图中删除,并生成三角形,直到最后只剩三个顶点为止

Trapezoid decomposition: 先划分为梯形,再按对角线分开为三角形

6 Interpolation

Attributes are interpolated during rasterization

• Depth

• Color

• Texture coords

• Many others

7 Anti-aliasing

• Basic idea: replace “is the image black at the pixel center?” with “how much is pixel covered by black?”

• Replace yes/no question with quantitative question.

7.1 Box filtering

• Compute coverage fraction by counting subpixels

• Simple, accurate

• Slow

• Unweighted filtering

7.2 Weighted filtering

• Compute filtering integral by summing filter values for covered subpixels

• Simple, accurate

• But really slow

Light Science

Light color vs reflected color:

The resulting color of the object is light color and multiply the reflected color.

1 Visual cues to 3D geometry

• size (perspective)

• occlusion (depth)

• shading

Light color vs reflected color:

The resulting color of the object is light color and multiply the reflected color.

2 Illumination model (compare)

• Global illumination model

        • Simulate not only the direct illuminations but also the indirect illuminations

• Ray-tracing

• Radiosity

• Photon Mapping

• Can handle

        • Reflection (one object in another)

        • Refraction (Snell’s Law)

        • Shadows

        • Color bleeding

• More computation and slow

• Local illumination model

        • Considers light sources and surface properties only

• Gouraud shading

• Phong shading

• Shadow techniques

• Can approximate GI!

        • Environmental Mapping

        • Ambient occlusion

        • Image based lighting

• Fast and real-time

• Not as accurate as GI

3 Local illumination model

• Light sources

• Geometry

• Material

• Viewing Direction

4 Light Sources

4.1 Point light

(a0,a1,a2) means coefficient for attenuation

4.2 Directional light

(平行光--太阳光)

Directional light has no attenuation because of the infinite distance.

4.3 Spotlight

单位向量点击小于cosθ,即角度大于θ(0<θ<90)

使用α来表示一个平缓变换的情况

5 Phone reflection model (empirical model)

Ambient + diffuse + specular

I: vector to light source

n: surface normal

v: vector to viewer

r: reflection of I at P (determined by I and n)

5.1 Ambient

Different surface can have different ambient reflection coefficient ka (0 ≤ ka ≤ 1)

5.2 Diffuse

Intensity depends on angle of incoming light

5.3 Specular reflection

Shiny surfaces have high specular coefficient

Model specular highlights

Can’t get mirror effect

The higher α is , the narrower specular light

6 Blinn-Phone reflection model

Use calculating a halfway vector between the viewer and light-source vectors to instead computing the dot product of r and v

-> the cost of computing reflecting vector is more than computing halfway vector

In addition, the angle of the Blinn-Phone model is smaller than the Phone model, which makes the specular look more natural.

7 Flat shading

All pixels inside each polygon have the same color. --- fast

Good for polyhedral objects but not good for smooth surfaces.

8 Gourand shading

An interpolation method.

Step:

  1. Normal average vector (获取每个顶点邻接面的法向量的平均值作为每个顶点的法向量)

  2. Vertex-lightening (based on illumination model)

  3. Bilinear interpolation (for color) 双线性插值

Not good at highlight

9 Phone shading

An interpolation method.

Phong shading interpolates normals rather than colors

interpolates surface normal across rasterized polygons and computes pixel colors based on the interpolated normal

Computationally expensive but could capture the highlight

At each pixel, n is recomputed and normalized

Then l is computed at each pixel (lighting model is more expensive than interpolation algorithms)

Texture mapping

An image is pasted onto the 3D model, which is called a texture map.

1 Use of texture mapping

• Describe surface material properties

• Normal and Displacement

• Precomputed lighting and shadows

2 Texture vs material

Material is the intrinsic properties of a surface defining how lighting interacts with the surface

Texture is an “image-based” data describing appearance property

Texture mapping is a part of rasterization

3 Surface texture mapping:

Two mapping functions:

  1. Find the mapping relation between texture coordinate and uv coordinate:

  1. Find the mapping relation between uv coordinate and object coordinate:

UV coordinate is the transition between texture coordinate and object coordinate.

Finding the true color via uv coordinate

Backward mapping: 反向贴图,通过obj模型和相应的映射关系,将模型上的贴图展成纹理图片

3.1 UV Interpolation

(texture coordinate <--> uv coordinate)

In screen space can not use linear interpolation .

线性插值是基于仿射变换的,在屏幕坐标系中产生两个三角形的仿射变换不相同,而在UV坐标系中两个三角形是相同的,导致了映射函数虽然连续但不平滑(导数不连续)

(u,v) should be divided by the depth

3.2 UV Mapping

Mesh parameterization

(uv coordinate <--> object coordinate)

Orthogonal mapping

Cylindrical mapping:

柱面坐标系:

Linear relation between (u,v) and (s,t)

When u=0, s=0; u=2Π,s=1;

When v=0, t=0; v=h, t=1;

Spherical mapping:

球面坐标系:

4 Aliasing of textures

当许多纹理点被包含在同一像素中或纹理表面的分辨率过高时,会产生

4.1 Texture prefiltering

we can pre-compute the averages (once) and just look up these averages (many times) at run-time

4.2 Mipmapping

根据一个像素中包含的纹理数量来切换分辨率

• Use a texture of multiple resolutions

• Switch the resolution according to the number of texels in one pixel

防止jump:

Rather than clamping the Mipmap level to the closest integer, interpolating between levels

三线性插值

5 Other mapping

5.1 Bump mapping

Use texture to disturb the normal. (the visual illusion, shadow is very smooth)

5.2 Displacement mapping

Use the texture map to actually move the surface point

5.3 Environment mapping

simulate the reflection using texture mapping!

5.4 Cubic mapping

2D UV coordinates becomes 3D texture directions

Physically-based Rendering(新增,极易考到)

1 Equation

2 BRDF

BRDF是指双向反射分布函数(Bidirectional Reflectance Distribution Function)的缩写,是用于描述材料表面反射特性的函数。它描述了入射光线与出射光线之间的关系,包括反射角度、入射角度和光线波长等因素。

Encodes behavior of light that “bounces off” surface

3 Transmission

• In addition to reflecting off surface, light may be transmitted through surface.

• Light refracts when it enters a new medium

• BTDF (Bidirectional transmittance distribution function)

Law of refraction: Snell’s Law

Law of reflection: Fresnel's Law

4 Randiance and Irradiance

Radiance is the solid angle density of irradiance 辐射度是辐照度的立体角密度

  1. 辐射度(Radiance):

    1. 定义:辐射度是指从某一方向上单位立体角内,传递通过单位面积的光能量。它是一个方向性的量,不仅取决于光的强度,还取决于光的传播方向。

    2. 数学表达:通常用 L 表示,其单位是瓦特每平方米每球面度。

    3. 应用:辐射度在渲染方程中非常重要,用于计算从光源到观察者的光线强度,包括考虑物体表面的反射、吸收和散射等。

  2. 辐照度(Irradiance):

    1. 定义:辐照度是指单位面积上接收到的光能量,它描述了光源对物体表面的照射强度。

    2. 数学表达:通常用 E 表示,其单位是瓦特每平方米。

    3. 应用:辐照度用于计算物体表面由于光照而接收到的能量,是光照模型(如Phong光照模型)中的一个关键组成部分。

划重点

• What 3D clues do you know until now? (上文)

• How many types of light sources do you know? (上文)

• Reflection model vs Shading method?

• Why blinn phong is better than phong (上文)

• Why phong shading is better than gourand shading? (插值的对象)

• Material vs Texture? (上文)

• How to deal with multiple light sources simultaneously?

• How does the number of lights affect performance?

• How to rasterize an arbitrary polygon? (上文,扫描法)

• Mipmapping vs Bump mapping vs Displacement mapping vs Cubic mapping?

• The flexible usages of texture objects? (usage 上文)

• Shadow map vs Shadow volume? 

• What is the definition of radiance and irradiance?

• What is the rendering equation?

• What is BRDF 

 如果这篇文章对你有帮助,欢迎点赞与收藏~

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2110161.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

运动耳机哪个牌子的好?五大选购技巧助你轻松购买

作为一名专注运动装备的测评专家&#xff0c;我曾深入体验了多款骨传导耳机&#xff0c;发现市场上不少品牌并未如广告所宣称的那般出色&#xff0c;部分低质或不专业的骨传导耳机在使用时不仅舒适度欠佳&#xff0c;还可能因设计缺陷导致声音泄露严重&#xff0c;非常影响使用…

共赢算力未来,华宇TAS应用中间件获“鲲鹏原生开发认证”

9月2日&#xff0c;华为在北京中关村国家自主创新示范区会议中心举办了以“鲲鹏原生&#xff0c;力算未来”为主题的鲲鹏原生开发伙伴圈层活动&#xff0c;旨在聚集鲲鹏生态合作伙伴&#xff0c;搭建交流平台&#xff0c;加强产业圈各方紧密合作&#xff0c;抓住产业机遇&#…

Canvas艺术之旅:了解几个绘制基本图形的 API

了解几个绘制基本图形的 API Canvas 是 HTML5 提供的绘画 API&#xff0c;可以用于在 Web 页面上绘制各种基本图形。本文介绍一些 Canvas 绘制基本图形的 API&#xff1a; 前置条件 注意&#xff1a;本文章所提供的代码示例默认已经进行了 canvas 元素定义&#xff0c;DOM 获…

Java项目: 基于SpringBoot+mybatis+maven+mysql教师工作量管理系统(含源码+数据库+毕业论文)

一、项目简介 本项目是一套基于SpringBootmybatismavenmysql教师工作量管理系统 包含&#xff1a;项目源码、数据库脚本等&#xff0c;该项目附带全部源码可作为毕设使用。 项目都经过严格调试&#xff0c;eclipse或者idea 确保可以运行&#xff01; 该系统功能完善、界面美观…

日志框架log4j打印异常堆栈信息携带traceId,方便接口异常排查

一、异常堆栈无traceId 排查定位问题异常痛苦 在日常项目开发中&#xff0c;我们会自定义一个traceId方便&#xff0c;链路追踪。在log4j2.xml 我们可能是这样去配置日志打印格式。 <Console name"CONSOLE" target"SYSTEM_OUT"><PatternLayoutpa…

python学习第六节:使用python制作九九乘法表和学生管理系统

python学习第六节&#xff1a;使用python制作九九乘法表和学生管理系统 通过前面五节的了解&#xff0c;已经大概知道python的语法以及基础函数&#xff0c;下面是简单的两个小程序。不会做没关系&#xff0c;看得懂就可以了&#xff0c;如果能够自己加工举一反三那就更好了。 …

计算机网络 TCP/IP协议篇

今天学习了TCP/IP协议的相关知识&#xff0c;学习笔记如下&#xff1a; 在学习之前&#xff0c;我们先抛出几个问题&#xff0c;什么是TCP/IP协议簇&#xff1f;TCP/IP协议簇是怎么工作的&#xff1f; TCP/IP模型 协议分层 每层通过协议完成各自特定的功能上层依赖下层提供…

智能对决:提示词攻防中的AI安全博弈

智能对决&#xff1a;提示词攻防中的AI安全博弈 在2024年上海AIGC开发者大会上&#xff0c;知名提示词爱好者工程师云中嘉树发表了关于AI提示词攻防与安全博弈的精彩演讲。他深入探讨了当前AI产品的安全现状&#xff0c;提示词攻击的常见手段及其应对策略。本文将对他的演讲进…

【每日一题】LeetCode 84.柱状图中最大的矩形(栈、数组、单调栈)

【每日一题】LeetCode 84.柱状图中最大的矩形&#xff08;栈、数组、单调栈&#xff09; 题目描述 给定 n 个非负整数&#xff0c;用来表示柱状图中各个柱子的高度。每个柱子彼此相邻&#xff0c;且宽度为 1 。求在该柱状图中&#xff0c;能够勾勒出来的矩形的最大面积。 这…

Linux小程序:进度条

目录 一、换行与回车 二、缓冲区 三、倒计时代码 四、进度条实现 实现进度条程序&#xff0c;首先需要两个预备知识&#xff1a; 1.换行与回车 2.缓存区 一、换行与回车 我们通常使用\n作为换行符&#xff0c;但实际上\n是换行回车两种效果的结合&#xff0c;因此我们需…

.iso文件怎么打开?

在日常使用电脑的过程中&#xff0c;很多用户都会遇到.iso文件&#xff0c;尤其是在安装软件、操作系统或者备份光盘内容时。那么&#xff0c;什么是.iso文件&#xff1f;该如何打开它&#xff1f;本文将为大家详细解答这些问题&#xff0c;帮助大家轻松处理.iso文件。 什么是.…

IEEE TRO 人形机器人遥操作的综述

人形机器人的遥操作结合了人类的认知技能和领域专业知识以及人形机器人的物理能力。这种人形机器人的操作多功能性使它们成为远程环境中各种应用的理想平台。然而&#xff0c;人形机器人的复杂性给遥操作带来了挑战&#xff0c;尤其是在通信受限的非结构化动态环境中。尽管在过…

【2024国赛B题】高教杯全国大学生数学建模国赛建模过程+完整代码论文全解全析

你是否在寻找数学建模比赛的突破点&#xff1f;数学建模进阶思路&#xff01; 作为经验丰富的数学建模团队&#xff0c;我们将为你带来2024国赛数学建模竞赛&#xff08;B题&#xff09;的全面解析。这个解决方案包不仅包括完整的代码实现&#xff0c;还有详尽的建模过程和解析…

pdf怎么删除其中一页?这5个pdf编辑方法新手都在用,建议收藏

pdf怎么删除其中一页&#xff1f;在日常的工作和学习生活中&#xff0c;我们经常会遇到需要处理PDF文件的情况。有时候&#xff0c;我们在处理PDF文件时&#xff0c;发现某些页面内容不再需要&#xff0c;想从PDF中删除特定的页面。然而&#xff0c;很多小伙伴对PDF的编辑和修改…

员工上班摸鱼怎么办,上班期间摸鱼

在现代企业的日常运营中&#xff0c;员工的工作效率是企业成功的关键因素之一。随着远程办公的普及&#xff0c;员工在工作中“摸鱼”的现象愈加频繁。这不仅会导致工作效率的下降&#xff0c;还可能拖延项目进展&#xff0c;增加企业的管理成本。面对这一问题&#xff0c;企业…

大模型备案重难点最详细说明【评估测试题+附件】

2024年3月1日&#xff0c;我国通过了《生成式人工智能服务安全基本要求》&#xff08;以下简称《AIGC安全要求》&#xff09;&#xff0c;这是目前我国第一部有关AIGC服务安全性方面的技术性指导文件&#xff0c;对语料安全、模型安全、安全措施、词库/题库要求、安全评估等方面…

极市开发平台yolov8训练无人机数据集样例数据流程

先进入vscode&#xff0c;进入src_repo文件夹。 第一步&#xff0c;克隆一个比较好的博主的库&#xff1a; GitHub - Incalos/YOLO-Datasets-And-Training-Methods: This project involves making custom datasets for the YOLO series and model training methods for YOLO.…

在生产线打包机中RFID技术的赋能

在生产线打包机中RFID技术的赋能 随着制造业的智能化发展&#xff0c;RFID技术越来越多地被应用于生产线中&#xff0c;特别是在产线打包环节。本文将探讨RFID技术如何提高产线打包机的工作效率和准确性&#xff0c;并分析其在现代制造业中的重要作用。 RFID在产线打包机上的应…

顶刊速递|医学AI在乳腺癌中的最新研究进展·24-09-06

小罗碎碎念 本期推文主题&#xff1a;乳腺癌 最近我在思考一个问题&#xff0c;生信分析和人工智能的区别和联系是什么&#xff1f;细节现在是想不清楚的&#xff0c;因为我的知识储备还不够&#xff0c;但是有一点我可以确定&#xff0c;二者的部分本质都是一样的——强大的计…

使用程序方式获取与处理MySQL表数据

8.1  执行多条语句获取 MySQL 表数据 8.1.1  MySQL 中的常量 8.1.2  MySQL 中的变量 1&#xff0e;用户变量 用户可以在表达式中使用自己定义的变量&#xff0c;这样的变量称为用户变量。 用户变量在使用前必须定义和初始化&#xff0c;如果使用没有初始化的变量&#x…