WO2018113502A1 - 一种自动生成网格与着色器多层次细节的方法 - Google Patents

一种自动生成网格与着色器多层次细节的方法 Download PDF

Info

Publication number
WO2018113502A1
WO2018113502A1 PCT/CN2017/114176 CN2017114176W WO2018113502A1 WO 2018113502 A1 WO2018113502 A1 WO 2018113502A1 CN 2017114176 W CN2017114176 W CN 2017114176W WO 2018113502 A1 WO2018113502 A1 WO 2018113502A1
Authority
WO
WIPO (PCT)
Prior art keywords
level
simplified
rendering
detail
distance
Prior art date
Application number
PCT/CN2017/114176
Other languages
English (en)
French (fr)
Inventor
鲍虎军
王锐
胡天磊
宋麒
袁亚振
Original Assignee
浙江大学
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 浙江大学 filed Critical 浙江大学
Publication of WO2018113502A1 publication Critical patent/WO2018113502A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/005General purpose rendering architectures

Definitions

  • the present invention relates to the field of graphics rendering technologies, and in particular, to a method for automatically generating multi-level details of a grid and a shader.
  • Level-of-detail is a technique in which it is used very widely.
  • the present invention provides a method of automatically generating multi-level details of a grid and a shader.
  • a method for automatically generating multiple levels of detail in a mesh and shader including:
  • the rendering program described in the present invention refers to a shader code that is input when rendering.
  • the original renderer described in the present invention includes only vertex shaders and pixel shaders, and each shader code is written in the HLSL language.
  • the original mesh and the simplified mesh are model information encoded in the OBJ format, and the vertices and surface data of the model are provided for the simplified method.
  • the simplified model is still encoded and saved in the OBJ format for rendering.
  • Each level of detail in the present invention includes a grid to camera distance value, a simplified grid, and a simplified rendering program that is used to render the grid.
  • the deviation of the image space in the present invention refers to the sum of the Euclidean distances of the two images per pixel by color.
  • all image deviations are calculated by default and averaged at multiple viewing angles.
  • the former is to place the grid at the center of the cube, and observe the six observation angles obtained from the center point of the six faces respectively, and the latter is to place the grid.
  • the twelve observation angles obtained from the center of the icosahedron are observed from twelve vertices.
  • Step 1) of the present invention comprises the following steps:
  • step 1-2 Use the simplified rendering program output in step 1-2) to render the original mesh at the nearest distance of the input, get their rendering efficiency and image deviation, select all according to rendering efficiency and image deviation.
  • step 1-4 Use the simplified rendering program output in step 1-2) to render the original mesh at the farthest distance of the input, get their rendering efficiency and image deviation, and select all the Pareto most according to rendering efficiency and image deviation.
  • the code movement rule refers to the calculation originally located in the pixel shader.
  • the code is moved to the vertex shader or subdivision shader to reduce the number of times the code is run; moving to the parameter rule means fitting the value of the variable originally calculated in the pixel shader to a constant value stored on the CPU side, in rendering When you pass it directly as a parameter to reduce the calculation.
  • the step 2) described in the present invention comprises the following steps:
  • the number of simplified meshes to be sampled as described in step 2-3) refers to how many simplified mesh samples need to be sampled to represent all possible simplified meshes when this multi-level detail is generated.
  • A1 Find all the faces ⁇ F ⁇ on the grid that are connected to any vertex of the edge, and then find the edge ⁇ E ⁇ that is connected to all the vertex of ⁇ F ⁇ , using all the vertices of ⁇ E ⁇
  • the screen space bounds box H as a range of screen pixels affected by the simplification of the edge;
  • A2) use the original rendering program to render all the patches in the H or overlap with H, to get a simplified picture I e ;
  • a3) are calculated using a shader calculates a pixel included in a range H, I e I o with the spatial variation in image space image I c and e, and the deviation I o e ', e and e' is the difference between the edge The image deviation increment.
  • the distance value in step 3) described in the present invention is exponentially distributed, so that when the distance is arranged from small to large, the number of pixels drawn by the grid and presented on the screen is proportionally reduced, and the distance formula is:
  • d min and d max are the nearest and farthest distances between the input grid and the camera, respectively
  • l represents the total number of distance values after insertion, including the nearest and farthest distance.
  • Step 3 of the present invention finds a pair of mesh and rendering programs with the highest rendering efficiency at the specified distance by the following steps:
  • step b4) Repeat step b3) until you have traversed all the simplified rendering programs or simplified the mesh, and finally S is the pair of mesh and rendering programs with the highest rendering efficiency at that distance.
  • the image deviation threshold at the current distance described in step b1) refers to the maximum image deviation value allowed by using the simplified mesh and the simplified rendering program, and the calculation formula is:
  • d is the current distance
  • d min and d max are the nearest and farthest distances of the input
  • Q is the input quality coefficient
  • the range is 0 to 1
  • max_error is the input maximum image deviation threshold at distance d max .
  • Step 4) of the present invention comprises the following steps:
  • the transition deviation value described in step 4-1) to step 4-3) means that the two levels of the grid are placed at a distance in the two levels, respectively, and are respectively rendered using respective rendering programs, and they are calculated. The resulting image is deviated from the resulting value.
  • the transition deviation threshold refers to the maximum transition deviation value allowed between the two levels.
  • the calculation formula of the transition deviation threshold is:
  • Q' is the input transition quality factor and max_bound is the input maximum transition deviation threshold at distance dmax .
  • a) proposes a new multi-resolution model representation, a combination of simplified mesh and simplified rendering procedures.
  • the present invention can balance rendering at various resolutions. The bottleneck of efficiency, maximizing rendering efficiency based on the same image deviation;
  • FIG. 1 is a general flowchart of a method for automatically generating a multi-level detail of a grid and a shader according to the embodiment
  • FIG. 2 is a sub-flow diagram for generating hierarchical details over multiple distances in the present embodiment
  • FIG. 3 is a sub-flowchart for calculating a level detail result at a specified distance according to the embodiment
  • a method for automatically generating multiple levels of detail in a mesh and shader including:
  • the number of simplified grids to be sampled according to the need is 1000
  • the number of M o patches is 20000
  • the number of target patches is 1000.
  • the 19 patches are output, and the current simplified grid is output to ⁇ M ⁇ , and the cumulative simplified patch number Acc is assigned to 0;
  • step 2-1) Repeat steps 2-4) until the current number of mesh patches is less than or equal to the target patch number 1000.
  • the calculation of the image deviation increment e i in step 2-1) is carried out as follows:
  • A1 Find all the faces ⁇ F ⁇ on the grid that are connected to any vertex of the edge, and then find the edge ⁇ E ⁇ that is connected to all the vertex of ⁇ F ⁇ , using all the vertices of ⁇ E ⁇
  • the screen space bounds box H as a range of screen pixels affected by the simplification of the edge;
  • Step 3-2 Use the following steps to find a pair of meshes and rendering programs with the highest rendering efficiency at the specified distance, as shown in Figure 3:
  • the image deviation threshold of the current distance described in step b1) refers to the maximum image deviation value allowed to be generated using the simplified mesh and the simplified rendering procedure, and the calculation formula is:
  • d is the current distance
  • Q is the input simplified mass coefficient
  • the range is 0 to 1
  • max_error is the input maximum image deviation threshold at distance d max .
  • the transition deviation value described in step 4-1) to step 4-4) means that the two levels of the grid are placed at a distance far from the two levels, respectively, and are respectively rendered using respective rendering programs, and they are calculated The value obtained by the deviation of the image space.
  • the transition deviation threshold refers to the maximum transition deviation value allowed between the two levels.
  • the calculation formula of the transition deviation threshold is:
  • Q' is the input transition quality factor and max_bound is the input maximum transition deviation threshold at distance dmax .

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Graphics (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Image Generation (AREA)
  • Image Processing (AREA)

Abstract

本发明公开了一种自动生成网格与着色器多层次细节的方法。多层次细节技术在很多计算机图形相关的应用中被广泛用于优化渲染效率,多种多层次细节,比如几何层面的多层次细节,着色器层面的多层次细节,也相继被发展研究出来,同时催生了很多自动生成这些多层次细节的方法。但是目前这些方法都没有同时考虑几何体与着色器的简化。在本发明中,一种几何体与着色器联合简化,并生成相应多层次细节的方法被提出,每个层次细节用一对模型和着色器的组合表示,该方法不仅可以在每个层次细节最优化这一组合,并且能够自适应地在不同距离生成层次细节。相比单独使用模型多层次细节或着色器多层次细节的方法,本发明在平衡渲染效率与质量上做得更好。

Description

一种自动生成网格与着色器多层次细节的方法 技术领域
本发明涉及图形渲染技术领域,尤其涉及一种自动生成网格与着色器多层次细节的方法。
背景技术
在各种计算机图形应用中,实时渲染出复杂而真实模型的问题都是非常受关注的。然而,就算以当前最新的图形硬件配置来看,模型本身复杂程度的增长仍然比硬件渲染能力的提升要快很多。这种压力催生了很多平衡模型复杂度与渲染效率的研究。多层次细节(Level-of-detail,LOD)就是其中被使用得非常广泛的一种技术。
多层次细节的基本思想就是使用一些简化表示代替远处较小的模型或者模型的不重要部分。目前已经在不同方面有各种表示方法被研究出来。Luebke在2003年提出基于网格简化方法的几何层面多层次细节技术,并催生了许多相关的优秀算法。随着图形处理单元(Graphics Process Unit,GPU)的发展,很多相关应用都广泛使用着色器技术来加强模型显示的保真度。迎合这个趋势的发展,近来的一些工作,比如Olano、He等人研究的自动生成简化着色器多层次细节的方法,以及在各距离下平衡渲染效率与质量的技术也正在开展。但是这些研究都没有考虑同时简化网格与着色器。
发明内容
针对现有技术的不足,本发明提供了一种自动生成网格与着色器多层次细节的方法。
一种自动生成网格与着色器多层次细节的方法,包括:
1)使用基于表面信号拟合的着色器自动简化方法,对原始渲染程序进行简化,得到一系列简化渲染程序;
2)使用原始渲染程序来进行渲染,基于图像空间的偏差,对原始网格进 行简化,得到一系列不同简化程度的简化网格;
3)在输入的最近与最远距离之间插入n个距离值,在各距离上搜索所有的简化渲染程序与简化网格,从中找到渲染效率最高的一对网格与渲染程序,作为当前距离的层次细节结果,并按距离增序排列组织成多层次细节;所述的n个距离值呈非均匀分布,保证在距离从小到大排列时,网格绘制并呈现在屏幕上的像素个数是等比减少的。
4)在多层次细节中超出过渡偏差阈值的相邻层次间插入新的层次细节,加入多层次细节中,再对其中小于过渡偏差阈值的相邻层次进行合并,得到最终的多层次细节结果。
本发明中所述的渲染程序是指进行渲染时输入的着色器代码。本发明中所述的原始渲染程序中仅包括顶点着色器和像素着色器,且各着色器代码都是使用HLSL语言编写的。
本发明中原始网格、简化网格都是用OBJ格式编码的模型信息,为简化方法提供模型的顶点以及面数据,简化后的模型依然使用OBJ格式编码并保存,用于渲染。
本发明中的每个层次细节,包括一个网格与相机的距离值,一个简化网格,以及一个被用于渲染该网格的简化渲染程序。
本发明中的图像空间的偏差,是指给定的两张图片逐像素颜色的欧氏距离之和,在本发明中所有图像偏差都默认是在多个视角计算并取平均值的结果,视角根据用户设定可以是六个或者十二个,前者是将网格放置在正方体中心位置,分别从六个面的中心点观察正方体中心所得到的六个观察视角,而后者是将网格放置在正二十面体的中心,分别从十二个顶点观察正二十面体中心所得到的十二个观察视角。
本发明所述的步骤1)包括如下步骤:
1-1)将输入的原始渲染程序的代码转换成抽象语法树与程序依赖图;
1-2)根据程序依赖图,在抽象语法树上对着色器的所有计算操作综合应用三条简化规则,分别是操作移除,代码移动以及移动到参数,得到一系列简化后着色器的抽象语法树,输出它们各自的渲染程序代码;
1-3)在输入的最近距离下使用步骤1-2)输出的所有简化渲染程序渲染原始网格,得到它们的渲染效率与图像偏差,根据渲染效率和图像偏差选择所有 满足帕累托最优的简化渲染程序;
1-4)在输入的最远距离下使用步骤1-2)输出的所有简化渲染程序渲染原始网格,得到它们的渲染效率与图像偏差,根据渲染效率和图像偏差选择所有满足帕累托最优的简化渲染程序;
1-5)求1-3)与1-4)中得到的简化渲染程序的并集,结果即最优的一系列简化渲染程序。
步骤1-2)中所述的操作移除规则是指删除某次计算操作,比如删除a=a+b计算中的加法以加速计算;代码移动规则是指将原来位于像素着色器中的计算代码移动到顶点着色器或者细分着色器中,以减少该代码的运行次数;移动到参数规则是指将原来在像素着色器中计算的变量值拟合成常量值存储在CPU端,在渲染时直接将其作为参数传入以减少计算。
本发明所述的步骤2)包括如下步骤:
2-1)使用原始渲染程序渲染原始网格得到原始图片Io,并使用原始图片作为当前图片Ic
2-2)对原始网格的每一条边,使用原始渲染程序渲染并计算该边简化后与简化前相比的图像偏差增量,并将其放入以该增量为排序依据升序排列的优先队列Q中;
2-3)根据需要采样的简化网格个数,原始面片数以及目标面片数,求出面片数步进s;
2-4)抛出优先队列Q中的第一条边并简化,同时更新该边周围受影响的所有边的图像偏差增量,重新按序放到优先队列Q中,并更新当前图片Ic,每当简化面片数达到步进s即输出一个简化网格;
2-5)重复步骤2-4)直至当前网格面片数少于目标面片数。
步骤2-3)中所述的需要采样的简化网格个数是指,在本次多层次细节生成时,需要采样多少个简化网格样本代表所有可能的简化网格。
步骤2-1)中所述的边简化后与简化前相比的图像偏差增量的计算按如下步骤进行:
a1)求出在网格上,与该边的任意顶点相接的所有面{F},再求出与{F}所有顶点相接的边{E},使用{E}的所有顶点所在的屏幕空间包围盒H作为受该边简化影响的屏幕像素范围;
a2)使用原始渲染程序渲染网格所有在H中或者与H有重叠部分的面片,得到简化图片Ie
a3)使用计算着色器分别计算在H所包含的像素范围内,Ie与Io的图像空间偏差e以及Ic与Io的图像空间偏差e’,e与e’的差即为该边的图像偏差增量。
本发明中所述的步骤3)中距离值呈指数分布,保证在距离从小到大排列时,网格绘制并呈现在屏幕上的像素个数是等比减少的,距离公式为:
Figure PCTCN2017114176-appb-000001
其中i表示第几个距离值,dmin与dmax分别为输入的网格与相机间的最近和最远距离,l表示插入后距离值的总个数,包括最近与最远距离。
本发明所述的步骤3)通过以下步骤找到指定距离下渲染效率最高的一对网格与渲染程序:
b1)计算当前距离下的图像偏差阈值E,并按引入的图像偏差大小升序分别排列简化网格与简化渲染程序;
b2)从最后一个简化网格开始逐步往前递进,使用原始渲染程序渲染途经的每一个简化网格,直到找到第一个在阈值E内的简化网格,将该网格-渲染程序对作为当前结果S,测量该组合在多个视角下的平均渲染时间tmin
b3)从上一次选中的简化网格开始继续往前递进,使用下一个简化渲染程序渲染途经的每一个简化网格,直到找到第一个在阈值E内的简化网格,测量该网格-渲染程序对在多个视角下的平均渲染时间t,若t小于tmin则将tmin值改为t,并将当前结果S改为本次选出的网格-渲染程序对;
b4)重复步骤b3)直到遍历所有简化渲染程序或者简化网格,最终S即为该距离下渲染效率最高的一对网格与渲染程序。
步骤b1)中所述的当前距离下的图像偏差阈值是指,使用简化网格及简化渲染程序允许产生的最大图像偏差值,其计算公式为:
Figure PCTCN2017114176-appb-000002
其中d为当前距离,dmin与dmax分别为输入的最近与最远距离,Q为输入的质量系数,范围是0到1,max_error为输入的在距离dmax下的最大图像偏差阈值。
设简化网格数量为M,简化渲染程序数量为N,如果不使用线性搜索的方 法,则需要遍历所有简化网格与简化渲染程序的组合,时间消耗为O(MN),而使用如上线性搜索的方法,消耗的时间是O(M+N),因为线性搜索的方法每次仅在简化网格序列中往前步进1,或者在简化渲染程序序列中往后步进1,所以只需要线性的时间消耗,故使用线性搜索能够大大加快寻找最优网格与渲染程序对的效率。由于对任意渲染程序,网格面片数越少,渲染效率越高,而线性搜索的方法保证遍历了每个简化渲染程序使用其图像偏差阈值内最简化的网格的情况,所以也保证了线性搜索方法的正确性。
本发明所述的步骤4)包括以下步骤:
4-1)插入新的层次细节。
从最近的层次细节开始到最远的层次细节,为每个层次细节Pi计算与下一层Pi+1之间的过渡偏差值,如果超过了在Pi+1的距离di+1下求出的过渡偏差阈值,那么就在Pi与Pi+1之间插入一个距离值,使得插入距离值后,所述的n个距离值呈非均匀分布,且保证在距离从小到大排列时,网格绘制并呈现在屏幕上的像素个数是等比减少;并按b1)到b4)所述步骤得到该距离下的网格-渲染程序对,将其作为新的层次细节插入多层次细节中;
4-2)合并多余的层次细节。
从最近的层次细节开始到最远的层次细节,为每个层次细节Pi计算与其后第二层Pi+2的过渡偏差值,如果小于在Pi+2的距离di+2下求出的过渡偏差阈值,那么就在多层次细节中将层次Pi+1删除,即表示将层次Pi+1往层次Pi+2合并;
4-3)从最近的层次细节开始到最远的层次细节,输出每一个层次细节的距离、简化网格以及简化渲染程序的代码。
步骤4-1)到步骤4-3)中所述的过渡偏差值是指,将两层次的网格均放置在两层次中较远的距离上,分别使用各自的渲染程序渲染,并计算它们的图像偏差所得到的值。而过渡偏差阈值则是指允许两层次之间的最大过渡偏差值,过渡偏差阈值的计算公式为:
Figure PCTCN2017114176-appb-000003
其中Q′为输入的过渡质量系数,max_bound为输入的在距离dmax下的最大过渡偏差阈值。
与现有技术相比,本发明的优点在于:
a)提出了一种新的多分辨率下的模型表示,即简化网格与简化渲染程序的组合表示,相比单纯的网格或者着色器简化方法,本发明可以在各分辨率下平衡渲染效率的瓶颈,在产生相同图像偏差的基础上最大化渲染效率;
b)可以根据不同需要在渲染效率与质量之间做权衡,自动生成过渡平滑的多层次细节;
c)简化网格及着色器的效率高,而且提出并使用了线性搜索的方法,大大加速了在每个层次细节找出最优简化网格及渲染程序组合的过程,多层次细节生成效率更高,质量更好。
附图说明
图1为本实施例自动生成网格与着色器多层次细节方法的总体流程图;
图2为本实施例在多个距离上生成层次细节的子流程图;
图3为本实施例在指定距离上计算层次细节结果的子流程图;
图4为本实施例对多层次细节结果进行插入与合并的子流程图。
具体实施方式
下面将结合具体实施例和附图对本发明进行详细说明。
一种自动生成网格与着色器多层次细节的方法,如图1所示,包括:
1)使用基于表面信号拟合的着色器自动简化方法,对原始渲染程序So进行简化,得到80个最优的简化渲染程序{S},步骤如下;
1-1)将输入的原始渲染程序So的代码转换成抽象语法树T与程序依赖图G;
1-2)根据程序依赖图G,在抽象语法树T上对着色器的所有计算操作综合应用三条简化规则,分别是操作移除,代码移动以及移动到参数,得到2000个简化后着色器的抽象语法树,输出成各简化渲染程序的代码{Ss};
1-3)在最近距离dmin下使用{Ss}中所有渲染程序渲染原始网格,得到它们的渲染效率与图像偏差,根据渲染效率和图像偏差选择所有满足帕累托最优的简化渲染程序{Snear}有50个;
1-4)在最远距离dmax下使用{Ss}中所有渲染程序渲染原始网格,得到它们的渲染效率与图像偏差,根据渲染效率和图像偏差选择所有满足帕累托最优的简化渲染程序;{Sfar}有40个;
1-5)计算{Snear}与{Sfar}的并集即得最优的80个简化渲染程序{S}。
2)使用原始渲染程序So来进行渲染,基于图像空间的偏差,对原始网格Mo进行简化,从原始的20000个面片简化到1000个面片,并采样简化过程中的1000个简化网格{M},表示用这些样本代表所有可能的简化网格,其步骤包括:
2-1)使用原始渲染程序渲染原始网格得到原始图片Io,并使用原始图片作为当前图片Ic
2-2)对原始网格Mo的每一条边,使用原始渲染程序So渲染并计算该边简化后与简化前相比的图像偏差增量ei,并将其放入优先队列Q中,Q以图像偏差增量升序排列;
2-3)根据需要采样的简化网格个数1000,Mo面片数20000,以及目标面片数1000,计算面片数步进s=(20000-1000)/1000=19,表示每简化掉19个面片即输出当前简化网格到{M}中,将累计简化面片数Acc赋为0;
2-4)抛出优先队列Q中的第一条边并简化,同时更新该边周围受影响的所有边的图像偏差增量,重新按序放到优先队列Q中,并更新当前图片Ic,设本次简化掉的面片数为ci,Acc=Acc+ci,如果Acc大于步进19,则输出当前简化网格Mi到{M},且Acc=Acc-19;
2-5)重复步骤2-4)直至当前网格面片数少于或等于目标面片数1000。在步骤2-1)中图像偏差增量ei的计算按如下步骤进行:
a1)求出在网格上,与该边的任意顶点相接的所有面{F},再求出与{F}所有顶点相接的边{E},使用{E}的所有顶点所在的屏幕空间包围盒H作为受该边简化影响的屏幕像素范围;
a2)使用原始渲染程序So渲染Mo所有在H中或者与H有重叠部分的面片,得到简化图片Ie
a3)使用计算着色器分别计算在H所包含的像素范围内,Ie与Io的图像空间偏差e'0以及Ic与Io的图像空间偏差e’1,e'0与e’1的差即为该边的图像偏差增 量ei
3)在输入的最近与最远距离间生成8个层次细节{P},如图2所示,其步骤包括:
3-1)在最近距离dmin=1.7与最远距离dmax=20间设置8个距离值{d},距离公式为:
Figure PCTCN2017114176-appb-000004
其中i表示第几个距离值,l表示距离值的个数8(包括最近与最远距离);
3-2)在{d}中的每一个距离di下,求取渲染效率最高的一对简化网格与简化渲染程序。
步骤3-2)通过以下步骤使用找到指定距离下渲染效率最高的一对网格与渲染程序,如图3所示:
b1)计算当前距离di下的图像偏差阈值Ei,并按引入的图像偏差大小分别升序排列1000个简化网格{M}与80个简化渲染程序{S};
b2)从{M}中最后一个简化网格M999开始逐步往前递进,使用原始渲染程序So渲染途经的每一个简化网格,直到找到第一个在阈值e内的简化网格Mk,将该网格Mk与渲染程序So对作为当前结果S,测量该组合在多个视角下的平均渲染时间tmin
b3)从上一次选中的简化网格开始继续往前递进,使用下一个简化渲染程序渲染途经的每一个简化网格,直到找到第一个在阈值Ei内的简化网格,测量该网格-渲染程序对在多个视角下的平均渲染时间t,若t小于tmin则将tmin值改为t,并将当前结果S改为本次选出的网格-渲染程序对;
b4)重复b3)直到遍历所有简化渲染程序或所有简化网格,最终S即为距离di下渲染效率最高的一对网格与渲染程序。
在步骤b1)中所述的当前距离的图像偏差阈值是指,使用简化网格及简化渲染程序允许产生的最大图像偏差值,其计算公式为:
Figure PCTCN2017114176-appb-000005
其中d为当前距离,Q为输入的简化质量系数,范围是0到1,max_error为输入的在距离dmax下的最大图像偏差阈值。
4)在{P}中过渡不够平滑的相邻层次间插入新层次,并合并多余的层次细 节,如图4所示,其步骤包括:
4-1)将8个层次细节{P}按距离大小升序排列,{P’}为插入的新层次细节集合,初始值为空集;
4-2)从P0开始,在{P}中为每个层次细节Pi计算与下一层Pi+1之间的过渡偏差值,如果超过了在Pi+1的距离di+1下求出的过渡偏差阈值,那么就在Pi与Pi+1之间插入一个距离值,使得插入距离值后,所述的n个距离值呈非均匀分布,且保证在距离从小到大排列时,网格绘制并呈现在屏幕上的像素个数是等比减少;并按b1)到b4)所述步骤得到该距离下的网格-渲染程序对,将其作为新的层次细节加入{P’};
4-3)将{P’}中的层次细节按距离大小升序插入到{P}中,插入后共有12个层次细节;
4-4)从P0开始,为{P}中每个层次细节Pi计算与其后第二层Pi+2的过渡偏差值,如果小于在Pi+2的距离di+2下求出的过渡偏差阈值,那么就在{P}中将层次Pi+1删除,即表示将层次Pi+1往层次Pi+2合并;
4-5)合并完成后{P}中最终有5个层次细节,从头至尾输出每一个层次细节的距离、简化网格以及简化渲染程序。
步骤4-1)到步骤4-4)中所述的过渡偏差值是指将两层次的网格均放置在两层次中较远的距离上,分别使用各自的渲染程序渲染,并计算它们在图像空间的偏差所得到的值。而过渡偏差阈值则是指允许两层次之间的最大过渡偏差值,过渡偏差阈值的计算公式为:
Figure PCTCN2017114176-appb-000006
其中Q′为输入的过渡质量系数,max_bound为输入的在距离dmax下的最大过渡偏差阈值。

Claims (10)

  1. 一种自动生成网格与着色器多层次细节的方法,其特征在于,包括:
    1)使用着色器自动简化方法,对原始渲染程序进行简化,得到一系列简化渲染程序;
    2)使用原始渲染程序来进行渲染,基于图像空间的偏差,对原始网格进行简化,得到一系列不同简化程度的简化网格;
    3)在输入的最近与最远距离之间插入n个距离值,在各距离上搜索所有的简化渲染程序与简化网格,从中找到渲染效率最高的一对网格与渲染程序,作为当前距离的层次细节结果,并按距离增序排列组织成多层次细节;
    4)在多层次细节中超出过渡偏差阈值的相邻层次间插入新的层次细节,加入多层次细节中,再对其中小于过渡偏差阈值的相邻层次进行合并,得到最终的多层次细节结果。
  2. 如权利要求1所述的自动生成网格与着色器多层次细节的方法,其特征在于,所述的层次细节包括一个网格与相机的距离值,一个简化网格,以及一个被用于渲染该简化网格的简化渲染程序。
  3. 如权利要求1所述的自动生成网格与着色器多层次细节的方法,其特征在于,所述的n个距离值呈非均匀分布,保证在距离从小到大排列时,网格绘制并呈现在屏幕上的像素个数是等比减少的。
  4. 如权利要求1所述的自动生成网格与着色器多层次细节的方法,其特征在于,所述的两个层次细节之间的过渡偏差值,是指将两层次的网格均放置在两层次中较远的距离上,分别使用各自的渲染程序渲染到图片,并计算它们在图像空间的偏差所得到的值。
  5. 如权利要求1或4所述的自动生成网格与着色器多层次细节的方法,其特征在于,所述的在图像空间的偏差,简称图像偏差,是指给定的两张图片逐像素颜色的欧氏距离之和。
  6. 如权利要求1所述的自动生成网格与着色器多层次细节的方法,其特征在于,所述步骤1)包括如下步骤:
    1-1)将输入的原始渲染程序的代码转换成抽象语法树与程序依赖图;
    1-2)根据程序依赖图,在抽象语法树上对着色器的所有计算操作进行简化, 得到一系列简化后着色器的抽象语法树,输出它们各自的渲染程序代码;
    1-3)在输入的最近距离下使用步骤1-2)输出的所有简化渲染程序渲染原始网格,得到它们的渲染效率与图像偏差,根据渲染效率和图像偏差选择所有满足帕累托最优的简化渲染程序;
    1-4)在输入的最远距离下使用步骤1-2)输出的所有简化渲染程序渲染原始网格,得到它们的渲染效率与图像偏差,根据渲染效率和图像偏差选择所有满足帕累托最优的简化渲染程序;
    1-5)求步骤1-3)与步骤1-4)中得到的简化渲染程序的并集,结果即最优的一系列简化渲染程序。
  7. 如权利要求1所述的自动生成网格与着色器多层次细节的方法,其特征在于,所述步骤2)包括如下步骤:
    2-1)对原始网格的每一条边,使用原始渲染程序渲染并计算该边简化后与简化前相比的图像偏差增量,并将其放入以该增量为排序依据升序排列的优先队列Q中;
    2-2)根据需要采样的简化网格个数,原始面片数以及目标面片数,求出面片数步进s;
    2-3)抛出优先队列Q中的第一条边并简化,同时更新该边周围受影响的所有边的图像偏差增量,重新按序放到优先队列Q中,且每当简化面片数达到步进s即输出一个简化网格;
    2-4)重复步骤2-3)直至当前网格面片数少于或等于目标面片数。
  8. 如权利要求8所述的自动生成网格与着色器多层次细节的方法,其特征在于,所述的边简化后与简化前相比的图像偏差增量,是指先计算简化该边前网格与原始网格的图像偏差e,再计算简化该边后网格与原始网格的图像偏差e’,然后求e’与e的差所得到的结果。
  9. 如权利要求1所述的自动生成网格与着色器多层次细节的方法,其特征在于,所述步骤3)通过以下步骤找到指定距离下渲染效率最高的一对网格与渲染程序:
    S1)计算当前距离下的图像偏差阈值E,并按引入的图像偏差大小升序分别排列简化网格与简化渲染程序,图像偏差阈值计算公式如下:
    Figure PCTCN2017114176-appb-100001
    其中d为当前距离,dmin与dmax分别为输入的最近与最远距离,Q为输入的质量系数,范围是0到1,max_error为输入的在距离dmax下的最大图像偏差阈值。
    S2)从最后一个简化网格开始逐步往前递进,使用原始渲染程序渲染途经的每一个简化网格,直到找到第一个在阈值E内的简化网格,将该网格-渲染程序对作为当前结果S,测量该组合在多个视角下的平均渲染时间tmin
    S3)使用下一个简化渲染程序,从上一次选中的简化网格开始继续往前递进,渲染途经的每一个简化网格,直到找到第一个在阈值E内的简化网格,测量该网格-渲染程序对在多个视角下的平均渲染时间t,若t小于tmin则将tmin值改为t,并将当前结果S改为本次选出的网格-渲染程序对;
    S4)重复步骤S3)直到遍历所有简化渲染程序或所有简化网格,最终S即为该距离下渲染效率最高的一对网格与渲染程序。
  10. 如权利要求8所述的自动生成网格与着色器多层次细节的方法,其特征在于,步骤3)生成的多层次细节中,每一个层次细节P已经保存了一个距离值d,所述步骤4)包括如下步骤:
    4-1)插入新的层次细节
    从最近的层次细节开始到最远的层次细节,为每个层次细节Pi计算与下一层Pi+1之间的过渡偏差值,如果超过了在Pi+1的距离di+1下求出的过渡偏差阈值,那么就在Pi与Pi+1之间插入一个距离值,并使得插入距离值后,所述的n个距离值呈非均匀分布,且保证在距离从小到大排列时,网格绘制并呈现在屏幕上的像素个数是等比减少;得到该距离下的网格-渲染程序对,将其作为新的层次细节插入多层次细节中;
    4-2)合并多余的层次细节
    从最近的层次细节开始到最远的层次细节,为每个层次细节Pi计算与其后第二层Pi+2的过渡偏差值,如果小于在Pi+2的距离di+2下求出的过渡偏差阈值,那么就在多层次细节中将层次Pi+1删除,即表示将层次Pi+1往层次Pi+2合并;
    4-3)从最近的层次细节开始到最远的层次细节,输出每一个层次细节的 距离、简化网格以及简化渲染程序的代码。
