CN114926579A - Rendering method and device of virtual three-dimensional model and electronic terminal - Google Patents
Rendering method and device of virtual three-dimensional model and electronic terminal Download PDFInfo
- Publication number
- CN114926579A CN114926579A CN202210574259.1A CN202210574259A CN114926579A CN 114926579 A CN114926579 A CN 114926579A CN 202210574259 A CN202210574259 A CN 202210574259A CN 114926579 A CN114926579 A CN 114926579A
- Authority
- CN
- China
- Prior art keywords
- virtual
- target
- dimensional model
- transparency
- angle
- Prior art date
- Legal status (The legal status 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 status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 79
- 238000009877 rendering Methods 0.000 title claims abstract description 67
- 230000015654 memory Effects 0.000 claims description 27
- 238000003860 storage Methods 0.000 claims description 15
- 238000004590 computer program Methods 0.000 claims description 11
- 230000000694 effects Effects 0.000 abstract description 56
- 238000010586 diagram Methods 0.000 description 13
- 230000008569 process Effects 0.000 description 10
- 230000006870 function Effects 0.000 description 8
- 238000004891 communication Methods 0.000 description 7
- 238000012545 processing Methods 0.000 description 7
- 230000007704 transition Effects 0.000 description 7
- 230000003993 interaction Effects 0.000 description 4
- 230000008859 change Effects 0.000 description 3
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 239000000779 smoke Substances 0.000 description 3
- 230000005540 biological transmission Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000004519 manufacturing process Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 239000002245 particle Substances 0.000 description 2
- XLYOFNOQVPJJNP-UHFFFAOYSA-N water Substances O XLYOFNOQVPJJNP-UHFFFAOYSA-N 0.000 description 2
- 230000009471 action Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000008901 benefit Effects 0.000 description 1
- 230000002457 bidirectional effect Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000000802 evaporation-induced self-assembly Methods 0.000 description 1
- 238000003780 insertion Methods 0.000 description 1
- 230000037431 insertion Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000013341 scale-up Methods 0.000 description 1
- 230000009466 transformation Effects 0.000 description 1
- 238000013519 translation Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T15/00—3D [Three Dimensional] image rendering
- G06T15/04—Texture mapping
-
- A—HUMAN NECESSITIES
- A63—SPORTS; GAMES; AMUSEMENTS
- A63F—CARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
- A63F13/00—Video games, i.e. games using an electronically generated display having two or more dimensions
- A63F13/50—Controlling the output signals based on the game progress
- A63F13/52—Controlling the output signals based on the game progress involving aspects of the displayed game scene
- A63F13/525—Changing parameters of virtual cameras
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T13/00—Animation
- G06T13/20—3D [Three Dimensional] animation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T15/00—3D [Three Dimensional] image rendering
- G06T15/10—Geometric effects
- G06T15/20—Perspective computation
- G06T15/205—Image-based rendering
-
- A—HUMAN NECESSITIES
- A63—SPORTS; GAMES; AMUSEMENTS
- A63F—CARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
- A63F2300/00—Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game
- A63F2300/60—Methods for processing data by generating or executing the game program
- A63F2300/66—Methods for processing data by generating or executing the game program for rendering three dimensional images
- A63F2300/6638—Methods for processing data by generating or executing the game program for rendering three dimensional images for simulating particle systems, e.g. explosion, fireworks
-
- A—HUMAN NECESSITIES
- A63—SPORTS; GAMES; AMUSEMENTS
- A63F—CARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
- A63F2300/00—Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game
- A63F2300/60—Methods for processing data by generating or executing the game program
- A63F2300/66—Methods for processing data by generating or executing the game program for rendering three dimensional images
- A63F2300/6653—Methods for processing data by generating or executing the game program for rendering three dimensional images for altering the visibility of an object, e.g. preventing the occlusion of an object, partially hiding an object
-
- A—HUMAN NECESSITIES
- A63—SPORTS; GAMES; AMUSEMENTS
- A63F—CARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
- A63F2300/00—Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game
- A63F2300/60—Methods for processing data by generating or executing the game program
- A63F2300/66—Methods for processing data by generating or executing the game program for rendering three dimensional images
- A63F2300/6661—Methods for processing data by generating or executing the game program for rendering three dimensional images for changing the position of the virtual camera
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2210/00—Indexing scheme for image generation or computer graphics
- G06T2210/56—Particle system, point based geometry or rendering
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2210/00—Indexing scheme for image generation or computer graphics
- G06T2210/62—Semi-transparency
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer Graphics (AREA)
- Multimedia (AREA)
- Computing Systems (AREA)
- Geometry (AREA)
- Image Generation (AREA)
Abstract
本发明提供了一种虚拟三维模型的渲染方法、装置以及电子终端,涉及游戏技术领域,缓解了现有技术中虚拟三维模型的整体显示效果较差的技术问题。该方法包括:根据虚拟相机的拍摄方向,确定所述虚拟三维模型的纹理贴图的所在平面相对于所述虚拟相机的拍摄方向的目标相对角度;每个所述相对角度对应有指定透明程度,所述相对角度越大则对应的所述指定透明程度越大;确定所述目标相对角度对应的目标指定透明程度;按照所述目标指定透明程度渲染所述纹理贴图,得到所述虚拟三维模型的渲染结果。
The invention provides a rendering method, device and electronic terminal for a virtual three-dimensional model, which relate to the technical field of games and alleviate the technical problem of poor overall display effect of the virtual three-dimensional model in the prior art. The method includes: according to the shooting direction of the virtual camera, determining the target relative angle of the plane where the texture map of the virtual three-dimensional model is located relative to the shooting direction of the virtual camera; each of the relative angles corresponds to a specified degree of transparency, and the The larger the relative angle is, the larger the corresponding specified transparency degree is; the target specified transparency degree corresponding to the target relative angle is determined; the texture map is rendered according to the specified target transparency degree, and the rendering of the virtual three-dimensional model is obtained. result.
Description
技术领域technical field
本申请涉及游戏技术领域,尤其是涉及一种虚拟三维模型的渲染方法、装置以及电子终端。The present application relates to the technical field of games, and in particular, to a method, device and electronic terminal for rendering a virtual three-dimensional model.
背景技术Background technique
目前,游戏中常对虚拟三维模型进行渲染,使其生成对应的特效,例如火焰特效、烟雾特效等等。常见的制作手法包括公告板、序列帧、模型插片以及配合特效粒子等等。At present, virtual three-dimensional models are often rendered in games to generate corresponding special effects, such as flame effects, smoke effects, and the like. Common production methods include bulletin boards, sequence frames, model inserts, and special effects particles.
但是,对于现有的这些虚拟三维模型的渲染方法,存在着虚拟三维模型的整体显示效果较差的技术问题,影响玩家的游戏体验。However, for these existing rendering methods of virtual three-dimensional models, there is a technical problem that the overall display effect of the virtual three-dimensional models is poor, which affects the game experience of players.
发明内容SUMMARY OF THE INVENTION
本申请的目的在于提供一种虚拟三维模型的渲染方法、装置以及电子终端,以缓解现有技术中虚拟三维模型的整体显示效果较差的技术问题。The purpose of the present application is to provide a method, device and electronic terminal for rendering a virtual three-dimensional model, so as to alleviate the technical problem of poor overall display effect of the virtual three-dimensional model in the prior art.
第一方面,本申请实施例提供了一种虚拟三维模型的渲染方法,包括:In a first aspect, an embodiment of the present application provides a method for rendering a virtual three-dimensional model, including:
根据虚拟相机的拍摄方向,确定所述虚拟三维模型的纹理贴图的所在平面相对于所述虚拟相机的拍摄方向的目标相对角度;每个所述相对角度对应有指定透明程度,所述相对角度越大则对应的所述指定透明程度越大;According to the shooting direction of the virtual camera, determine the target relative angle of the plane where the texture map of the virtual three-dimensional model is located relative to the shooting direction of the virtual camera; each relative angle corresponds to a specified degree of transparency, and the higher the relative angle The larger the specified transparency, the greater the corresponding degree of transparency;
确定所述目标相对角度对应的目标指定透明程度;determining the target specified transparency degree corresponding to the target relative angle;
按照所述目标指定透明程度渲染所述纹理贴图,得到所述虚拟三维模型的渲染结果。The texture map is rendered according to the specified transparency degree of the target, and a rendering result of the virtual three-dimensional model is obtained.
在一个可能的实现中,所述相对角度为0度时对应的所述指定透明程度为不透明,所述相对角度为90度时对应的所述指定透明程度为完全透明。In a possible implementation, when the relative angle is 0 degrees, the corresponding specified transparency degree is opaque, and when the relative angle is 90 degrees, the corresponding specified transparency degree is completely transparent.
在一个可能的实现中,所述相对角度在预设角度范围时,对应的所述指定透明程度为完全透明;其中,所述预设角度范围为90度以上的预设第一角度值至90度以下的预设第二角度值之间的角度范围。In a possible implementation, when the relative angle is within a preset angle range, the corresponding specified transparency degree is completely transparent; wherein, the preset angle range is a preset first angle value above 90 degrees to 90 degrees The angle range between the preset second angle values below degrees.
在一个可能的实现中,所述虚拟三维模型和所述虚拟相机所处的虚拟场景中还包含通过终端设备控制的虚拟角色,所述虚拟角色与所述虚拟相机之间为绑定关系;所述虚拟三维模型的渲染方法还包括:In a possible implementation, the virtual scene where the virtual three-dimensional model and the virtual camera are located also includes a virtual character controlled by a terminal device, and the virtual character and the virtual camera are in a binding relationship; The rendering method of the virtual three-dimensional model further includes:
根据所述终端设备对所述虚拟角色的控制指令,确定针对所述虚拟角色的视角方向;Determine the viewing angle direction for the virtual character according to the control instruction of the virtual character by the terminal device;
根据所述视角方向确定所述虚拟相机的拍摄方向。The shooting direction of the virtual camera is determined according to the viewing angle direction.
在一个可能的实现中,所述虚拟三维模型包含多个所述纹理贴图;所述虚拟三维模型的渲染方法还包括:In a possible implementation, the virtual three-dimensional model includes a plurality of the texture maps; the rendering method for the virtual three-dimensional model further includes:
根据所述虚拟相机的拍摄方向,确定相对于所述拍摄方向的所述虚拟三维模型的前后至少部分重叠的多个目标纹理贴图;According to the shooting direction of the virtual camera, determining a plurality of target texture maps that at least partially overlap the front and rear of the virtual three-dimensional model with respect to the shooting direction;
对所述目标纹理贴图的纹理显示参数进行调整,以减少按照所述目标指定透明程度渲染的多个所述目标纹理贴图前后重叠时产生的重影。The texture display parameters of the target texture map are adjusted to reduce ghosting generated when a plurality of the target texture maps rendered according to the specified transparency level of the target overlap with each other.
在一个可能的实现中,所述纹理显示参数包括下述任意一项或多项:In a possible implementation, the texture display parameters include any one or more of the following:
明亮度、曝光度、色彩对比度、色彩饱和度、色差、色号。Brightness, exposure, color contrast, color saturation, color difference, color number.
在一个可能的实现中,所述对所述目标纹理贴图的纹理显示参数进行调整,以减少按照所述目标指定透明程度渲染的多个所述目标纹理贴图前后重叠时产生的重影,包括:In a possible implementation, adjusting the texture display parameters of the target texture map to reduce ghosting generated when multiple target texture maps rendered according to the specified transparency level of the target overlap before and after, including:
确定第一目标纹理贴图相对于所述拍摄方向映射至第二目标纹理贴图中的重叠部分贴图;determining that the first target texture map is mapped to the overlapping portion map in the second target texture map relative to the shooting direction;
对所述重叠部分贴图的纹理显示参数进行调整,以减少按照所述目标指定透明程度渲染的所述第一目标纹理贴图和所述第二目标纹理贴图之间前后重叠时产生的重影。Adjusting the texture display parameter of the overlapping part map to reduce the ghosting generated when the first target texture map and the second target texture map rendered according to the specified transparency level of the target overlap back and forth.
在一个可能的实现中,所述根据虚拟相机的拍摄方向,确定所述虚拟三维模型的纹理贴图的所在平面相对于所述虚拟相机的拍摄方向的目标相对角度,包括:In a possible implementation, the determining, according to the shooting direction of the virtual camera, the relative target angle of the plane where the texture map of the virtual three-dimensional model is located relative to the shooting direction of the virtual camera, including:
将所述虚拟相机在所述虚拟场景中的第一坐标系转换为所述虚拟相机在所述虚拟三维模型的模型空间中的第二坐标系;converting the first coordinate system of the virtual camera in the virtual scene into a second coordinate system of the virtual camera in the model space of the virtual three-dimensional model;
通过所述第二坐标系确定所述虚拟三维模型的纹理贴图的所在平面相对于所述虚拟相机的拍摄方向的目标相对角度。The target relative angle of the plane where the texture map of the virtual three-dimensional model is located relative to the shooting direction of the virtual camera is determined by the second coordinate system.
在一个可能的实现中,所述虚拟三维模型的模型空间中所述若干个纹理贴图穿插的轴心点为所述第二坐标系的原点;In a possible implementation, the pivot point where the plurality of texture maps are interspersed in the model space of the virtual three-dimensional model is the origin of the second coordinate system;
所述通过所述第二坐标系确定所述虚拟三维模型的纹理贴图的所在平面相对于所述虚拟相机的拍摄方向的目标相对角度,包括:The determining, by using the second coordinate system, the target relative angle of the plane where the texture map of the virtual three-dimensional model is located relative to the shooting direction of the virtual camera, includes:
以所述第二坐标系中的所述原点作为中心点,确定所述虚拟三维模型的每个所述纹理贴图的所在平面相对于所述虚拟相机的拍摄方向的目标相对角度。Taking the origin in the second coordinate system as a center point, a target relative angle of the plane where each texture map of the virtual three-dimensional model is located relative to the shooting direction of the virtual camera is determined.
在一个可能的实现中,所述确定所述目标相对角度对应的目标指定透明程度,包括:In a possible implementation, the determining the target specified transparency degree corresponding to the relative angle of the target includes:
将所述目标相对角度转换为目标角度系数,并确定所述目标角度系数对应的目标指定透明系数;每个所述角度系数对应有指定透明系数;Converting the target relative angle into a target angle coefficient, and determining a target specified transparency coefficient corresponding to the target angle coefficient; each of the angle coefficients corresponds to a specified transparency coefficient;
将所述目标指定透明系数和预设透明参数相乘,得到所述目标相对角度对应的目标指定透明程度的数值。Multiplying the target-specified transparency coefficient and a preset transparency parameter to obtain a numerical value of the target-specified transparency degree corresponding to the target relative angle.
在一个可能的实现中,所述角度系数为0至1之间的数值;其中,0表示所述虚拟相机垂直朝向于所述纹理贴图的一侧平面时的所述角度系数为0,1表示所述虚拟相机垂直朝向于所述纹理贴图的另一侧平面时的所述角度系数为1;In a possible implementation, the angle coefficient is a value between 0 and 1; wherein, 0 indicates that the angle coefficient is 0 when the virtual camera is vertically oriented to one side plane of the texture map, and 1 indicates that the angle coefficient is 0. When the virtual camera is vertically oriented to the other side plane of the texture map, the angle coefficient is 1;
所述相对角度为0度时所述角度系数为0或1;所述相对角度为90度时所述角度系数为0.5。When the relative angle is 0 degrees, the angle coefficient is 0 or 1; when the relative angle is 90 degrees, the angle coefficient is 0.5.
在一个可能的实现中,所述指定透明系数为0至1之间的数值;其中,1表示所述虚拟相机垂直朝向于所述纹理贴图的任一侧平面时的所述指定透明程度为不透明,0表示所述虚拟相机平行朝向于所述纹理贴图的平面时的所述指定透明程度为完全透明。In a possible implementation, the specified transparency coefficient is a value between 0 and 1; wherein, 1 indicates that the specified transparency degree is opaque when the virtual camera is vertically oriented to any side plane of the texture map , 0 indicates that the specified degree of transparency when the virtual camera is parallel to the plane of the texture map is completely transparent.
在一个可能的实现中,所述若干个纹理贴图的数量为两个;两个所述纹理贴图通过垂直交叉的方式穿插形成的所述虚拟三维模型。In a possible implementation, the number of the several texture maps is two; the virtual three-dimensional model is formed by interspersing the two texture maps in the manner of vertical intersection.
第二方面,提供了一种虚拟三维模型的渲染装置,包括:In a second aspect, a device for rendering a virtual three-dimensional model is provided, including:
第一确定模块,用于根据虚拟相机的拍摄方向,确定所述虚拟三维模型的纹理贴图的所在平面相对于所述虚拟相机的拍摄方向的目标相对角度;每个所述相对角度对应有指定透明程度,所述相对角度越大则对应的所述指定透明程度越大;a first determination module, configured to determine, according to the shooting direction of the virtual camera, the target relative angle of the plane where the texture map of the virtual three-dimensional model is located relative to the shooting direction of the virtual camera; each of the relative angles corresponds to a specified transparent degree, the greater the relative angle, the greater the corresponding specified transparency degree;
第二确定模块,用于确定所述目标相对角度对应的目标指定透明程度;a second determining module, configured to determine the target specified transparency degree corresponding to the relative angle of the target;
渲染模块,用于按照所述目标指定透明程度渲染所述纹理贴图,得到所述虚拟三维模型的渲染结果。A rendering module, configured to render the texture map according to the specified transparency degree of the target, and obtain a rendering result of the virtual three-dimensional model.
第三方面,本申请实施例又提供了一种电子终端,包括存储器、处理器,所述存储器中存储有可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现上述第一方面所述的方法的步骤。In a third aspect, an embodiment of the present application further provides an electronic terminal, including a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the processor executes the computer program Implement the steps of the method described in the first aspect above.
第四方面,本申请实施例又提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机可运行指令,所述计算机可运行指令在被处理器调用和运行时,所述计算机可运行指令促使所述处理器运行上述第一方面所述的方法。In a fourth aspect, embodiments of the present application further provide a computer-readable storage medium, where the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are invoked and executed by a processor, the Computer-executable instructions cause the processor to perform the method of the first aspect above.
本申请实施例带来了以下有益效果:The embodiments of the present application have brought the following beneficial effects:
本申请实施例提供的一种虚拟三维模型的渲染方法、装置以及电子终端,首先根据虚拟相机的拍摄方向确定虚拟三维模型的纹理贴图的所在平面相对于虚拟相机的拍摄方向的目标相对角度,其中每个相对角度对应有指定透明程度,相对角度越大则对应的指定透明程度越大,之后确定目标相对角度对应的目标指定透明程度,从而按照目标指定透明程度渲染纹理贴图,得到虚拟三维模型的渲染结果。本方案中纹理贴图的显示透明度根据虚拟三维模型本身与虚拟相机的相对角度而变化,即虚拟相机面向于纹理贴图的平面的目标相对角度越大则其对应渲染出的透明程度越大,使得纹理贴图侧面面对虚拟摄像机的时候更加透明,纹理贴图正面面对虚拟摄像机时最不透明度,从而使得侧面看虚拟三维模型中的纹理贴图时不会再有插片痕迹,还不会影响其他角度的纹理贴图展示效果,且不同角度的显示效果过渡自然,由纹理贴图渲染得到的虚拟三维模型从各个角度观察得到的显示效果一致,进而整体降低虚拟三维模型的插片感,提升虚拟三维模型的整体显示效果,缓解了现有技术中虚拟三维模型的整体显示效果较差的技术问题。In a method, device, and electronic terminal for rendering a virtual three-dimensional model provided by the embodiments of the present application, first, according to the shooting direction of the virtual camera, the relative angle of the target of the plane where the texture map of the virtual three-dimensional model is located relative to the shooting direction of the virtual camera is determined, wherein Each relative angle corresponds to a specified degree of transparency. The larger the relative angle is, the greater the specified degree of transparency is. Then, the specified degree of transparency of the target corresponding to the relative angle of the target is determined, and the texture map is rendered according to the specified degree of transparency of the target, and the virtual 3D model is obtained. render result. In this solution, the display transparency of the texture map changes according to the relative angle between the virtual 3D model itself and the virtual camera, that is, the greater the relative angle of the virtual camera facing the plane of the texture map, the greater the degree of transparency it renders, which makes the texture more transparent. When the side of the texture map faces the virtual camera, it is more transparent, and the texture map is the most opaque when the front side of the texture map faces the virtual camera, so that when looking at the texture map in the virtual 3D model from the side, there will be no traces of inserts, and it will not affect other angles. The texture map shows the effect, and the display effect from different angles transitions naturally. The virtual 3D model rendered by the texture map has the same display effect from all angles, thereby reducing the overall sense of inserting the virtual 3D model and improving the overall appearance of the virtual 3D model. The display effect alleviates the technical problem of poor overall display effect of the virtual three-dimensional model in the prior art.
附图说明Description of drawings
为了更清楚地说明本申请具体实施方式或现有技术中的技术方案,下面将对具体实施方式或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本申请的一些实施方式,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the specific embodiments of the present application or the technical solutions in the prior art, the accompanying drawings that need to be used in the description of the specific embodiments or the prior art will be briefly introduced below. The drawings are some embodiments of the present application. For those of ordinary skill in the art, other drawings can also be obtained from these drawings without any creative effort.
图1为本申请实施例提供的应用场景示意图;1 is a schematic diagram of an application scenario provided by an embodiment of the present application;
图2示出了本申请实施例提供的一种电子终端的结构示意图;FIG. 2 shows a schematic structural diagram of an electronic terminal provided by an embodiment of the present application;
图3为本申请实施例提供的一种电子终端示意图;3 is a schematic diagram of an electronic terminal according to an embodiment of the present application;
图4为本申请实施例提供的一种虚拟三维模型的渲染方法的流程示意图;4 is a schematic flowchart of a method for rendering a virtual three-dimensional model according to an embodiment of the present application;
图5为本申请实施例提供的显示一种纹理贴图显示状态示意图;FIG. 5 is a schematic diagram of displaying a texture map display state according to an embodiment of the present application;
图6为本申请实施例提供的显示一种虚拟相机与纹理贴图平面示意图;FIG. 6 is a schematic plan view showing a virtual camera and a texture map according to an embodiment of the present application;
图7为本申请实施例提供的显示另一种虚拟相机与纹理贴图平面示意图;FIG. 7 is a schematic plan view of displaying another virtual camera and a texture map according to an embodiment of the present application;
图8为本申请实施例提供的显示另一种虚拟相机与纹理贴图平面示意图;FIG. 8 is a schematic plan view of displaying another virtual camera and a texture map according to an embodiment of the present application;
图9为本申请实施例提供的显示另一种虚拟相机与纹理贴图平面示意图;FIG. 9 is a schematic plan view of displaying another virtual camera and a texture map according to an embodiment of the present application;
图10为本申请实施例提供的一种虚拟三维模型的渲染装置的结构示意图。FIG. 10 is a schematic structural diagram of an apparatus for rendering a virtual three-dimensional model according to an embodiment of the present application.
具体实施方式Detailed ways
为使本申请实施例的目的、技术方案和优点更加清楚,下面将结合附图对本申请的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to make the purposes, technical solutions and advantages of the embodiments of the present application more clear, the technical solutions of the present application will be described clearly and completely below with reference to the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present application, not all of them. example. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
本申请实施例中所提到的术语“包括”和“具有”以及它们的任何变形,意图在于覆盖不排他的包含。例如包含了一系列步骤或单元的过程、方法、系统、产品或设备没有限定于已列出的步骤或单元,而是可选地还包括其他没有列出的步骤或单元,或可选地还包括对于这些过程、方法、产品或设备固有的其它步骤或单元。The terms "comprising" and "having" mentioned in the embodiments of the present application and any modifications thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device comprising a series of steps or units is not limited to the listed steps or units, but optionally also includes other unlisted steps or units, or optionally also Include other steps or units inherent to these processes, methods, products or devices.
火焰特效是游戏中常见的效果,常见的制作手法有公告板,序列帧,模型插片,配合特效粒子等。实际应用中往往需要制作带方向的火焰附着于角色上,需要根据角色自转保持火焰方向一起旋转。在这样的前提下,公告板的方案不可行。特效公告板技术是指一直面向虚拟相机渲染的效果,火焰模型使用公告板,始终面对相机,一旦火焰带有方向性,偏左或者偏右的话,那么角色模型在自转的时候,方向就将出现错误。模型插片技术首先画出模型的基础色,进行UV(UVW坐标系中的UV坐标)流动和UV扭曲,UV流动或UV平移是指沿着水平(U)方向亦或垂直(V)方向移动纹理的UV坐标,以产生复杂的动画错觉。UV流动可以创建诸如火焰、流水或烟雾之类的效果。UV扭动或UV扭曲是指沿着水平(U)方向亦或垂直(V)方向进行扭曲的UV坐标,以产生复杂的动画错觉。UV扭曲可以创建诸如火焰、流水或烟雾之类的效果。但是采用模型十字插片制作火焰的话,模型插片的效果侧面有明显痕迹。Flame effects are common effects in games. Common production methods include bulletin boards, sequence frames, model inserts, and special effects particles. In practical applications, it is often necessary to make a directional flame attached to the character, and it is necessary to keep the flame direction rotating together according to the character's rotation. Under such a premise, the bulletin board scheme is not feasible. The special effect bulletin board technology refers to the effect of rendering always facing the virtual camera. The flame model uses the bulletin board and always faces the camera. Once the flame is directional, if it is left or right, then when the character model rotates, the direction will be the same. An error occurred. The model insertion technology first draws the basic color of the model, and performs UV (UV coordinates in the UVW coordinate system) flow and UV distortion. UV flow or UV translation refers to moving along the horizontal (U) direction or the vertical (V) direction. UV coordinates of textures to create complex animation illusions. UV flow can create effects such as fire, flowing water, or smoke. UV Twist or UV Warp refers to UV coordinates that are twisted in either the horizontal (U) or vertical (V) direction to create the illusion of complex animation. UV warping can create effects such as fire, water, or smoke. However, if the model cross insert is used to make the flame, there are obvious traces on the side of the effect of the model insert.
基于此,本申请实施例提供了一种虚拟三维模型的渲染方法、装置以及电子终端,通过该方法可以缓解现有技术中虚拟三维模型的整体显示效果较差的技术问题。Based on this, the embodiments of the present application provide a method, device, and electronic terminal for rendering a virtual three-dimensional model, through which the technical problem of poor overall display effect of the virtual three-dimensional model in the prior art can be alleviated.
在本申请其中一种实施例中,虚拟三维模型的渲染方法可以运行于终端设备、服务器设备等电子终端。其中,终端设备可以为本地终端设备。当虚拟三维模型的渲染方法运行于服务器时,该方法则可以基于云交互系统来实现与执行,其中,云交互系统包括服务器和客户端设备。In one of the embodiments of the present application, the method for rendering a virtual three-dimensional model may run on an electronic terminal such as a terminal device and a server device. The terminal device may be a local terminal device. When the method for rendering a virtual three-dimensional model runs on a server, the method can be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and a client device.
在一可选的实施方式中,云交互系统下可以运行各种云应用,例如:云游戏。以云游戏为例,云游戏是指以云计算为基础的游戏方式。在云游戏的运行模式下,游戏程序的运行主体和游戏画面呈现主体是分离的,虚拟三维模型的渲染方法的储存与运行是在云游戏服务器上完成的,客户端设备的作用用于数据的接收、发送以及游戏画面的呈现,举例而言,客户端设备可以是靠近用户侧的具有数据传输功能的显示设备,如,移动终端、电视机、计算机、掌上电脑等;但是进行信息处理的终端设备为云端的云游戏服务器。在进行游戏时,玩家操作客户端设备向云游戏服务器发送操作指令,云游戏服务器根据操作指令运行游戏,将游戏画面等数据进行编码压缩,通过网络返回客户端设备,最后,通过客户端设备进行解码并输出游戏画面。In an optional implementation manner, various cloud applications, such as cloud games, can be run under the cloud interaction system. Taking cloud gaming as an example, cloud gaming refers to a game method based on cloud computing. In the running mode of the cloud game, the running main body of the game program and the main body of the game screen presentation are separated, the storage and operation of the rendering method of the virtual 3D model are completed on the cloud game server, and the function of the client device is used for data storage and operation. Reception, transmission, and presentation of game screens. For example, the client device can be a display device with a data transmission function close to the user side, such as a mobile terminal, a TV, a computer, a handheld computer, etc.; but a terminal that processes information The device is a cloud game server in the cloud. When playing the game, the player operates the client device to send operation instructions to the cloud game server, and the cloud game server runs the game according to the operation instructions, encodes and compresses the game screen and other data, and returns it to the client device through the network. Decode and output game screen.
在一可选的实施方式中,终端设备可以为本地终端设备。以游戏为例,本地终端设备存储有游戏程序并用于呈现游戏画面。本地终端设备用于通过图形用户界面与玩家进行交互,即,常规的通过电子终端设备下载安装游戏程序并运行。该本地终端设备将图形用户界面提供给玩家的方式可以包括多种,例如,可以渲染显示在终端的显示屏上,或者,通过全息投影提供给玩家。举例而言,本地终端设备可以包括显示屏和处理器,该显示屏用于呈现图形用户界面,该图形用户界面包括游戏画面,该处理器用于运行该游戏、生成图形用户界面以及控制图形用户界面在显示屏上的显示。In an optional implementation manner, the terminal device may be a local terminal device. Taking a game as an example, a local terminal device stores a game program and is used to present a game screen. The local terminal device is used to interact with the player through a graphical user interface, that is, the game program is conventionally downloaded, installed and executed through the electronic terminal device. The local terminal device may provide the graphical user interface to the player in various ways, for example, it may be rendered and displayed on the display screen of the terminal, or provided to the player through holographic projection. For example, the local terminal device may include a display screen for presenting a graphical user interface, the graphical user interface including game screens, and a processor for running the game, generating the graphical user interface, and controlling the graphical user interface display on the display.
在一种可能的实施方式中,本申请实施例提供了一种虚拟三维模型的渲染方法,通过第一终端设备提供图形用户界面,其中,第一终端设备可以是前述提到的本地终端设备,也可以是前述提到的云交互系统中的客户端设备。In a possible implementation manner, an embodiment of the present application provides a method for rendering a virtual three-dimensional model, providing a graphical user interface through a first terminal device, where the first terminal device may be the aforementioned local terminal device, It can also be the client device in the aforementioned cloud interaction system.
例如,如图1所示,图1为本申请实施例提供的应用场景示意图。该应用场景可以包括终端设备102和服务器设备101,该终端设备102可以通过有线网络或无线网络与服务器设备101进行通信。本实施例的中电子终端可以为终端设备102,也可以为服务器设备101。For example, as shown in FIG. 1 , FIG. 1 is a schematic diagram of an application scenario provided by an embodiment of the present application. The application scenario may include a
本实施例的中电子终端以终端设备102为例进行说明。如图2所示,终端设备102包括存储器1021、处理器1022,所述存储器中存储有可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现上述实施例提供的方法的步骤。The electronic terminal in this embodiment is described by taking the
参见图2,终端设备102还包括:总线1023和通信接口1024,处理器1022、通信接口1024和存储器1021通过总线1023连接;处理器1022用于执行存储器1021中存储的可执行模块,例如计算机程序。2, the
其中,存储器1021可能包含高速随机存取存储器(Random Access Memory,简称RAM),也可能还包括非易失性存储器(non-volatile memory),例如至少一个磁盘存储器。通过至少一个通信接口1024(可以是有线或者无线)实现该系统网元与至少一个其他网元之间的通信连接,可以使用互联网,广域网,本地网,城域网等。The memory 1021 may include a high-speed random access memory (Random Access Memory, RAM for short), and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory. The communication connection between the network element of the system and at least one other network element is realized through at least one communication interface 1024 (which may be wired or wireless), which may use the Internet, a wide area network, a local network, a metropolitan area network, and the like.
总线1023可以是ISA总线、PCI总线或EISA总线等。所述总线可以分为地址总线、数据总线、控制总线等。为便于表示,图2中仅用一个双向箭头表示,但并不表示仅有一根总线或一种类型的总线。The bus 1023 may be an ISA bus, a PCI bus, an EISA bus, or the like. The bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, only one bidirectional arrow is used in FIG. 2, but it does not mean that there is only one bus or one type of bus.
其中,存储器1021用于存储程序,所述处理器1022在接收到执行指令后,执行所述程序,前述本申请任一实施例揭示的过程定义的装置所执行的方法可以应用于处理器1022中,或者由处理器1022实现。The memory 1021 is used to store a program, and the
处理器1022可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器1022中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器1022可以是通用处理器,包括中央处理器(Central Processing Unit,简称CPU)、网络处理器(Network Processor,简称NP)等;还可以是数字信号处理器(DigitalSignal Processing,简称DSP)、专用集成电路(Application Specific IntegratedCircuit,简称ASIC)、现成可编程门阵列(Field-Programmable Gate Array,简称FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器1021,处理器1022读取存储器1021中的信息,结合其硬件完成上述方法的步骤。The
当然,本实施例中的电子终端还可以为无网络连接的本地计算机设备。如图3所示,计算机设备103包括:处理器1031、存储器1032、和总线,所述存储器1032存储有所述处理器1031可执行的机器可读指令,当计算机设备运行时,所述处理器1031与所述存储器1032之间通过总线通信,所述处理器1031执行所述机器可读指令,以执行如虚拟三维模型的渲染方法的步骤。Of course, the electronic terminal in this embodiment may also be a local computer device without network connection. As shown in FIG. 3, the computer device 103 includes: a
具体地,上述存储器1032和处理器1031能够为通用的存储器和处理器,这里不做具体限定,当处理器1031运行存储器1032存储的计算机程序时,能够执行虚拟三维模型的渲染方法。Specifically, the above-mentioned
下面结合附图对本申请实施例进行进一步地介绍。The embodiments of the present application will be further introduced below with reference to the accompanying drawings.
图4为本申请实施例提供的一种虚拟三维模型的渲染方法的流程示意图。其中,该方法可以应用于电子设备。如图4所示,该方法包括:FIG. 4 is a schematic flowchart of a method for rendering a virtual three-dimensional model according to an embodiment of the present application. Among them, the method can be applied to electronic equipment. As shown in Figure 4, the method includes:
步骤S410,根据虚拟相机的拍摄方向,确定虚拟三维模型的纹理贴图的所在平面相对于虚拟相机的拍摄方向的目标相对角度。Step S410, according to the shooting direction of the virtual camera, determine the target relative angle of the plane where the texture map of the virtual three-dimensional model is located relative to the shooting direction of the virtual camera.
其中,每个相对角度对应有指定透明程度,相对角度越大则对应的指定透明程度越大。需要说明的是,其中的相对角度指虚拟相机的拍摄方向面向纹理贴图所在平面的角度。Wherein, each relative angle corresponds to a specified degree of transparency, and the larger the relative angle is, the greater the corresponding specified degree of transparency. It should be noted that the relative angle refers to the angle at which the shooting direction of the virtual camera faces the plane where the texture map is located.
示例性的,虚拟相机垂直朝向于纹理贴图的平面,虚拟相机所拍摄的内容即为图形用户界面中所显示的内容。当虚拟场景中的纹理贴图进行旋转时,虚拟相机垂直朝向于纹理贴图的平面的目标相对角度将发生变化,而每个相对角度对应有指定透明程度。简而言之,当纹理贴图旋转时,其透明度将随着旋转的角度发生变化。Exemplarily, the virtual camera is vertically oriented to the plane of the texture map, and the content captured by the virtual camera is the content displayed in the graphical user interface. When the texture map in the virtual scene is rotated, the relative angle of the target of the virtual camera perpendicular to the plane of the texture map will change, and each relative angle corresponds to a specified degree of transparency. In short, when a texture map is rotated, its transparency will change with the angle of rotation.
在实际应用中,虚拟相机可以与终端控制的游戏场景中的虚拟角色绑定,即可以是虚拟角色第一视角下的虚拟相机,也可以是第三视角下的虚拟相机,该虚拟相机拍摄虚拟三维模型(如虚拟角色身边的火焰三维模型)前面、后面、侧面等不同的拍摄角度(即上述相对角度)对应有不同的指定透明程度,如火焰透明程度。In practical applications, the virtual camera can be bound to the virtual character in the game scene controlled by the terminal, that is, it can be the virtual camera from the first perspective of the virtual character, or the virtual camera from the third perspective, and the virtual camera shoots the virtual camera. The three-dimensional model (such as the three-dimensional model of the flame around the virtual character) has different degrees of specified transparency, such as the degree of flame transparency, corresponding to different shooting angles (ie, the above-mentioned relative angles) of the front, back, and sides.
步骤S420,确定目标相对角度对应的目标指定透明程度。Step S420, determining the target specified transparency degree corresponding to the target relative angle.
示例性的,如图5所示,每个相对角度对应有指定透明程度,相对角度越大则对应的指定透明程度越大,可以通过确定的目标相对角度进而确定所对应的目标指定透明程度。图像501为虚拟相机垂直朝向于纹理贴图的平面且目标相对角度为0度时的示意图,当目标相对角度为0度时,对应的目标指定透明度为完全透明。当目标相对角度逐渐变大时,纹理贴图对应的目标指定透明度也逐渐变大。例如,当目标相对角度增大到图像502所示的角度时,纹理贴图对应的目标指定透明度明显增大;当目标相对角度增大到图像503所示的角度时,纹理贴图对应的目标指定透明度变为完全透明。Exemplarily, as shown in FIG. 5 , each relative angle corresponds to a specified transparency degree, and the larger the relative angle is, the greater the corresponding specified transparency degree, and the corresponding target specified transparency degree can be determined by the determined target relative angle.
步骤S430,按照目标指定透明程度渲染纹理贴图,得到虚拟三维模型的渲染结果。Step S430: Render the texture map according to the specified transparency level of the target to obtain a rendering result of the virtual three-dimensional model.
示例性的,由于虚拟三维模型通过若干个纹理贴图的穿插形成,因此当确定每一个纹理贴图当前与虚拟相机的目标相对角度后,即可以确定每一个纹理贴图对应的目标指定透明度,进而系统可以按照目标指定透明度对纹理贴图进行渲染生成,得到完整的虚拟三维模型的渲染结果。例如,虚拟三维模型可以是游戏场景中特效火,该特效火的透明度的设置过程中,特效火的透明度是受虚拟相机的拍摄角度来确定。Exemplarily, since the virtual three-dimensional model is formed by interspersing several texture maps, after the current relative angle of each texture map and the target of the virtual camera is determined, the specified transparency of the target corresponding to each texture map can be determined, and then the system can The texture map is rendered and generated according to the specified transparency of the target, and the rendering result of the complete virtual 3D model is obtained. For example, the virtual three-dimensional model may be a special effect fire in a game scene. During the setting process of the transparency of the special effect fire, the transparency of the special effect fire is determined by the shooting angle of the virtual camera.
本申请实施例中,通过对插片制作火焰模型的方案进行改进,纹理贴图的显示透明度根据虚拟三维模型本身与虚拟相机的相对角度而变化,即虚拟相机面向于纹理贴图的平面的目标相对角度越大则其对应渲染出的透明程度越大,使得纹理贴图侧面面对虚拟摄像机的时候更加透明,纹理贴图正面面对虚拟摄像机时最不透明度,从而使得侧面看虚拟三维模型中的纹理贴图时不会再有插片痕迹,还不会影响其他角度的纹理贴图展示效果,且不同角度的显示效果过渡自然,由纹理贴图渲染得到的虚拟三维模型从各个角度观察得到的显示效果一致,进而整体降低虚拟三维模型的插片感,提升虚拟三维模型的整体显示效果,缓解了现有技术中虚拟三维模型的整体显示效果较差的技术问题。In this embodiment of the present application, by improving the solution for making a flame model from an insert, the display transparency of the texture map changes according to the relative angle between the virtual 3D model itself and the virtual camera, that is, the relative angle of the virtual camera facing the plane of the texture map. The larger the value, the greater the degree of transparency corresponding to the rendering, which makes the texture map more transparent when the side faces the virtual camera, and the most opaque when the texture map faces the virtual camera, so that when the texture map in the virtual 3D model is viewed from the side There will be no more traces of inserts, and it will not affect the display effect of texture maps from other angles, and the display effects of different angles transition naturally. The virtual 3D model rendered by texture maps has the same display effect from all angles, and the overall display effect is consistent. The sense of inserting the virtual three-dimensional model is reduced, the overall display effect of the virtual three-dimensional model is improved, and the technical problem of poor overall display effect of the virtual three-dimensional model in the prior art is alleviated.
下面对上述步骤进行详细介绍。The above steps are described in detail below.
在一些实施例中,可以使得纹理贴图侧面面对虚拟摄像机的时候以完全透明的形式显示,纹理贴图正面面对虚拟摄像机的时候透明度以不透明的形式显示,既降低侧面时的插片感还不影响正面时的正常显示,提升虚拟三维模型的显示效果。作为一个示例,相对角度为0度时对应的指定透明程度为不透明,相对角度为90度时对应的指定透明程度为完全透明。In some embodiments, the texture map can be displayed in a completely transparent form when the side of the texture map faces the virtual camera, and the transparency of the texture map can be displayed in an opaque form when the front of the texture map faces the virtual camera. Affects the normal display of the front, and improves the display effect of the virtual 3D model. As an example, when the relative angle is 0 degrees, the corresponding specified transparency degree is opaque, and when the relative angle is 90 degrees, the corresponding specified transparency degree is completely transparent.
示例性的,如图5所示,当虚拟相机与纹理贴图平面的相对角度为0度时,纹理贴图的显示效果如图像501所示,纹理贴图对应的指定透明程度为不透明;当纹理贴图平面相对于虚拟相机发生旋转,相对角度增大至如图像502所示时(例如45度),纹理贴图对应的指定透明程度为半透明;当纹理贴图平面相对于虚拟相机继续旋转,相对角度增大至如图像503所示的90度时,纹理贴图对应的指定透明程度为完全透明。Exemplarily, as shown in Figure 5, when the relative angle between the virtual camera and the texture map plane is 0 degrees, the display effect of the texture map is as shown in
通过使纹理贴图平面与虚拟相机的相对角度为0度时对应的指定透明程度为不透明,相对角度为90度时对应的指定透明程度为完全透明,可以使得纹理贴图侧面面对虚拟相机的时候透明度变淡,正面面对摄像机的时候透明度不变,从而使得渲染生成的三维模型在旋转过程中面向虚拟相机的一面始终是不透明的,而当侧面面对虚拟相机时变得透明,不显示一条竖片,整体降低三维模型的插片感,提升虚拟三维模型的显示效果。When the relative angle between the texture map plane and the virtual camera is 0 degrees, the corresponding specified transparency degree is opaque, and when the relative angle is 90 degrees, the corresponding specified transparency degree is completely transparent, so that the texture map can be transparent when the side faces the virtual camera. When the front side faces the camera, the transparency remains unchanged, so that the side of the rendered 3D model that faces the virtual camera is always opaque during the rotation process, and becomes transparent when the side faces the virtual camera, without displaying a vertical line. It can reduce the overall sense of inserting the 3D model and improve the display effect of the virtual 3D model.
在一些实施例中,可以适当的扩大纹理贴图完全透明显示时所对应的相对角度范围,即在一定范围之内使多个纹理贴图之间的变化以较为自然的形式完成过渡显示,从而降低侧面附近一定角度范围内的插片感,提升虚拟三维模型的整体显示效果。作为一个示例,相对角度在预设角度范围时,对应的指定透明程度为完全透明;其中,预设角度范围为90度以上的预设第一角度值至90度以下的预设第二角度值之间的角度范围。In some embodiments, the relative angle range corresponding to the completely transparent display of the texture map can be appropriately expanded, that is, the transition between the changes between multiple texture maps can be completed in a more natural form within a certain range, thereby reducing the lateral The sense of inserting within a certain angle range nearby improves the overall display effect of the virtual 3D model. As an example, when the relative angle is within a preset angle range, the corresponding specified degree of transparency is completely transparent; wherein, the preset angle range is a preset first angle value above 90 degrees to a preset second angle value below 90 degrees angular range between.
在实际应用中,预设第一角度值和预设第二角度值可以是不同值,也可以为相同值,例如,可以在70度至105度的范围内时将纹理贴图完全透明显示,还可以在80度至100度的范围内时将纹理贴图完全透明显示。In practical applications, the preset first angle value and the preset second angle value may be different values, or may be the same value, for example, the texture map can be completely transparently displayed in the range of 70 degrees to 105 degrees. The texture map can be displayed fully transparent in the range of 80 degrees to 100 degrees.
示例性的,当纹理贴图平面与虚拟相机之间的相对角度为0度时,纹理贴图对应的指定透明程度为不透明;当纹理贴图发生旋转,相对角度增大至45度时,纹理贴图对应的指定透明程度可以为半透明;当纹理贴图继续旋转,相对角度增大至90度时,纹理贴图对应的指定透明程度为完全透明;当纹理贴图继续旋转,相对角度增大至135度时,纹理贴图对应的指定透明程度又可以为半透明。纹理贴图的旋转变化是由不透明转为透明,又转为透明的过程,而虚拟三维模型由多个纹理贴图构成,因此可以适当的扩展纹理贴图完全透明所对应的角度,使得纹理贴图旋转到一定角度即可以完全透明,不必完全侧面面对虚拟相机时才完全透明,提高整体显示效果。Exemplarily, when the relative angle between the texture map plane and the virtual camera is 0 degrees, the specified degree of transparency corresponding to the texture map is opaque; when the texture map rotates and the relative angle increases to 45 degrees, the corresponding degree of transparency of the texture map is opaque. The specified transparency degree can be semi-transparent; when the texture map continues to rotate and the relative angle increases to 90 degrees, the specified transparency degree corresponding to the texture map is fully transparent; when the texture map continues to rotate and the relative angle increases to 135 degrees, the texture map The specified transparency level corresponding to the map can also be semi-transparent. The rotation change of the texture map is a process from opaque to transparent and then to transparent, and the virtual 3D model is composed of multiple texture maps, so the angle corresponding to the complete transparency of the texture map can be appropriately expanded, so that the texture map rotates to a certain degree. The angle can be completely transparent, and it is not necessary to be completely transparent when facing the virtual camera from the side, which improves the overall display effect.
需要说明的是,上述45度、80度以及100度等数值,以及所对应的透明度仅在本申请实施例中作为说明使用,在实际应用中可以根据实际情况具体调整。It should be noted that the above-mentioned numerical values such as 45 degrees, 80 degrees, and 100 degrees, and the corresponding transparency are only used for illustration in the embodiments of the present application, and can be specifically adjusted according to actual conditions in practical applications.
通过虚拟相机在相对角度为90度上下的预设角度范围时使纹理贴图对应的指定透明程度为完全透明,使得渲染生成的虚拟三维模型的插片感进一步降低,提高整体显示效果。When the relative angle of the virtual camera is within the preset angle range of 90 degrees, the specified transparency level corresponding to the texture map is completely transparent, so that the virtual 3D model generated by rendering is further reduced and the overall display effect is improved.
在一些实施例中,上述虚拟相机可以与终端控制的游戏场景中的虚拟角色绑定。作为一个示例,虚拟三维模型和虚拟相机所处的虚拟场景中还包含通过终端设备控制的虚拟角色,虚拟角色与虚拟相机之间为绑定关系;该方法还可以包括如下步骤:In some embodiments, the above-mentioned virtual camera may be bound with a virtual character in a game scene controlled by the terminal. As an example, the virtual scene where the virtual three-dimensional model and the virtual camera are located also includes a virtual character controlled by the terminal device, and the virtual character and the virtual camera are in a binding relationship; the method may further include the following steps:
步骤S440,根据终端设备对虚拟角色的控制指令,确定针对虚拟角色的视角方向。Step S440: Determine the viewing angle direction for the virtual character according to the control instruction of the terminal device on the virtual character.
步骤S442,根据视角方向确定虚拟相机的拍摄方向。Step S442, determining the shooting direction of the virtual camera according to the viewing angle direction.
在实际应用中,虚拟相机可以是虚拟角色第一视角下的虚拟相机,也可以是第三视角下的虚拟相机,该虚拟相机拍摄虚拟三维模型(如虚拟角色身边的火焰三维模型)前面、后面、侧面等不同的拍摄角度(即上述相对角度)对应有不同的指定透明程度,如火焰透明程度,进而提升玩家控制虚拟角色的游戏体验。In practical applications, the virtual camera may be a virtual camera from a first perspective of a virtual character, or a virtual camera from a third perspective, and the virtual camera captures the front and back of a virtual three-dimensional model (such as a three-dimensional flame model around the virtual character). Different shooting angles (that is, the above-mentioned relative angles) corresponding to different shooting angles, such as the flame transparency, have different degrees of transparency, so as to improve the game experience of the player controlling the virtual character.
在一些实施例中,纹理贴图进行一定的透明处理后导致新的技术问题,即相对于虚拟相机的拍摄方向位于虚拟三维模型的前后位置的纹理贴图由于透明化,虚拟三维模型的前后重叠的纹理贴图会造成视觉重影,而通过对这种情况的纹理贴图的纹理显示参数进行调整可以淡化或消除重影。作为一个示例,虚拟三维模型包含多个纹理贴图;该方法还可以包括如下步骤:In some embodiments, a certain transparency processing is performed on the texture map, which leads to a new technical problem, that is, the texture map located in the front and rear positions of the virtual 3D model relative to the shooting direction of the virtual camera is transparent, and the front and rear overlapping textures of the virtual 3D model are caused by transparency. Maps can cause visual ghosting, which can be faded or eliminated by adjusting the texture display parameters of the texture map in this case. As an example, the virtual three-dimensional model contains a plurality of texture maps; the method may further include the following steps:
步骤S450,根据虚拟相机的拍摄方向,确定相对于拍摄方向的虚拟三维模型的前后至少部分重叠的多个目标纹理贴图。Step S450, according to the shooting direction of the virtual camera, determine a plurality of target texture maps that at least partially overlap the front and rear of the virtual three-dimensional model with respect to the shooting direction.
步骤S452,对目标纹理贴图的纹理显示参数进行调整,以减少按照目标指定透明程度渲染的多个目标纹理贴图前后重叠时产生的重影。Step S452 , adjusting the texture display parameters of the target texture map to reduce ghosting generated when multiple target texture maps rendered according to the specified transparency level of the target overlap before and after.
其中,纹理显示参数可以包括下述任意一项或多项:明亮度、曝光度、色彩对比度、色彩饱和度、色差、色号。The texture display parameters may include any one or more of the following: brightness, exposure, color contrast, color saturation, color difference, and color number.
对于重叠的纹理贴图透明化处理后导致的重影情况,通过对该纹理贴图的明亮度、色彩对比度、色差、色号等纹理显示参数进行调整可以淡化或消除重影,进而改善显示效果。For the ghosting situation caused by the transparent processing of overlapping texture maps, by adjusting the texture display parameters such as brightness, color contrast, color difference, and color number of the texture map, the ghosting can be reduced or eliminated, thereby improving the display effect.
在一些实施例中,还可以只对两个纹理贴图之间的重叠部分进行纹理显示参数调整,以节省调整成本。作为一个示例,上述步骤S452具体可以包括如下步骤:In some embodiments, the texture display parameter adjustment may also be performed only on the overlapping portion between the two texture maps, so as to save the adjustment cost. As an example, the above step S452 may specifically include the following steps:
步骤S4522,确定第一目标纹理贴图相对于拍摄方向映射至第二目标纹理贴图中的重叠部分贴图。Step S4522, determining that the first target texture map is mapped to the overlapping portion of the second target texture map relative to the shooting direction.
步骤S4524,对重叠部分贴图的纹理显示参数进行调整,以减少按照目标指定透明程度渲染的第一目标纹理贴图和第二目标纹理贴图之间前后重叠时产生的重影。Step S4524: Adjust the texture display parameters of the overlapped part of the texture map to reduce the ghost generated when the first target texture map and the second target texture map rendered according to the specified transparency level of the target overlap back and forth.
通过只对两个纹理贴图之间的重叠部分贴图进行纹理显示参数调整,不仅能够消除或淡化按照目标指定透明程度渲染的第一目标纹理贴图和第二目标纹理贴图之间前后重叠时产生的重影,还能够节省调整成本。By only adjusting the texture display parameters of the overlapping part of the two texture maps, it can not only eliminate or fade the overlapping between the first target texture map and the second target texture map rendered according to the specified transparency level of the target. It can also save adjustment costs.
在一些实施例中,可以通过坐标系的变换,将虚拟相机在虚拟场景中的第一坐标系转换为虚拟相机在虚拟三维模型的模型空间中的第二坐标系,从而可以较为精准的确定出虚拟相机与纹理贴图平面之间的相对角度,进而便于确定对应的渲染透明度,提升虚拟三维模型的整体显示效果。作为一个示例,上述步骤S410具体可以包括如下步骤:In some embodiments, the first coordinate system of the virtual camera in the virtual scene can be converted into the second coordinate system of the virtual camera in the model space of the virtual three-dimensional model through the transformation of the coordinate system, so that the determination can be made more accurately. The relative angle between the virtual camera and the texture map plane is convenient to determine the corresponding rendering transparency and improve the overall display effect of the virtual 3D model. As an example, the foregoing step S410 may specifically include the following steps:
步骤a),将虚拟相机在虚拟场景中的第一坐标系转换为虚拟相机在虚拟三维模型的模型空间中的第二坐标系。Step a), converting the first coordinate system of the virtual camera in the virtual scene into the second coordinate system of the virtual camera in the model space of the virtual three-dimensional model.
步骤b),通过第二坐标系确定虚拟三维模型的纹理贴图的所在平面相对于虚拟相机的拍摄方向的目标相对角度。In step b), the target relative angle of the plane where the texture map of the virtual three-dimensional model is located relative to the shooting direction of the virtual camera is determined by the second coordinate system.
示例性的,如图6所示,首先可以将虚拟相机601转到第一坐标系,第一坐标系即模型空间。模型空间(model space)也称为对象空间(object space)或局部空间(localspace)是指以模型原点为原点的坐标系。模型原点即模型的轴心点(pivot)。第一坐标系即以虚拟三维模型602的模型原点603为原点建立的坐标系。之后可以将虚拟相机在虚拟场景中的第一坐标系转换为虚拟相机在虚拟三维模型的模型空间中的第二坐标系。如图7所示,第二坐标系可以理解为平面坐标系,即通过xy轴来确定虚拟相机垂直朝向于纹理贴图的平面的目标相对角度。Exemplarily, as shown in FIG. 6 , first, the
通过将虚拟相机在虚拟场景中的第一坐标系转换为虚拟相机在虚拟三维模型的模型空间中的第二坐标系,之后通过第二坐标系确定虚拟相机垂直朝向于纹理贴图的平面的目标相对角度,从而较为精准的确定出虚拟相机与纹理贴图平面之间的相对角度,进而便于确定对应的渲染透明度,提升虚拟三维模型的整体显示效果。By converting the first coordinate system of the virtual camera in the virtual scene to the second coordinate system of the virtual camera in the model space of the virtual three-dimensional model, and then determining through the second coordinate system the target relative of the virtual camera perpendicular to the plane of the texture map Therefore, the relative angle between the virtual camera and the texture map plane can be determined more accurately, so as to facilitate the determination of the corresponding rendering transparency and improve the overall display effect of the virtual 3D model.
基于上述步骤a)和步骤b),基于插片法,可以将若干纹理贴图彼此穿插的交点作为第二坐标系的原点,以此作为中心点来较为精确的确定虚拟相机与纹理贴图之间的相对角度,从而进一步提升虚拟三维模型的整体显示效果。作为一个示例,虚拟三维模型的模型空间中若干个纹理贴图穿插的轴心点为第二坐标系的原点;上述步骤b)具体可以包括如下步骤:Based on the above step a) and step b), based on the patch method, the intersection of several texture maps can be used as the origin of the second coordinate system, and this is used as the center point to more accurately determine the virtual camera and the texture map. relative angle, thereby further improving the overall display effect of the virtual 3D model. As an example, the pivot point interspersed with several texture maps in the model space of the virtual three-dimensional model is the origin of the second coordinate system; the above step b) may specifically include the following steps:
步骤c),以第二坐标系中的原点作为中心点,确定虚拟三维模型的每个纹理贴图的所在平面相对于虚拟相机的拍摄方向的目标相对角度。Step c), taking the origin in the second coordinate system as the center point, to determine the target relative angle of the plane where each texture map of the virtual three-dimensional model is located relative to the shooting direction of the virtual camera.
示例性的,如图7所示,虚拟三维模型由若干纹理贴图插片组成,本申请实施例以两个纹理贴图十字插片进行说明。以第二坐标系中的原点701作为中心点,可以确定虚拟相机垂直朝向于每个纹理贴图的平面的目标相对角度。例如,虚拟相机在模型空间下的坐标为(1,0,0),在第二坐标系中对应的点就是y轴上的点0.5;如果坐标是(1,-1,0),对应的值就是右下象限0.75。Exemplarily, as shown in FIG. 7 , the virtual three-dimensional model is composed of several texture map inserts, and the embodiment of the present application is described with two texture map cross inserts. Taking the
由于虚拟三维模型由若干纹理贴图插片而成,因此可以将虚拟三维模型的模型空间中若干个纹理贴图穿插的轴心点为第二坐标系的原点,进而以第二坐标系中的原点作为中心点,较为精准的确定虚拟相机垂直朝向于每个纹理贴图的平面的目标相对角度。有助于更为精准的确定纹理贴图的指定透明度,提升虚拟三维模型的整体显示效果。Since the virtual 3D model is formed by inserting several texture maps, the pivot point interspersed with several texture maps in the model space of the virtual 3D model can be used as the origin of the second coordinate system, and then the origin in the second coordinate system can be used as the origin of the second coordinate system. The center point, which more accurately determines the relative angle of the virtual camera perpendicular to the target of each texture map plane. It helps to more accurately determine the specified transparency of the texture map, and improves the overall display effect of the virtual 3D model.
在一些实施例中,可以通过角度系数确定透明程度,可以计算更加简便且精确的得到纹理贴图在不同相对角度上对应的不同透明度。作为一个示例,上述步骤S420具体可以包括如下步骤:In some embodiments, the degree of transparency can be determined by the angle coefficient, and the different transparency corresponding to the texture map at different relative angles can be obtained more simply and accurately by calculation. As an example, the above step S420 may specifically include the following steps:
步骤d),将目标相对角度转换为目标角度系数,并确定目标角度系数对应的目标指定透明系数;每个角度系数对应有指定透明系数。Step d), convert the relative angle of the target into the target angle coefficient, and determine the target specified transparency coefficient corresponding to the target angle coefficient; each angle coefficient corresponds to a specified transparency coefficient.
步骤e),将目标指定透明系数和预设透明参数相乘,得到目标相对角度对应的目标指定透明程度的数值。Step e), multiplying the target specified transparency coefficient and the preset transparency parameter to obtain the numerical value of the target specified transparency degree corresponding to the target relative angle.
示例性的,可以首先将目标相对角度转换为目标角度系数,例如将0度转换为对应的目标角度系数0,将45度转换为对应的目标角度系数0.75,将90度转换为对应的目标角度系数1。之后根据目标角度系数,确定对应的目标指定透明系数,例如目标角度系数0对应于目标指定透明系数0%;目标角度系数0.75对应于目标指定透明系数50%;目标角度系数0对应于目标指定透明系数100%。之后将目标指定透明系数和预设透明参数相乘,得到目标相对角度对应的目标指定透明程度的数值,实现纹理贴图平面于虚拟相机的相对角度为0度时透明度为0,随着旋转透明度逐渐变大直至90度完全透明的效果。Exemplarily, the target relative angle may be converted into a target angle coefficient first, for example, 0 degree is converted into a corresponding target angle coefficient of 0, 45 degrees is converted into a corresponding target angle coefficient of 0.75, and 90 degrees is converted into a corresponding target angle.
通过首先将目标相对角度转换为目标角度系数,并确定目标角度系数对应的目标指定透明系数,其中的每个角度系数对应有指定透明系数,之后将目标指定透明系数和预设透明参数相乘,从而可以得到目标相对角度对应的目标指定透明程度的数值,即纹理贴图在不同相对角度上对应的不同透明度,提升虚拟三维模型的整体显示效果。By first converting the relative angle of the target into the target angle coefficient, and determining the target specified transparency coefficient corresponding to the target angle coefficient, each angle coefficient corresponds to a specified transparency coefficient, and then multiplying the target specified transparency coefficient and the preset transparency parameter, Thereby, the value of the specified transparency degree of the target corresponding to the relative angle of the target can be obtained, that is, the different transparency corresponding to the texture map at different relative angles, and the overall display effect of the virtual three-dimensional model can be improved.
基于上述步骤c)和步骤d),可以通过简单的0、1以及0和1之间的数值作为角度系数的选取值,从而可以较为简洁明了的表示出纹理贴图与虚拟相机之间的相对角度,便于系统基于角度系数确定纹理贴图的显示透明度。作为一个示例,角度系数为0至1之间的数值;其中,0表示虚拟相机垂直朝向于纹理贴图的一侧平面时的角度系数为0,1表示虚拟相机垂直朝向于纹理贴图的另一侧平面时的角度系数为1;相对角度为0度时角度系数为0或1;相对角度为90度时角度系数为0.5。Based on the above steps c) and d), a simple value between 0, 1 and the values between 0 and 1 can be used as the selection value of the angle coefficient, so that the relative relationship between the texture map and the virtual camera can be expressed more concisely and clearly Angle, which is convenient for the system to determine the display transparency of the texture map based on the angle coefficient. As an example, the angle coefficient is a value between 0 and 1; where 0 means that the angle coefficient is 0 when the virtual camera is vertically oriented to one side of the texture map, and 1 means that the virtual camera is oriented vertically to the other side of the texture map The angle coefficient is 1 when the plane is flat; the angle coefficient is 0 or 1 when the relative angle is 0 degrees; the angle coefficient is 0.5 when the relative angle is 90 degrees.
示例性的,如图7所示,0可以对应于面向纹理贴图插片的正背面角度;0.5可以对应于纹理贴图插片的纯侧面角度(即只能看到纹理贴图插片的一条线),即将纹理贴图插片正对面(或正背面)向两边任意一边转动90度的位置;0.75可以对应于45度(即斜侧面,从正对面两边转动45度的位置);1可以对应于纹理贴图插片正对面的角度。Exemplarily, as shown in Figure 7, 0 may correspond to the front and back angles facing the texture map insert; 0.5 may correspond to the pure side angle of the texture map insert (that is, only one line of the texture map insert can be seen) , that is, the position where the front (or front and back) of the texture map insert is rotated 90 degrees to either side; 0.75 can correspond to 45 degrees (that is, the oblique side, which is rotated 45 degrees from the opposite sides); 1 can correspond to the texture The angle from which the tile inset is directly opposite.
通过设定角度系数为0至1之间的数值,可以较为简洁明了的表示出纹理贴图与虚拟相机之间的相对角度,便于系统基于角度系数确定纹理贴图的显示透明度,进而提高虚拟三维模型的渲染效果。By setting the angle coefficient to a value between 0 and 1, the relative angle between the texture map and the virtual camera can be expressed more concisely and clearly, which is convenient for the system to determine the display transparency of the texture map based on the angle coefficient, thereby improving the virtual 3D model. rendering effect.
基于上述步骤c)和步骤d),可以通过简单的0、1来表示纹理贴图的透明系数,例如用0表示纹理贴图完全透明,用1来表示纹理贴图不透明,便于系统基于透明系数确定纹理贴图的显示透明度。作为一个示例,指定透明系数为0至1之间的数值;其中,1表示虚拟相机垂直朝向于纹理贴图的任一侧平面时的指定透明程度为不透明,0表示虚拟相机平行朝向于纹理贴图的平面时的指定透明程度为完全透明。Based on the above steps c) and d), the transparency coefficient of the texture map can be represented by simple 0 and 1. For example, 0 means the texture map is completely transparent, and 1 means the texture map is opaque, which is convenient for the system to determine the texture map based on the transparency coefficient. display transparency. As an example, specify the transparency coefficient as a value between 0 and 1; where 1 indicates that the specified degree of transparency is opaque when the virtual camera is vertically oriented to either side of the texture map, and 0 indicates that the virtual camera is oriented parallel to the texture map. The specified degree of transparency when flat is fully transparent.
示例性的,如图8所示,可以将由图7得到的值转换到1-0-0-1的范围。图8中两个1是指纹理贴图插片正对面的角度以及正背面的角度,这2个角度对应纹理贴图完全不透明显示;两个0指的是纹理贴图插片的纯侧面角度(即只能看到纹理贴图插片的一条线)时,该纹理贴图插片完全透明显示;其中有过渡角度,如斜侧面时是0-1之间的过渡透明度。Exemplarily, as shown in FIG. 8 , the values obtained in FIG. 7 may be converted into the range of 1-0-0-1. The two 1s in Figure 8 refer to the angle on the opposite side of the texture map insert and the angle on the front and back. These two angles correspond to the completely opaque display of the texture map; the two 0s refer to the pure side angle of the texture map insert (that is, only When you can see a line of the texture map insert), the texture map insert is completely transparent; there are transition angles, such as the transition transparency between 0-1 when the side is oblique.
在实际应用中,如图9所示,可以适当的扩大纹理贴图完全透明显示时所对应的相对角度范围,即适当的扩大0所对应的范围,从而使得在一定范围之内使多个纹理贴图之间的变化以较为自然的形式完成过渡显示,从而降低虚拟三维模型的插片感,提升虚拟三维模型的整体显示效果。In practical applications, as shown in Figure 9, the relative angle range corresponding to the fully transparent display of the texture map can be appropriately expanded, that is, the range corresponding to 0 can be appropriately expanded, so that multiple texture maps can be used within a certain range. The transition between changes is completed in a more natural form, thereby reducing the sense of inserting the virtual 3D model and improving the overall display effect of the virtual 3D model.
通过设定指定透明系数为0至1之间的数值;将0至1之间的目标指定透明系数和预设透明参数相乘,即得到目标相对角度对应的目标指定透明程度的数值,从而提升虚拟三维模型的整体显示效果。By setting the specified transparency coefficient to a value between 0 and 1; multiplying the target specified transparency coefficient between 0 and 1 and the preset transparency parameter, the value of the target specified transparency corresponding to the target relative angle is obtained, thereby improving The overall display effect of the virtual 3D model.
在一些实施例中,本方法可以应用于十字插片法生成的虚拟三维模型,通过本方法可以使两个纹理贴图之间的显示实现自然的过渡,从而使渲染生成的虚拟三维模型保持稳定的显示状态以及显示质量,提升虚拟三维模型的显示效果。作为一个示例,若干个纹理贴图的数量为两个;两个纹理贴图通过垂直交叉的方式穿插形成的虚拟三维模型。In some embodiments, the method can be applied to the virtual 3D model generated by the cross-slice method, and the display between two texture maps can realize a natural transition through this method, so that the virtual 3D model generated by rendering can be kept stable. Display status and display quality to improve the display effect of virtual 3D models. As an example, the number of several texture maps is two; a virtual three-dimensional model is formed by interspersing the two texture maps in a vertically intersecting manner.
示例性的,在实际应用时,可以首先通过火焰模型制作成十字插片,具体可以将两个火焰的纹理贴图通过垂直交叉的方式穿插形成的虚拟三维模型,之后画出模型的基础色,进行uv流动和uv扭曲。Exemplarily, in practical application, the flame model can be first made into a cross insert. Specifically, a virtual three-dimensional model can be formed by vertically intersecting the texture maps of two flames, and then the basic color of the model can be drawn. uv flow and uv twist.
通过两个纹理贴图以十字插片的方式制作虚拟三维模型,不仅保证了模型的完整度,还节省了资源空间,可以通过较小的性能消耗实现了较高的显示效果。The virtual 3D model is produced in the form of cross inserts through two texture maps, which not only ensures the integrity of the model, but also saves resource space, and can achieve a higher display effect with less performance consumption.
图10提供了一种虚拟三维模型的渲染装置的结构示意图。如图10所示,虚拟三维模型的渲染装置1000包括:FIG. 10 provides a schematic structural diagram of a device for rendering a virtual three-dimensional model. As shown in FIG. 10 , the rendering apparatus 1000 of the virtual three-dimensional model includes:
第一确定模块1001,用于根据虚拟相机的拍摄方向,确定虚拟三维模型的纹理贴图的所在平面相对于虚拟相机的拍摄方向的目标相对角度;每个相对角度对应有指定透明程度,相对角度越大则对应的指定透明程度越大。The
第二确定模块1002,用于确定目标相对角度对应的目标指定透明程度。The second determining
渲染模块1003,用于按照目标指定透明程度渲染纹理贴图,得到虚拟三维模型的渲染结果。The
在一些实施例中,相对角度为0度时对应的指定透明程度为不透明,相对角度为90度时对应的指定透明程度为完全透明。In some embodiments, when the relative angle is 0 degrees, the corresponding specified transparency degree is opaque, and when the relative angle is 90 degrees, the corresponding specified transparency degree is completely transparent.
在一些实施例中,相对角度在预设角度范围时,对应的指定透明程度为完全透明;其中,预设角度范围为90度以上的预设第一角度值至90度以下的预设第二角度值之间的角度范围。In some embodiments, when the relative angle is within a preset angle range, the corresponding specified degree of transparency is completely transparent; wherein the preset angle range is a preset first angle value above 90 degrees to a preset second angle value below 90 degrees The angular range between angular values.
在一些实施例中,虚拟三维模型和虚拟相机所处的虚拟场景中还包含通过终端设备控制的虚拟角色,虚拟角色与虚拟相机之间为绑定关系;虚拟三维模型的渲染方法还包括:In some embodiments, the virtual scene where the virtual three-dimensional model and the virtual camera are located also includes a virtual character controlled by the terminal device, and the virtual character and the virtual camera are in a binding relationship; the method for rendering the virtual three-dimensional model further includes:
根据终端设备对虚拟角色的控制指令,确定针对虚拟角色的视角方向;Determine the viewing angle direction for the virtual character according to the control instruction of the terminal device on the virtual character;
根据视角方向确定虚拟相机的拍摄方向。Determine the shooting direction of the virtual camera according to the viewing angle direction.
在一些实施例中,虚拟三维模型包含多个纹理贴图;虚拟三维模型的渲染方法还包括:In some embodiments, the virtual 3D model includes a plurality of texture maps; the method for rendering the virtual 3D model further includes:
根据虚拟相机的拍摄方向,确定相对于拍摄方向的虚拟三维模型的前后至少部分重叠的多个目标纹理贴图;According to the shooting direction of the virtual camera, determine a plurality of target texture maps that at least partially overlap the front and rear of the virtual three-dimensional model relative to the shooting direction;
对目标纹理贴图的纹理显示参数进行调整,以减少按照目标指定透明程度渲染的多个目标纹理贴图前后重叠时产生的重影。Adjust the texture display parameters of the target texture map to reduce ghosting when multiple target texture maps rendered according to the specified transparency level of the target overlap.
在一些实施例中,纹理显示参数包括下述任意一项或多项:In some embodiments, the texture display parameters include any one or more of the following:
明亮度、曝光度、色彩对比度、色彩饱和度、色差、色号。Brightness, exposure, color contrast, color saturation, color difference, color number.
在一些实施例中,对目标纹理贴图的纹理显示参数进行调整,以减少按照目标指定透明程度渲染的多个目标纹理贴图前后重叠时产生的重影,包括:In some embodiments, the texture display parameters of the target texture map are adjusted to reduce ghosting generated when multiple target texture maps rendered according to the specified transparency level of the target overlap each other, including:
确定第一目标纹理贴图相对于拍摄方向映射至第二目标纹理贴图中的重叠部分贴图;determining that the first target texture map is mapped to the overlapping portion map in the second target texture map relative to the shooting direction;
对重叠部分贴图的纹理显示参数进行调整,以减少按照目标指定透明程度渲染的第一目标纹理贴图和第二目标纹理贴图之间前后重叠时产生的重影。Adjusts the texture display parameters of the overlapping part of the map to reduce ghosting when the first and second target texture maps are rendered with the specified transparency level of the target.
在一些实施例中,第一确定模块1001具体用于:In some embodiments, the first determining
将虚拟相机在虚拟场景中的第一坐标系转换为虚拟相机在虚拟三维模型的模型空间中的第二坐标系;Converting the first coordinate system of the virtual camera in the virtual scene to the second coordinate system of the virtual camera in the model space of the virtual three-dimensional model;
通过第二坐标系确定虚拟三维模型的纹理贴图的所在平面相对于虚拟相机的拍摄方向的目标相对角度。The target relative angle of the plane where the texture map of the virtual three-dimensional model is located relative to the shooting direction of the virtual camera is determined by the second coordinate system.
在一些实施例中,虚拟三维模型的模型空间中若干个纹理贴图穿插的轴心点为第二坐标系的原点;第一确定模块1001具体用于:In some embodiments, the pivot point interspersed with several texture maps in the model space of the virtual three-dimensional model is the origin of the second coordinate system; the
以第二坐标系中的原点作为中心点,确定虚拟三维模型的每个纹理贴图的所在平面相对于虚拟相机的拍摄方向的目标相对角度。Taking the origin in the second coordinate system as the center point, the relative target angle of the plane where each texture map of the virtual three-dimensional model is located relative to the shooting direction of the virtual camera is determined.
在一些实施例中,第二确定模块1002具体用于:In some embodiments, the second determining
将目标相对角度转换为目标角度系数,并确定目标角度系数对应的目标指定透明系数;每个角度系数对应有指定透明系数;Convert the relative angle of the target into the target angle coefficient, and determine the target specified transparency coefficient corresponding to the target angle coefficient; each angle coefficient corresponds to a specified transparency coefficient;
将目标指定透明系数和预设透明参数相乘,得到目标相对角度对应的目标指定透明程度的数值。Multiply the target-specified transparency coefficient and the preset transparency parameter to obtain the target-specified transparency value corresponding to the target relative angle.
在一些实施例中,角度系数为0至1之间的数值;其中,0表示虚拟相机垂直朝向于纹理贴图的一侧平面时的角度系数为0,1表示虚拟相机垂直朝向于纹理贴图的另一侧平面时的角度系数为1;In some embodiments, the angle coefficient is a value between 0 and 1; wherein, 0 indicates that the angle coefficient is 0 when the virtual camera is vertically facing one side of the texture map, and 1 indicates that the virtual camera is vertically facing the other side of the texture map. The angle coefficient of one side plane is 1;
相对角度为0度时角度系数为0或1;相对角度为90度时角度系数为0.5。When the relative angle is 0 degrees, the angle coefficient is 0 or 1; when the relative angle is 90 degrees, the angle coefficient is 0.5.
在一些实施例中,指定透明系数为0至1之间的数值;其中,1表示虚拟相机垂直朝向于纹理贴图的任一侧平面时的指定透明程度为不透明,0表示虚拟相机平行朝向于纹理贴图的平面时的指定透明程度为完全透明。In some embodiments, the specified transparency coefficient is a value between 0 and 1; wherein, 1 indicates that the specified degree of transparency is opaque when the virtual camera is vertically oriented to either side plane of the texture map, and 0 indicates that the virtual camera is oriented parallel to the texture The specified level of transparency when the map's plane is fully transparent.
在一些实施例中,若干个纹理贴图的数量为两个;两个纹理贴图通过垂直交叉的方式穿插形成的虚拟三维模型。In some embodiments, the number of several texture maps is two; the two texture maps are interspersed to form a virtual three-dimensional model by means of vertical intersection.
本申请实施例提供的虚拟三维模型的渲染装置,与上述实施例提供的虚拟三维模型的渲染方法具有相同的技术特征,所以也能解决相同的技术问题,达到相同的技术效果。The device for rendering a virtual 3D model provided by the embodiment of the present application has the same technical features as the method for rendering a virtual 3D model provided by the above-mentioned embodiment, so it can also solve the same technical problem and achieve the same technical effect.
本申请实施例还提供一种电子设备,包括:处理器、存储介质和总线,所述存储介质存储有所述处理器可执行的机器可读指令,当电子设备运行如实施例中的一种虚拟三维模型的渲染方法时,所述处理器与所述存储介质之间通过总线通信,所述处理器执行所述机器可读指令,所述处理器方法项的前序部分,以执行以下步骤:An embodiment of the present application further provides an electronic device, including: a processor, a storage medium, and a bus, where the storage medium stores machine-readable instructions executable by the processor, when the electronic device runs as one of the embodiments In the rendering method of a virtual three-dimensional model, the processor and the storage medium communicate through a bus, the processor executes the machine-readable instruction, and the processor is the preamble of the method item to execute the following steps :
根据虚拟相机的拍摄方向,确定所述虚拟三维模型的纹理贴图的所在平面相对于所述虚拟相机的拍摄方向的目标相对角度;每个所述相对角度对应有指定透明程度,所述相对角度越大则对应的所述指定透明程度越大;According to the shooting direction of the virtual camera, determine the target relative angle of the plane where the texture map of the virtual three-dimensional model is located relative to the shooting direction of the virtual camera; each relative angle corresponds to a specified degree of transparency, and the higher the relative angle The larger the specified transparency, the greater the corresponding degree of transparency;
确定所述目标相对角度对应的目标指定透明程度;determining the target specified transparency degree corresponding to the target relative angle;
按照所述目标指定透明程度渲染所述纹理贴图,得到所述虚拟三维模型的渲染结果。The texture map is rendered according to the specified transparency degree of the target, and a rendering result of the virtual three-dimensional model is obtained.
在一个可行的实施方案中,所述相对角度为0度时对应的所述指定透明程度为不透明,所述相对角度为90度时对应的所述指定透明程度为完全透明。In a feasible implementation, when the relative angle is 0 degrees, the corresponding specified transparency degree is opaque, and when the relative angle is 90 degrees, the corresponding specified transparency degree is completely transparent.
在一个可行的实施方案中,所述相对角度在预设角度范围时,对应的所述指定透明程度为完全透明;其中,所述预设角度范围为90度以上的预设第一角度值至90度以下的所述预设第二角度值之间的角度范围。In a feasible implementation, when the relative angle is within a preset angle range, the corresponding specified degree of transparency is completely transparent; wherein, the preset angle range is a preset first angle value of 90 degrees or more to The angle range between the preset second angle values below 90 degrees.
在一个可行的实施方案中,所述虚拟三维模型和所述虚拟相机所处的虚拟场景中还包含通过终端设备控制的虚拟角色,所述虚拟角色与所述虚拟相机之间为绑定关系;所述处理器还用于:根据所述终端设备对所述虚拟角色的控制指令,确定针对所述虚拟角色的视角方向;In a feasible implementation, the virtual scene where the virtual three-dimensional model and the virtual camera are located further includes a virtual character controlled by a terminal device, and the virtual character and the virtual camera are in a binding relationship; The processor is further configured to: determine a viewing angle direction for the virtual character according to a control instruction of the terminal device on the virtual character;
根据所述视角方向确定所述虚拟相机的拍摄方向。The shooting direction of the virtual camera is determined according to the viewing angle direction.
在一个可行的实施方案中,所述虚拟三维模型包含多个所述纹理贴图;所述处理器还用于:根据所述虚拟相机的拍摄方向,确定相对于所述拍摄方向的虚拟三维模型的前后至少部分重叠的多个目标纹理贴图;In a feasible implementation, the virtual three-dimensional model includes a plurality of the texture maps; the processor is further configured to: determine, according to the shooting direction of the virtual camera, the virtual three-dimensional model relative to the shooting direction multiple target texture maps at least partially overlapping front and rear;
对所述目标纹理贴图的纹理显示参数进行调整,以减少按照所述目标指定透明程度渲染的多个所述目标纹理贴图前后重叠时产生的重影。The texture display parameters of the target texture map are adjusted to reduce ghosting generated when a plurality of the target texture maps rendered according to the specified transparency level of the target overlap with each other.
在一个可行的实施方案中,所述纹理显示参数包括下述任意一项或多项:In a feasible implementation, the texture display parameters include any one or more of the following:
明亮度、曝光度、色彩对比度、色彩饱和度、色差、色号。Brightness, exposure, color contrast, color saturation, color difference, color number.
在一个可行的实施方案中,所述处理器在执行对所述目标纹理贴图的纹理显示参数进行调整,以减少按照所述目标指定透明程度渲染的多个所述目标纹理贴图前后重叠时产生的重影时,具体用于:In a feasible implementation, the processor adjusts the texture display parameters of the target texture map so as to reduce the occurrence of overlapping of multiple target texture maps rendered according to the specified transparency level of the target. When ghosting, specifically for:
确定第一目标纹理贴图相对于所述拍摄方向映射至第二目标纹理贴图中的重叠部分贴图;determining that the first target texture map is mapped to the overlapping portion map in the second target texture map relative to the shooting direction;
对所述重叠部分贴图的纹理显示参数进行调整,以减少按照所述目标指定透明程度渲染的所述第一目标纹理贴图和所述第二目标纹理贴图之间前后重叠时产生的重影。Adjusting the texture display parameter of the overlapping part map to reduce the ghosting generated when the first target texture map and the second target texture map rendered according to the specified transparency level of the target overlap back and forth.
在一个可行的实施方案中,所述处理器在执行根据虚拟相机的拍摄方向,确定所述虚拟三维模型的纹理贴图的所在平面相对于所述虚拟相机的拍摄方向的目标相对角度时,具体用于:将所述虚拟相机在所述虚拟场景中的第一坐标系转换为所述虚拟相机在所述虚拟三维模型的模型空间中的第二坐标系;In a feasible implementation, when the processor determines, according to the shooting direction of the virtual camera, the relative angle of the target of the plane where the texture map of the virtual three-dimensional model is located relative to the shooting direction of the virtual camera, specifically: In: converting the first coordinate system of the virtual camera in the virtual scene into a second coordinate system of the virtual camera in the model space of the virtual three-dimensional model;
通过所述第二坐标系确定虚拟三维模型的纹理贴图的所在平面相对于虚拟相机的拍摄方向的目标相对角度。The target relative angle of the plane where the texture map of the virtual three-dimensional model is located relative to the shooting direction of the virtual camera is determined by the second coordinate system.
在一个可行的实施方案中,所述虚拟三维模型的模型空间中所述若干个纹理贴图穿插的轴心点为所述第二坐标系的原点;所述处理器在执行通过所述第二坐标系确定所述虚拟三维模型的纹理贴图的所在平面相对于所述虚拟相机的拍摄方向的目标相对角度时,具体用于:以所述第二坐标系中的所述原点作为中心点,确定虚拟三维模型的每个纹理贴图的所在平面相对于虚拟相机的拍摄方向的目标相对角度。In a feasible implementation, the pivot point where the plurality of texture maps are interspersed in the model space of the virtual three-dimensional model is the origin of the second coordinate system; When the system determines the target relative angle of the plane where the texture map of the virtual three-dimensional model is located relative to the shooting direction of the virtual camera, it is specifically used to: take the origin in the second coordinate system as the center point, determine the virtual The target relative angle of the plane where each texture map of the 3D model is located relative to the shooting direction of the virtual camera.
在一个可行的实施方案中,所述处理器在执行确定所述目标相对角度对应的目标指定透明程度时,具体用于:将所述目标相对角度转换为目标角度系数,并确定所述目标角度系数对应的目标指定透明系数;每个所述角度系数对应有指定透明系数;In a feasible embodiment, when the processor performs determining the target specified transparency degree corresponding to the target relative angle, the processor is specifically configured to: convert the target relative angle into a target angle coefficient, and determine the target angle The target corresponding to the coefficient specifies a transparency coefficient; each of the angle coefficients corresponds to a specified transparency coefficient;
将所述目标指定透明系数和预设透明参数相乘,得到所述目标相对角度对应的目标指定透明程度的数值。Multiplying the target-specified transparency coefficient and a preset transparency parameter to obtain a numerical value of the target-specified transparency degree corresponding to the target relative angle.
在一个可行的实施方案中,所述角度系数为0至1之间的数值;其中,0表示所述虚拟相机垂直朝向于所述纹理贴图的一侧平面时的所述角度系数为0,1表示所述虚拟相机垂直朝向于所述纹理贴图的另一侧平面时的所述角度系数为1;In a feasible implementation, the angle coefficient is a value between 0 and 1; wherein, 0 indicates that the angle coefficient is 0, 1 when the virtual camera is vertically oriented to one side plane of the texture map Indicates that the angle coefficient is 1 when the virtual camera is vertically oriented to the other side plane of the texture map;
所述相对角度为0度时所述角度系数为0或1;所述相对角度为90度时所述角度系数为0.5。When the relative angle is 0 degrees, the angle coefficient is 0 or 1; when the relative angle is 90 degrees, the angle coefficient is 0.5.
在一个可行的实施方案中,所述指定透明系数为0至1之间的数值;其中,1表示所述虚拟相机垂直朝向于所述纹理贴图的任一侧平面时的所述指定透明程度为不透明,0表示所述虚拟相机平行朝向于所述纹理贴图的平面时的所述指定透明程度为完全透明。In a feasible implementation, the specified transparency coefficient is a value between 0 and 1; wherein, 1 indicates that the specified transparency degree when the virtual camera is vertically oriented to any side plane of the texture map is Opaque, 0 indicates that the specified degree of transparency when the virtual camera is parallel to the plane of the texture map is completely transparent.
在一个可行的实施方案中,所述若干个纹理贴图的数量为两个;两个所述纹理贴图通过垂直交叉的方式穿插形成的所述虚拟三维模型。In a feasible implementation, the number of the several texture maps is two; the virtual three-dimensional model is formed by interspersing the two texture maps in a vertically intersecting manner.
通过上述方式,纹理贴图的显示透明度根据虚拟三维模型本身与虚拟相机的相对角度而变化,即虚拟相机面向于纹理贴图的平面的目标相对角度越大则其对应渲染出的透明程度越大,使得纹理贴图侧面面对虚拟摄像机的时候更加透明,纹理贴图正面面对虚拟摄像机时最不透明度,从而使得侧面看虚拟三维模型中的纹理贴图时不会再有插片痕迹,还不会影响其他角度的纹理贴图展示效果,且不同角度的显示效果过渡自然,由纹理贴图渲染得到的虚拟三维模型从各个角度观察得到的显示效果一致,进而整体降低虚拟三维模型的插片感,提升虚拟三维模型的整体显示效果,缓解了现有技术中虚拟三维模型的整体显示效果较差的技术问题。In the above manner, the display transparency of the texture map changes according to the relative angle between the virtual 3D model itself and the virtual camera, that is, the greater the relative angle of the virtual camera facing the plane of the texture map, the greater the degree of transparency it renders, so that The texture map is more transparent when the side of the texture map faces the virtual camera, and the texture map is the most opaque when the front side of the texture map faces the virtual camera, so that there will be no insert marks when looking at the texture map in the virtual 3D model from the side, and it will not affect other angles. The virtual 3D model rendered by the texture map has the same display effect from all angles, thereby reducing the overall sense of inserting the virtual 3D model and improving the virtual 3D model. The overall display effect alleviates the technical problem that the overall display effect of the virtual three-dimensional model in the prior art is poor.
本申请实施例还提供了一种计算机可读存储介质,该计算机可读存储介质上存储有计算机程序,该计算机程序被处理器运行时执行,所述处理器执行以下步骤:Embodiments of the present application further provide a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and the computer program is executed when a processor runs, and the processor performs the following steps:
根据虚拟相机的拍摄方向,确定所述虚拟三维模型的纹理贴图的所在平面相对于所述虚拟相机的拍摄方向的目标相对角度;每个所述相对角度对应有指定透明程度,所述相对角度越大则对应的所述指定透明程度越大;According to the shooting direction of the virtual camera, determine the target relative angle of the plane where the texture map of the virtual three-dimensional model is located relative to the shooting direction of the virtual camera; each relative angle corresponds to a specified degree of transparency, and the higher the relative angle The larger the specified transparency, the greater the corresponding degree of transparency;
确定所述目标相对角度对应的目标指定透明程度;determining the target specified transparency degree corresponding to the target relative angle;
按照所述目标指定透明程度渲染所述纹理贴图,得到所述虚拟三维模型的渲染结果。The texture map is rendered according to the specified transparency degree of the target, and a rendering result of the virtual three-dimensional model is obtained.
在一个可行的实施方案中,所述相对角度为0度时对应的所述指定透明程度为不透明,所述相对角度为90度时对应的所述指定透明程度为完全透明。In a feasible implementation, when the relative angle is 0 degrees, the corresponding specified transparency degree is opaque, and when the relative angle is 90 degrees, the corresponding specified transparency degree is completely transparent.
在一个可行的实施方案中,所述相对角度在预设角度范围时,对应的所述指定透明程度为完全透明;其中,所述预设角度范围为90度以上的预设第一角度值至90度以下的所述预设第二角度值之间的角度范围。In a feasible implementation, when the relative angle is within a preset angle range, the corresponding specified degree of transparency is completely transparent; wherein, the preset angle range is a preset first angle value of 90 degrees or more to The angle range between the preset second angle values below 90 degrees.
在一个可行的实施方案中,所述虚拟三维模型和所述虚拟相机所处的虚拟场景中还包含通过终端设备控制的虚拟角色,所述虚拟角色与所述虚拟相机之间为绑定关系;所述处理器还用于:根据所述终端设备对所述虚拟角色的控制指令,确定针对所述虚拟角色的视角方向;In a feasible implementation, the virtual scene where the virtual three-dimensional model and the virtual camera are located further includes a virtual character controlled by a terminal device, and the virtual character and the virtual camera are in a binding relationship; The processor is further configured to: determine a viewing angle direction for the virtual character according to a control instruction of the terminal device on the virtual character;
根据所述视角方向确定所述虚拟相机的拍摄方向。The shooting direction of the virtual camera is determined according to the viewing angle direction.
在一个可行的实施方案中,所述虚拟三维模型包含多个所述纹理贴图;所述处理器还用于:根据所述虚拟相机的拍摄方向,确定相对于所述拍摄方向的虚拟三维模型的前后至少部分重叠的多个目标纹理贴图;In a feasible implementation, the virtual three-dimensional model includes a plurality of the texture maps; the processor is further configured to: determine, according to the shooting direction of the virtual camera, the virtual three-dimensional model relative to the shooting direction multiple target texture maps at least partially overlapping front and rear;
对所述目标纹理贴图的纹理显示参数进行调整,以减少按照所述目标指定透明程度渲染的多个所述目标纹理贴图前后重叠时产生的重影。The texture display parameters of the target texture map are adjusted to reduce ghosting generated when a plurality of the target texture maps rendered according to the specified transparency level of the target overlap with each other.
在一个可行的实施方案中,所述纹理显示参数包括下述任意一项或多项:In a feasible implementation, the texture display parameters include any one or more of the following:
明亮度、曝光度、色彩对比度、色彩饱和度、色差、色号。Brightness, exposure, color contrast, color saturation, color difference, color number.
在一个可行的实施方案中,所述处理器在执行对所述目标纹理贴图的纹理显示参数进行调整,以减少按照所述目标指定透明程度渲染的多个所述目标纹理贴图前后重叠时产生的重影时,具体用于:In a feasible implementation, the processor adjusts the texture display parameters of the target texture map so as to reduce the occurrence of overlapping of multiple target texture maps rendered according to the specified transparency level of the target. When ghosting, specifically for:
确定第一目标纹理贴图相对于所述拍摄方向映射至第二目标纹理贴图中的重叠部分贴图;determining that the first target texture map is mapped to the overlapping portion map in the second target texture map relative to the shooting direction;
对所述重叠部分贴图的纹理显示参数进行调整,以减少按照所述目标指定透明程度渲染的所述第一目标纹理贴图和所述第二目标纹理贴图之间前后重叠时产生的重影。Adjusting the texture display parameter of the overlapping part map to reduce the ghosting generated when the first target texture map and the second target texture map rendered according to the specified transparency level of the target overlap back and forth.
在一个可行的实施方案中,所述处理器在执行根据虚拟相机的拍摄方向,确定所述虚拟三维模型的纹理贴图的所在平面相对于所述虚拟相机的拍摄方向的目标相对角度时,具体用于:将所述虚拟相机在所述虚拟场景中的第一坐标系转换为所述虚拟相机在所述虚拟三维模型的模型空间中的第二坐标系;通过所述第二坐标系确定虚拟三维模型的纹理贴图的所在平面相对于虚拟相机的拍摄方向的目标相对角度。In a feasible implementation, when the processor determines, according to the shooting direction of the virtual camera, the relative angle of the target of the plane where the texture map of the virtual three-dimensional model is located relative to the shooting direction of the virtual camera, specifically: In: converting the first coordinate system of the virtual camera in the virtual scene into a second coordinate system of the virtual camera in the model space of the virtual three-dimensional model; determining the virtual three-dimensional The target relative angle of the plane where the texture map of the model is located relative to the shooting direction of the virtual camera.
在一个可行的实施方案中,所述虚拟三维模型的模型空间中所述若干个纹理贴图穿插的轴心点为所述第二坐标系的原点;所述处理器在执行通过所述第二坐标系确定所述虚拟三维模型的纹理贴图的所在平面相对于所述虚拟相机的拍摄方向的目标相对角度时,具体用于:以所述第二坐标系中的所述原点作为中心点,确定虚拟三维模型的每个纹理贴图的所在平面相对于虚拟相机的拍摄方向的目标相对角度。In a feasible implementation, the pivot point where the plurality of texture maps are interspersed in the model space of the virtual three-dimensional model is the origin of the second coordinate system; When the system determines the target relative angle of the plane where the texture map of the virtual three-dimensional model is located relative to the shooting direction of the virtual camera, it is specifically used to: take the origin in the second coordinate system as the center point, determine the virtual The target relative angle of the plane where each texture map of the 3D model is located relative to the shooting direction of the virtual camera.
在一个可行的实施方案中,所述处理器在执行确定所述目标相对角度对应的目标指定透明程度时,具体用于:将所述目标相对角度转换为目标角度系数,并确定所述目标角度系数对应的目标指定透明系数;每个所述角度系数对应有指定透明系数;将所述目标指定透明系数和预设透明参数相乘,得到所述目标相对角度对应的目标指定透明程度的数值。In a feasible embodiment, when the processor performs determining the target specified transparency degree corresponding to the target relative angle, the processor is specifically configured to: convert the target relative angle into a target angle coefficient, and determine the target angle The target specified transparency coefficient corresponding to the coefficient; each of the angle coefficients corresponds to a specified transparency coefficient; the target specified transparency coefficient and the preset transparency parameter are multiplied to obtain the numerical value of the target specified transparency degree corresponding to the target relative angle.
在一个可行的实施方案中,所述角度系数为0至1之间的数值;其中,0表示所述虚拟相机垂直朝向于所述纹理贴图的一侧平面时的所述角度系数为0,1表示所述虚拟相机垂直朝向于所述纹理贴图的另一侧平面时的所述角度系数为1;所述相对角度为0度时所述角度系数为0或1;所述相对角度为90度时所述角度系数为0.5。In a feasible implementation, the angle coefficient is a value between 0 and 1; wherein, 0 indicates that the angle coefficient is 0, 1 when the virtual camera is vertically oriented to one side plane of the texture map Indicates that the angle coefficient is 1 when the virtual camera is vertically facing the other side plane of the texture map; the angle coefficient is 0 or 1 when the relative angle is 0 degrees; the relative angle is 90 degrees When the angle coefficient is 0.5.
在一个可行的实施方案中,所述指定透明系数为0至1之间的数值;其中,1表示所述虚拟相机垂直朝向于所述纹理贴图的任一侧平面时的所述指定透明程度为不透明,0表示所述虚拟相机平行朝向于所述纹理贴图的平面时的所述指定透明程度为完全透明。In a feasible implementation, the specified transparency coefficient is a value between 0 and 1; wherein, 1 indicates that the specified transparency degree when the virtual camera is vertically oriented to any side plane of the texture map is Opaque, 0 indicates that the specified degree of transparency when the virtual camera is parallel to the plane of the texture map is completely transparent.
在一个可行的实施方案中,所述若干个纹理贴图的数量为两个;两个所述纹理贴图通过垂直交叉的方式穿插形成的所述虚拟三维模型。In a feasible implementation, the number of the several texture maps is two; the virtual three-dimensional model is formed by interspersing the two texture maps in a vertically intersecting manner.
通过上述方式,纹理贴图的显示透明度根据虚拟三维模型本身与虚拟相机的相对角度而变化,即虚拟相机面向于纹理贴图的平面的目标相对角度越大则其对应渲染出的透明程度越大,使得纹理贴图侧面面对虚拟摄像机的时候更加透明,纹理贴图正面面对虚拟摄像机时最不透明度,从而使得侧面看虚拟三维模型中的纹理贴图时不会再有插片痕迹,还不会影响其他角度的纹理贴图展示效果,且不同角度的显示效果过渡自然,由纹理贴图渲染得到的虚拟三维模型从各个角度观察得到的显示效果一致,进而整体降低虚拟三维模型的插片感,提升虚拟三维模型的整体显示效果,缓解了现有技术中虚拟三维模型的整体显示效果较差的技术问题。In the above manner, the display transparency of the texture map changes according to the relative angle between the virtual 3D model itself and the virtual camera, that is, the greater the relative angle of the virtual camera facing the plane of the texture map, the greater the degree of transparency it renders, so that The texture map is more transparent when the side of the texture map faces the virtual camera, and the texture map is the most opaque when the front side of the texture map faces the virtual camera, so that there will be no insert marks when looking at the texture map in the virtual 3D model from the side, and it will not affect other angles. The virtual 3D model rendered by the texture map has the same display effect from all angles, thereby reducing the overall sense of inserting the virtual 3D model and improving the virtual 3D model. The overall display effect alleviates the technical problem that the overall display effect of the virtual three-dimensional model in the prior art is poor.
本申请实施例所提供的虚拟三维模型的渲染装置可以为设备上的特定硬件或者安装于设备上的软件或固件等。本申请实施例所提供的装置,其实现原理及产生的技术效果和前述方法实施例相同,为简要描述,装置实施例部分未提及之处,可参考前述方法实施例中相应内容。所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,前述描述的系统、装置和单元的具体工作过程,均可以参考上述方法实施例中的对应过程,在此不再赘述。The apparatus for rendering a virtual three-dimensional model provided by the embodiment of the present application may be specific hardware on the device or software or firmware installed on the device, or the like. The implementation principles and technical effects of the devices provided in the embodiments of the present application are the same as those in the foregoing method embodiments. For brief description, for the parts not mentioned in the device embodiments, reference may be made to the corresponding content in the foregoing method embodiments. Those skilled in the art can clearly understand that, for the convenience and brevity of the description, the specific working processes of the systems, devices and units described above can all refer to the corresponding processes in the above method embodiments, which will not be repeated here.
在本申请所提供的实施例中,应该理解到,所揭露装置和方法,可以通过其它的方式实现。以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,又例如,多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些通信接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the embodiments provided in this application, it should be understood that the disclosed apparatus and method may be implemented in other manners. The apparatus embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not implemented. On the other hand, the shown or discussed mutual coupling or direct coupling or communication connection may be through some communication interfaces, indirect coupling or communication connection of devices or units, which may be in electrical, mechanical or other forms.
再例如,附图中的流程图和框图显示了根据本申请的多个实施例的装置、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段或代码的一部分,所述模块、程序段或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现方式中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个连续的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或动作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。As another example, the flowchart and block diagrams in the Figures illustrate the architecture, functionality, and operation of possible implementations of apparatuses, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code that contains one or more functions for implementing the specified logical function(s) executable instructions. It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It is also noted that each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations, can be implemented in dedicated hardware-based systems that perform the specified functions or actions , or can be implemented in a combination of dedicated hardware and computer instructions.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
另外,在本申请提供的实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。In addition, each functional unit in the embodiments provided in this application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述虚拟三维模型的渲染方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-OnlyMemory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。The functions, if implemented in the form of software functional units and sold or used as independent products, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be embodied in the form of a software product in essence, or the part that contributes to the prior art or the part of the technical solution. The computer software product is stored in a storage medium, including Several instructions are used to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method for rendering a virtual three-dimensional model described in various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk and other media that can store program codes.
应注意到:相似的标号和字母在下面的附图中表示类似项,因此,一旦某一项在一个附图中被定义,则在随后的附图中不需要对其进行进一步定义和解释,此外,术语“第一”、“第二”、“第三”等仅用于区分描述,而不能理解为指示或暗示相对重要性。It should be noted that like numerals and letters refer to like items in the following figures, so that once an item is defined in one figure, it does not require further definition and explanation in subsequent figures, Furthermore, the terms "first", "second", "third", etc. are only used to differentiate the description and should not be construed as indicating or implying relative importance.
最后应说明的是:以上所述实施例,仅为本申请的具体实施方式,用以说明本申请的技术方案,而非对其限制,本申请的保护范围并不局限于此,尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,其依然可以对前述实施例所记载的技术方案进行修改或可轻易想到变化,或者对其中部分技术特征进行等同替换;而这些修改、变化或者替换,并不使相应技术方案的本质脱离本申请实施例技术方案的范围。都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以权利要求的保护范围为准。Finally, it should be noted that the above-mentioned embodiments are only specific implementations of the present application, and are used to illustrate the technical solutions of the present application, rather than limit them. The embodiments describe the application in detail, and those of ordinary skill in the art should understand that: any person skilled in the art can still modify the technical solutions described in the foregoing embodiments within the technical scope disclosed in the application. Or changes can be easily thought of, or equivalent replacements are made to some of the technical features; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application. All should be covered within the scope of protection of this application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims (16)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210574259.1A CN114926579A (en) | 2022-05-24 | 2022-05-24 | Rendering method and device of virtual three-dimensional model and electronic terminal |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210574259.1A CN114926579A (en) | 2022-05-24 | 2022-05-24 | Rendering method and device of virtual three-dimensional model and electronic terminal |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114926579A true CN114926579A (en) | 2022-08-19 |
Family
ID=82810788
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210574259.1A Pending CN114926579A (en) | 2022-05-24 | 2022-05-24 | Rendering method and device of virtual three-dimensional model and electronic terminal |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114926579A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116664785A (en) * | 2023-01-03 | 2023-08-29 | 广州全成多维信息技术有限公司 | Engineering terrain rendering method, device, equipment and medium based on 3D technology |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20020021832A1 (en) * | 2000-06-30 | 2002-02-21 | Dawson Mark Thomas | Method and apparatus for producing anaglyphic 3-D images |
JP2002279445A (en) * | 2001-03-21 | 2002-09-27 | Namco Ltd | Image generation system, program, and information storage medium |
US20130109470A1 (en) * | 2011-10-28 | 2013-05-02 | Nintendo Co., Ltd. | Game processing system, game processing method, game processing apparatus, and computer-readable storage medium having game processing program stored therein |
US20200084431A1 (en) * | 2018-02-16 | 2020-03-12 | Canon Kabushiki Kaisha | Image processing apparatus, image processing method and storage medium |
US20200310134A1 (en) * | 2019-03-26 | 2020-10-01 | Kevin Chew Figueroa | Method and device of field sequential imaging for large field of view augmented/virtual reality |
CN114299207A (en) * | 2021-12-14 | 2022-04-08 | 网易(杭州)网络有限公司 | Virtual object rendering method and device, readable storage medium and electronic device |
CN114494548A (en) * | 2021-12-24 | 2022-05-13 | 网易(杭州)网络有限公司 | Method, device and electronic device for generating virtual model |
-
2022
- 2022-05-24 CN CN202210574259.1A patent/CN114926579A/en active Pending
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20020021832A1 (en) * | 2000-06-30 | 2002-02-21 | Dawson Mark Thomas | Method and apparatus for producing anaglyphic 3-D images |
JP2002279445A (en) * | 2001-03-21 | 2002-09-27 | Namco Ltd | Image generation system, program, and information storage medium |
US20130109470A1 (en) * | 2011-10-28 | 2013-05-02 | Nintendo Co., Ltd. | Game processing system, game processing method, game processing apparatus, and computer-readable storage medium having game processing program stored therein |
US20200084431A1 (en) * | 2018-02-16 | 2020-03-12 | Canon Kabushiki Kaisha | Image processing apparatus, image processing method and storage medium |
US20200310134A1 (en) * | 2019-03-26 | 2020-10-01 | Kevin Chew Figueroa | Method and device of field sequential imaging for large field of view augmented/virtual reality |
CN114299207A (en) * | 2021-12-14 | 2022-04-08 | 网易(杭州)网络有限公司 | Virtual object rendering method and device, readable storage medium and electronic device |
CN114494548A (en) * | 2021-12-24 | 2022-05-13 | 网易(杭州)网络有限公司 | Method, device and electronic device for generating virtual model |
Non-Patent Citations (1)
Title |
---|
钟卫华, 陈毛毛, 曹双喜, 陈福民: "基于无缝拼接的分布式多屏渲染系统", 计算机应用, no. 06, 28 June 2004 (2004-06-28) * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116664785A (en) * | 2023-01-03 | 2023-08-29 | 广州全成多维信息技术有限公司 | Engineering terrain rendering method, device, equipment and medium based on 3D technology |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108236783B (en) | Method and device for simulating illumination in game scene, terminal equipment and storage medium | |
JP4698893B2 (en) | Method, graphics system, and program for providing improved fog effects | |
JP4863574B2 (en) | Image generation method using Z texturing | |
US6525725B1 (en) | Morphing decompression in a graphics system | |
WO2022247204A1 (en) | Game display control method, non-volatile storage medium and electronic device | |
CN111145326A (en) | Processing method of three-dimensional virtual cloud model, storage medium, processor and electronic device | |
CN109985384B (en) | Method and device for dynamically adjusting map | |
CN108404414B (en) | Picture fusion method and device, storage medium, processor and terminal | |
US9183654B2 (en) | Live editing and integrated control of image-based lighting of 3D models | |
CN104574496A (en) | Static shadow and dynamic shadow fusing method and device for light map calculation | |
CN116501209A (en) | Editing view angle adjusting method and device, electronic equipment and readable storage medium | |
US7479961B2 (en) | Program, information storage medium, and image generation system | |
CN111494945A (en) | Virtual object processing method and device, storage medium and electronic equipment | |
CN114926579A (en) | Rendering method and device of virtual three-dimensional model and electronic terminal | |
CN110458922B (en) | Graphics rendering method and related product | |
JP2004334661A (en) | Image generation system, program and information storage medium | |
JP2001143099A (en) | Image generation system and information storage medium | |
JP2001134779A (en) | Method and device for providing non-realistic comic contour line in three-dimensional video graphics system | |
CN114299207B (en) | Virtual object rendering method, device, readable storage medium and electronic device | |
JP4707078B2 (en) | Image generation system, program, and information storage medium | |
JP4704615B2 (en) | Image generation system, program, and information storage medium | |
JP2007512603A (en) | Image drawing | |
JP3254195B2 (en) | Image generation system and information storage medium | |
JP2025512657A (en) | Checkerboard Mask Optimization for Occlusion Culling | |
JP4528008B2 (en) | Program, information storage medium, and image generation system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |