当前位置:网站首页>Projection & local illumination
Projection & local illumination
2022-07-21 15:39:00 【Sword and moonlight】
Catalog : Projection & light
Painting metaphor
A qualified painter can present the scene he sees on the canvas with paint , And for unqualified painters , Give him a transparent canvas , He can copy the scenery through the canvas ( Similar to reddening ). The latter has more general enlightenment significance for graphics .
Enlightenment of transparent canvas
In the example of painting with transparent canvas , The plane on which the canvas is located is called Visual plane , The canvas itself is called View plane window , The view plane window can be divided into countless grid cells ( Scene pixels ), The painter's eyes are called Projection center (COP). There are three main components of painting metaphor that need to be further studied : scene 、 View 、 Rendering process .
scene : A scene is a collection of objects , Each object has its geometric and material properties . The coordinate system that describes the whole scene is called the world coordinate system (WC)
View : View is the angle of viewing the scene , Its nature is similar to that of a camera
Rendering : The rendering process is equivalent to the painter observing the scene through the canvas , Finally determine the scene color and fill
Other concepts
The vistas :
Anamorphosis : Because the sampling of the image is discontinuous , Discretization produces what is called “ Heteromorphism ”. First, the boundary is not smooth due to the low sampling frequency in the scene , Second, it is caused by using a single color to represent multiple colors .
Projection 、 light 、 Brightness equation
Projection : Implementation of camera model
Full camera description
In order to completely describe the camera model , The following concepts need to be redefined :
View reference point VRP: World coordinate system (WC) A point in , Defines the origin of the new observation coordinate system .
The normal direction of the apparent plane VPN:WC A vector in , Its direction specifies the positive of the observation coordinate system z Axis direction .( It can be regarded as the camera facing )
View up vector VUV: by WC Vector in , Redefined the new coordinate system y Affirmative direction .
Distance from the apparent plane : from VRP Start along VPN Distance to the viewing plane
Projection type : The main projection types are parallel projection and perspective projection
Front clipping plane and rear clipping plane : Some planes parallel to the viewing plane , Placed in and VPR Where the distance is a certain value .
Projection
The process of projection is the process of using some method to represent three-dimensional objects on a two-dimensional plane . There are two basic ways of projection , Parallel projection and perspective projection , Then there are many subtypes .
Parallel projection : The projected rays are straight lines parallel to each other , The projection of the object is not affected by the change of distance , This projection method is called the parallel projection method . Parallel projection will give people “ Not true ” Feelings , Because it is inconsistent with the results of our daily observation , But in the field of engineering, parallel projection plays an important role , Because the parallel projection keeps the real side of the object from some angle .
Perspective projection : The figure is obtained by projecting an object onto a single projection plane from a projection center , The effect it brings is closer to the natural visual effect .
Normative framework : Normative framework is a basic arrangement of projection , It is used to capture the basic elements of perspective projection and parallel projection . For perspective projection , The normative framework refers to COP stay (0,0,-1) It's about , Visual plane and UV plane , And the view plane window is UV In the plane UV Upper range (-1,1) Square window . For parallel projection , The standard frame refers to the projection direction (0,0,-1), The viewing plane window is the same as the perspective projection .
Converting to a canonical framework requires a linear transformation of the original space , Using the knowledge of linear algebra mentioned in the introduction , It can complete the transformation from the scene to the standard perspective framework .
Stereoscopic view : Stereoscopic views form stereoscopic images by constructing left and right eye images respectively 3D Images . There are two ways to produce 3D Image method . One is the idea of three-dimensional overlap , Regard both eyes as having the same view plane and view plane method , Only the projection center is different , There is a common overlap area on the view plane . This method may bring distortion and visual discomfort . Another method is to regard the two eyes as independent view reference points , FA Xiang is also different , This method will generate a non flat virtual image plane , It may also cause discomfort .
Clipping polygon algorithm
When we finish the projection of the figure to the viewing plane , We need to further judge which parts of the polygon on the view plane can be used by us " notice " Of , That is, you need to find the part of the polygon that falls into the view plane window , This involves the clipping of polygons .
Sutherland-hodhman Algorithm
A two-dimensional
Initialize an empty vertex sequence P P P , Traverse all edges of the polygon in order , For each edge , Perform the following operations according to different conditions of the edge
(1) Line segment p 0 p 1 ⃗ \vec{p_0p_1} p0p1 Entered the clipping area : set up p p p Is the intersection of line segment and boundary , take p p p and p 1 p_1 p1 In turn P P P Tail of .
(2) Line segment p 0 p 1 ⃗ \vec{p_0p_1} p0p1 Left the crop area : set up p p p Is the intersection of line segment and boundary , take p p p Send in P P P Tail of .
(3) Line segment p 0 p 1 ⃗ \vec{p_0p_1} p0p1 Inside the crop region : skip
(4) Line segment p 0 p 1 ⃗ \vec{p_0p_1} p0p1 Outside the crop region : take p 1 p_1 p1 Send in P P P Tail of .
The three dimensional
It is easy to generalize the algorithm from 2D to 3D , The idea is to cut the polygon separately for each plane , Then the resulting polygon ( If it exists ) Pass to the next boundary .
Weiler-Atherton Algorithm
Sutherland-hodhman In some cases, the algorithm may generate degenerate polygons ( As shown in the figure below, using this algorithm will generate a vertex sequence set i-b-l-4-5-k-b-j-9-0 Examples come from textbooks ) While using Weiler-Atherton The algorithm can avoid outputting degenerate polygons .
Algorithm flow
① Number the intersection of polygon and clipping window , Traverse the points on the boundary of polygon and clipping window in order , Draw the sequence diagram according to the number .( among i , l, k, j For the public point )② Determine that the edge of the polygon to which the common point belongs is “ Leave ” The window is still “ Get into ” window , In the above example i, k by “ Leave the vertex ”, l, j by “ Go to the top ” . Vertex properties are related to the direction of boundary traversal , Traverse direction changes , The properties of common points will be reversed .( But with ① Synchronization complete )
③ Define sequence set P P P, Repeat the following steps : From the public point “ Go to the top ” set out , On the left side of the figure ( Along the polygon boundary ) Forward , encounter “ Leave the vertex ” until , Add the passed vertices P P P . After traversing all common vertices, the loop ends .
Local illumination and ray tracing
When building scenarios , In order to determine the color of the object surface , We need to consider the following types of light : The object itself emits light 、 The mirror reflects light 、 Diffuse light and ambient light . The color of the object surface can be obtained by combining the effects produced by these four .
In this chapter , We treat objects as material entities that reflect light , In order to depict the color of objects , We focus on the surface of the object . In computer graphics, we consider an extreme case : There are only two types of reflections on the surface of the object : Completely specular and Full diffuse reflection .
Lambert's law
Lambert's law is needed to calculate diffuse reflection . The law states : For diffuse reflectors , The intensity of reflected light in any direction at a point on the surface is proportional to the cosine of the incident angle : L ∝ cos θ L\propto \cos\theta L∝cosθ.
Ray tracing
forward Forward propagation algorithm
From the perspective of computer graphics , We replace our eyes with a plane of pixels . Consider the light emitted directly or by reflection on all objects , If a certain beam of light can be seen by us , It means that the photon will hit a pixel on the view window , And increase the brightness of this point to a value greater than zero . Traverse all objects , Until all pixels are adjusted , Creation can generate images in a certain view .
backward Backward propagation algorithm
Forward propagation algorithm is unrealistic to simulate the interaction between photon and object in computer , Because in reality, the reflected light we see is only a small part of all the light , This means that a large number of photons must be projected to build the view we need . Besides , We cannot guarantee that the surface of an object is completely covered by photons , To solve this problem , Backward propagation algorithm can be used .
The backward propagation algorithm only considers which light will enter the eyes and be seen by us , This can be achieved by shooting a beam of light backward from the eye position towards the scene , According to the light the object receives in this case , Restore true colors .
边栏推荐
- WinForm version update (easy version)
- (Open Shortest Path First,OSPF)综合实验
- Amazon cloud technology training and Certification Course in August is wonderful and can't be missed!
- std::string 不能跨dll的一种解决方法
- 虚拟环境中的动态特性和交互
- Origin 2022下载保姆级安装教程
- offer - 52. The first common node of two linked lists
- 哎,项目管理师没过
- 3D coordinate system of 3D conversion, perspective rotation and other basic knowledge
- 金融场景下,分布式数据库如何精准选型和快速落地?
猜你喜欢
Math. Usage of random()
Programming - common sense CS
c || 文件操作
Survey and Systematization of 3D Object Detection Models and Methods(3D目标检测模型与方法综述)论文笔记
[test report in July] Oracle OCP 19C exam passed
编程-常识cs
小程序毕设作品之微信疫苗预约小程序毕业设计(4)开题报告
Vulnhub target -doubletrouble
Section 13 of Chapter 2: intersection of set And Cross set
Php talent Recruitment site source
随机推荐
使用优先队列priority_queue实现对基unordered_map于value值的数值筛选
超级App是什么?小程序有4个特性,你知道吗?
VSS中上传一个文件夹(包括子文件夹和文件)
let关键字的特点
Okaleido tiger NFT is about to log in to binance NFT platform, and the future market continues to be optimistic
TL494电源芯片使用记录分享
Math. Usage of random()
Classic competition questions web penetration test record
Common web security problems in interview
asp. Net - edit hyperlink event
ESP8266-NodeMCU——使用U8g2库点亮OLED
2.4 循环语句
伦敦银实时行情能够给人们带来哪方面的信息
ESP8266-NodeMCU——使用WiFiManager库连接wifi
【案例分享】策略路由典型配置
Origin 2022下载保姆级安装教程
【Star项目】小帽飞机大战(一)
Fuxin software appeared at the 2022 national chemical enterprise digital intelligence transformation and Development Forum
What is super app? Applet has four features, you know?
小程序毕设作品之微信疫苗预约小程序毕业设计(7)中期检查报告