PCT/CN2017/114176 2016-12-23 2017-12-01 一种自动生成网格与着色器多层次细节的方法 WO2018113502A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201611207988.4 2016-12-23
CN201611207988.4A CN106652008B (zh) 2016-12-23 2016-12-23 一种自动生成网格与着色器多层次细节的方法

Publications (1)

Publication Number Publication Date
WO2018113502A1 true WO2018113502A1 (zh) 2018-06-28

Family

ID=58826987

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/114176 WO2018113502A1 (zh) 2016-12-23 2017-12-01 一种自动生成网格与着色器多层次细节的方法

Country Status (2)

Country Link
CN (1) CN106652008B (zh)
WO (1) WO2018113502A1 (zh)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112116690A (zh) * 2019-06-19 2020-12-22 腾讯科技(深圳)有限公司 视频特效生成方法、装置及终端
CN114494553A (zh) * 2022-01-21 2022-05-13 杭州游聚信息技术有限公司 基于渲染时间估计和lod选择的实时渲染方法、系统及设备
CN115830201A (zh) * 2022-11-22 2023-03-21 光线云(杭州)科技有限公司 一种基于聚簇的粒子系统优化渲染方法和装置
CN117910361A (zh) * 2024-03-14 2024-04-19 南京理工大学 一种基于仿真分析的阵列天线装配性能数字孪生模型快速重构方法

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106652008B (zh) * 2016-12-23 2019-08-13 浙江大学 一种自动生成网格与着色器多层次细节的方法
CN110969688B (zh) * 2019-11-29 2023-04-11 重庆市勘测院 一种实景三维模型实时匀色方法
CN111068316B (zh) * 2019-12-25 2023-06-27 北京像素软件科技股份有限公司 游戏帧数调节方法、装置、存储介质和电子设备
CN111402354B (zh) * 2020-03-16 2020-12-25 浙江大学 适用于光学穿透式头戴显示器的颜色对比增强绘制方法、装置以及系统
CN112258411B (zh) * 2020-10-22 2021-07-13 浙江大学 基于定义域和值域的函数近似的着色器自动滤波方法、装置和系统

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102663811A (zh) * 2012-03-23 2012-09-12 北京师范大学 一种基于空间认知的大场景城市建筑实时三维可视化的方法
US20160104458A1 (en) * 2014-10-10 2016-04-14 Seok Hoon Kim Graphics processing unit for adjusting level-of-detail, method of operating the same, and devices including the same
CN106652008A (zh) * 2016-12-23 2017-05-10 浙江大学 一种自动生成网格与着色器多层次细节的方法

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102663811A (zh) * 2012-03-23 2012-09-12 北京师范大学 一种基于空间认知的大场景城市建筑实时三维可视化的方法
US20160104458A1 (en) * 2014-10-10 2016-04-14 Seok Hoon Kim Graphics processing unit for adjusting level-of-detail, method of operating the same, and devices including the same
CN106652008A (zh) * 2016-12-23 2017-05-10 浙江大学 一种自动生成网格与着色器多层次细节的方法

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112116690A (zh) * 2019-06-19 2020-12-22 腾讯科技(深圳)有限公司 视频特效生成方法、装置及终端
CN114494553A (zh) * 2022-01-21 2022-05-13 杭州游聚信息技术有限公司 基于渲染时间估计和lod选择的实时渲染方法、系统及设备
CN114494553B (zh) * 2022-01-21 2022-08-23 杭州游聚信息技术有限公司 基于渲染时间估计和lod选择的实时渲染方法、系统及设备
CN115830201A (zh) * 2022-11-22 2023-03-21 光线云(杭州)科技有限公司 一种基于聚簇的粒子系统优化渲染方法和装置
CN115830201B (zh) * 2022-11-22 2024-05-24 光线云(杭州)科技有限公司 一种基于聚簇的粒子系统优化渲染方法和装置
CN117910361A (zh) * 2024-03-14 2024-04-19 南京理工大学 一种基于仿真分析的阵列天线装配性能数字孪生模型快速重构方法

Also Published As

Publication number Publication date
CN106652008A (zh) 2017-05-10
CN106652008B (zh) 2019-08-13

Similar Documents

Publication Publication Date Title
WO2018113502A1 (zh) 一种自动生成网格与着色器多层次细节的方法
US9754405B1 (en) System, method and computer-readable medium for organizing and rendering 3D voxel models in a tree structure
US11069124B2 (en) Systems and methods for reducing rendering latency
US11138782B2 (en) Systems and methods for rendering optical distortion effects
Steinbrücker et al. Volumetric 3D mapping in real-time on a CPU
CN113178014B (zh) 场景模型渲染方法、装置、电子设备和存储介质
JP5111638B2 (ja) パラメトリック曲線をより小さなサブパッチに分割する装置およびその方法
US8830254B2 (en) Systems and methods for graph rendering
US9177416B2 (en) Space skipping for multi-dimensional image rendering
US7463261B1 (en) Three-dimensional image compositing on a GPU utilizing multiple transformations
US8725466B2 (en) System and method for hybrid solid and surface modeling for computer-aided design environments
US10699467B2 (en) Computer-graphics based on hierarchical ray casting
US10553012B2 (en) Systems and methods for rendering foveated effects
US20130127847A1 (en) System and Method for Interactive Image-based Modeling of Curved Surfaces Using Single-view and Multi-view Feature Curves
US6999078B1 (en) Method of forming a perspective rendering from a voxel space
CN104167015B (zh) 一种基于表面信号拟合的着色器简化方法、装置及图形渲染方法
CN104183008A (zh) 一种基于表面信号拟合和曲面细分的着色器简化方法、装置及图形渲染方法
US20240062469A1 (en) Data processing method, apparatus, device, and medium
CN115731365A (zh) 基于二维图像的网格模型重建方法、系统、装置及介质
CN107316324B (zh) 基于cuda实现的实时立体匹配及优化的方法
CN115797561A (zh) 三维重建方法、设备及可读存储介质
CN108520532B (zh) 识别视频中物体运动方向的方法及装置
US20080074435A1 (en) Texture filtering apparatus, texture mapping apparatus, and method and program therefor
KR20230167746A (ko) 메시 정점 위치에 대한 반복 및 루트 찾기를 사용하여 표면에 근사하는 폴리곤 메시를 생성하기 위한 방법 및 시스템
US10424106B1 (en) Scalable computer image synthesis

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17883089

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17883089

Country of ref document: EP

Kind code of ref document: A1