CN114299207A - Virtual object rendering method and device, readable storage medium and electronic device - Google Patents
Virtual object rendering method and device, readable storage medium and electronic device Download PDFInfo
- Publication number
- CN114299207A CN114299207A CN202111527719.7A CN202111527719A CN114299207A CN 114299207 A CN114299207 A CN 114299207A CN 202111527719 A CN202111527719 A CN 202111527719A CN 114299207 A CN114299207 A CN 114299207A
- Authority
- CN
- China
- Prior art keywords
- target
- virtual object
- determining
- angle
- rendering
- 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.)
- Granted
Links
Images
Landscapes
- Processing Or Creating Images (AREA)
Abstract
Description
技术领域technical field
本发明涉及计算机领域,具体而言,涉及一种虚拟对象渲染方法、装置、可读存储介质和电子装置。The present invention relates to the field of computers, and in particular, to a virtual object rendering method, device, readable storage medium and electronic device.
背景技术Background technique
在相关技术中,对游戏场景中的月食效果是通过模型贴图坐标(UV)的流动使黑色月亮对象覆盖原有月亮对象,从而实现月食的一个效果,但月食图像无法随着视野变化而变化,从而存在对虚拟月亮对象的月食效果进行展现的灵活性低的问题。In the related art, the lunar eclipse effect in the game scene is to make the black moon object cover the original moon object through the flow of model texture coordinates (UV), so as to realize an effect of lunar eclipse, but the lunar eclipse image cannot change with the field of view However, there is a problem that the flexibility of displaying the lunar eclipse effect of the virtual moon object is low.
针对现有技术中对虚拟月亮对象的月食效果进行展现的灵活性低的问题,目前尚未提出有效的解决方案。Aiming at the problem of low flexibility in displaying the lunar eclipse effect of the virtual moon object in the prior art, no effective solution has been proposed yet.
发明内容SUMMARY OF THE INVENTION
本发明至少部分实施例提供了一种虚拟对象渲染方法、装置、可读存储介质和电子装置,以至少解决对虚拟月亮对象的月食效果进行展现的灵活性低的技术问题。At least some embodiments of the present invention provide a virtual object rendering method, device, readable storage medium, and electronic device to at least solve the technical problem of low flexibility in displaying the lunar eclipse effect of a virtual moon object.
为了实现上述目的,根据本发明其中一实施例,提供了一种虚拟对象渲染方法。通过终端设备提供图形用户界面,图形用户界面至少部分地显示一游戏场景,游戏场景至少部分地包括一虚拟对象。该方法可以包括:确定游戏场景的观察角度;基于观察角度对第一目标贴图进行溶解处理,得到溶解结果,其中,第一目标贴图用于表征虚拟对象的纹理图像;基于溶解结果确定虚拟对象的目标透明值;根据目标透明值,以渲染显示虚拟对象。In order to achieve the above object, according to one embodiment of the present invention, a method for rendering a virtual object is provided. A graphical user interface is provided by the terminal device, the graphical user interface at least partially displays a game scene, and the game scene at least partially includes a virtual object. The method may include: determining an observation angle of the game scene; dissolving a first target map based on the observation angle to obtain a dissolution result, wherein the first target map is used to represent a texture image of a virtual object; The target transparency value; according to the target transparency value, the virtual object is displayed in rendering.
可选地,获取游戏场景的观察角度,包括:实时获取游戏角色在游戏场景的观察视野,其中,游戏场景包括通过终端设备控制的游戏角色;根据观察视野,确定虚拟对象的观察角度。Optionally, acquiring the observation angle of the game scene includes: acquiring the observation field of view of the game character in the game scene in real time, wherein the game scene includes the game character controlled by the terminal device; and determining the observation angle of the virtual object according to the observation field of view.
可选地,获取第二目标贴图,其中,第二目标贴图用于表征游戏场景中虚拟云层的纹理图像,且随着时间的变化而变化;基于第二目标贴图确定虚拟对象的目标颜色;根据目标透明值,以渲染显示虚拟对象,包括:根据目标透明值和目标颜色,以渲染虚拟对象。Optionally, obtain a second target map, wherein the second target map is used to represent the texture image of the virtual cloud layer in the game scene, and changes with time; determine the target color of the virtual object based on the second target map; The target transparency value is used to render and display the virtual object, including: rendering the virtual object according to the target transparency value and the target color.
可选地,根据目标透明值和目标颜色,以渲染虚拟对象,包括:根据虚拟对象上目标纹理坐标对应的目标透明值和目标颜色,以渲染虚拟对象。Optionally, rendering the virtual object according to the target transparency value and the target color includes: rendering the virtual object according to the target transparency value and the target color corresponding to the target texture coordinates on the virtual object.
可选地,基于观察角度对第一目标贴图进行溶解处理,得到溶解结果,包括:基于观察角度确定目标平滑参数;基于目标平滑参数对第一目标贴图进行平滑处理,得到溶解结果。Optionally, dissolving the first target texture based on the observation angle to obtain a dissolution result includes: determining a target smoothing parameter based on the viewing angle; and smoothing the first target texture based on the target smoothing parameter to obtain a dissolution result.
可选地,基于观察角度确定目标平滑参数,包括:确定与观察角度对应的目标位置,其中,预设摄像机用于在目标位置上对游戏场景进行拍摄,以得到游戏场景中观察角度的场景画面;确定目标位置相对于虚拟对象的位置的第一旋转角度;基于第一旋转角度确定目标平滑参数。Optionally, determining the target smoothing parameter based on the observation angle includes: determining a target position corresponding to the observation angle, wherein a preset camera is used to photograph the game scene at the target position, so as to obtain a scene picture of the observation angle in the game scene. ; determining a first rotation angle of the target position relative to the position of the virtual object; determining a target smoothing parameter based on the first rotation angle.
可选地,基于第一旋转角度确定目标平滑参数,包括:将第一旋转角度转换至第一值域范围内的第二旋转角度,其中,在第二旋转角度为第一值域范围的上限值时,渲染显示后的虚拟对象呈现第一显示状态,在第二旋转角度为第一值域范围的下限值时,渲染显示后的虚拟对象呈现第二显示状态;基于第二旋转角度确定目标平滑参数。Optionally, determining the target smoothing parameter based on the first rotation angle includes: converting the first rotation angle to a second rotation angle within the first value range, where the second rotation angle is above the first value range. When the limit is reached, the rendered and displayed virtual object presents the first display state, and when the second rotation angle is the lower limit of the first value range, the rendered and displayed virtual object presents the second display state; based on the second rotation angle Determine target smoothing parameters.
可选地,基于第二旋转角度确定所述目标平滑参数,包括:将第二旋转角度转换为第二值域范围内的第三旋转角度,其中,第二值域范围小于第一值域范围;基于第三旋转角度确定平滑函数的第一平滑参数和第二平滑参数;基于目标平滑参数对第一目标贴图进行平滑处理,得到溶解结果,包括:将第一平滑参数、第二平滑参数和第一目标贴图输入至平滑函数中进行平滑处理,得到溶解结果,其中,溶解结果处于第一平滑参数和第二平滑参数之间。Optionally, determining the target smoothing parameter based on the second rotation angle includes: converting the second rotation angle into a third rotation angle within a second value range, where the second value range is smaller than the first value range ; Determine the first smoothing parameter and the second smoothing parameter of the smoothing function based on the third rotation angle; perform smoothing processing on the first target texture based on the target smoothing parameter to obtain a dissolution result, including: combining the first smoothing parameter, the second smoothing parameter and the The first target texture is input into the smoothing function for smoothing to obtain a dissolving result, wherein the dissolving result is between the first smoothing parameter and the second smoothing parameter.
可选地,确定与观察角度对应的目标位置,包括:在模型空间中确定与观察角度对应的目标位置。Optionally, determining the target position corresponding to the observation angle includes: determining the target position corresponding to the observation angle in the model space.
为了实现上述目的,根据本发明的另一方面,还提供了一种虚拟对象渲染装置,通过终端设备提供图形用户界面,图形用户界面至少部分地显示一游戏场景,游戏场景至少部分地包括一虚拟对象,该装置可以包括:第一确定单元,用于确定游戏场景的观察角度;溶解单元,用于基于观察角度对第一目标贴图进行溶解处理,得到溶解结果,其中,第一目标贴图用于表征虚拟对象的纹理图像;第二确定单元,用于基于溶解结果确定虚拟对象的目标透明值;渲染单元,用于根据目标透明值,以渲染显示虚拟对象。In order to achieve the above object, according to another aspect of the present invention, a virtual object rendering apparatus is also provided, which provides a graphical user interface through a terminal device, the graphical user interface at least partially displays a game scene, and the game scene at least partially includes a virtual object object, the device may include: a first determining unit for determining an observation angle of the game scene; a dissolving unit for dissolving the first target map based on the observation angle to obtain a dissolution result, wherein the first target map is used for a texture image representing the virtual object; a second determining unit for determining a target transparency value of the virtual object based on the dissolution result; and a rendering unit for rendering and displaying the virtual object according to the target transparency value.
为了实现上述目的,根据本发明的另一方面,还提供了一种计算机可读存储介质。该计算机可读存储介质中存储有计算机程序,其中,在计算机程序被处理器运行时控制计算机可读存储介质所在设备执行本发明实施例的虚拟对象渲染方法。In order to achieve the above object, according to another aspect of the present invention, a computer-readable storage medium is also provided. A computer program is stored in the computer-readable storage medium, wherein when the computer program is run by the processor, the device where the computer-readable storage medium is located is controlled to execute the virtual object rendering method of the embodiment of the present invention.
为了实现上述目的,根据本发明的另一方面,还提供了一种电子装置。该电子装置可以包括存储器和处理器,其特征在于,存储器中存储有计算机程序,处理器被设置为被处理器运行计算机程序以执行本发明实施例的虚拟对象渲染方法。In order to achieve the above object, according to another aspect of the present invention, an electronic device is also provided. The electronic device may include a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to be executed by the processor to execute the virtual object rendering method of the embodiment of the present invention.
在本发明至少部分实施例中,确定游戏场景的观察角度;基于观察角度对第一目标贴图进行溶解处理,得到溶解结果,其中,第一目标贴图用于表征虚拟对象的纹理图像;基于溶解结果确定虚拟对象的目标透明值;根据目标透明值,以渲染显示虚拟对象。也就是说,本申请通过对目标贴图进行溶解处理,得到溶解结果,基于溶解结果确定虚拟月亮对象的目标透明通道,从而实现随视线变化而出现月圆月缺的目的,提高了对月亮对象的月食效果进行展现的灵活性,进而解决了对虚拟月亮对象的月食效果进行展现的灵活性低的技术问题,达到了提高对月亮对象的月食效果进行展现的灵活性的技术效果。In at least some embodiments of the present invention, an observation angle of the game scene is determined; based on the observation angle, a first target map is dissolved to obtain a dissolution result, wherein the first target map is used to represent a texture image of a virtual object; based on the dissolution result Determines the target transparency value of the virtual object; according to the target transparency value, the virtual object is displayed in rendering. That is to say, the present application obtains the dissolution result by dissolving the target map, and determines the target transparent channel of the virtual moon object based on the dissolution result, so as to achieve the purpose of appearing the full moon and the moon as the line of sight changes, and improve the understanding of the moon object. The flexibility of displaying the lunar eclipse effect solves the technical problem of low flexibility in displaying the lunar eclipse effect of the virtual moon object, and achieves the technical effect of improving the flexibility of displaying the lunar eclipse effect of the moon object.
附图说明Description of drawings
此处所说明的附图用来提供对本发明的进一步理解,构成本申请的一部分,本发明的示意性实施例及其说明用于解释本发明,并不构成对本发明的不当限定。在附图中:The accompanying drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the attached image:
图1是根据本发明其中一实施例的一种虚拟对象渲染方法的移动终端的硬件结构框图;1 is a block diagram of a hardware structure of a mobile terminal according to a virtual object rendering method according to an embodiment of the present invention;
图2是根据本发明其中一实施例的一种虚拟对象渲染方法的流程图;2 is a flowchart of a method for rendering a virtual object according to an embodiment of the present invention;
图3是根据本发明相关技术中的一种月食效果的示意图;3 is a schematic diagram of a lunar eclipse effect according to the related art of the present invention;
图4是根据本发明其中一实施例的一种月食效果的示意图;4 is a schematic diagram of a lunar eclipse effect according to an embodiment of the present invention;
图5是根据本发明实施例中的一种模型空间内球面上某点的坐标的示意图;5 is a schematic diagram of the coordinates of a point on a spherical surface in a model space according to an embodiment of the present invention;
图6是根据本发明实施例中的一种世界空间内球面上某点的坐标的示意图;6 is a schematic diagram of the coordinates of a point on a spherical surface in a world space according to an embodiment of the present invention;
图7是根据本发明中的一种计算角度的转换结果的示意图;Fig. 7 is the schematic diagram of the conversion result of a kind of calculation angle according to the present invention;
图8是根据本发明中的一种值域范围的转换结果的示意图;8 is a schematic diagram of a conversion result of a value range according to the present invention;
图9是根据本发明中的另一种值域范围的转换结果的示意图;9 is a schematic diagram of a conversion result of another value range according to the present invention;
图10是根据本发明中的一种溶解贴图的示意图;10 is a schematic diagram of a dissolving map according to the present invention;
图11是根据本发明其中一实施例的一种虚拟对象渲染装置的结构框图。FIG. 11 is a structural block diagram of a virtual object rendering apparatus according to an embodiment of the present invention.
具体实施方式Detailed ways
为了使本技术领域的人员更好地理解本发明方案,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分的实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本发明保护的范围。In order to make those skilled in the art better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only Embodiments are part of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
需要说明的是,本发明的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本发明的实施例能够以除了在这里图示或描述的那些以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。It should be noted that the terms "first", "second" and the like in the description and claims of the present invention and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific sequence or sequence. It is to be understood that the data so used may be interchanged under appropriate circumstances such that the embodiments of the invention described herein can be practiced in sequences other than those illustrated or described herein. Furthermore, the terms "comprising" and "having" and any variations 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 necessarily limited to those expressly listed Rather, those steps or units may include other steps or units not expressly listed or inherent to these processes, methods, products or devices.
首先,在对本申请实施例进行描述的过程中出现的部分名词或术语使用于如下解释:First of all, some nouns or terms that appear in the process of describing the embodiments of the present application are used for the following explanations:
光照贴图(Lightmap),描述记录了场景光照数据的纹理,常用于增加场景的光照氛围和美术效果;Lightmap (Lightmap), which describes the texture that records the lighting data of the scene, and is often used to increase the lighting atmosphere and artistic effect of the scene;
法线,生成lightmap的方法一般叫做烘焙,一般游戏引擎unity/ue4是自带这项功能的;Normal, the method of generating lightmap is generally called baking, and the general game engine unity/ue4 comes with this function;
模型空间(model space),模型空间在不同的游戏引擎或者是软件中又称作对象空间(object space)或者局部空间(local space),比如,如图5所示,图5是根据本发明实施例中的一种模型空间内球面上某点的坐标的示意图;Model space (model space), model space is also called object space (object space) or local space (local space) in different game engines or software, for example, as shown in Figure 5, Figure 5 is implemented according to the present invention In the example, a schematic diagram of the coordinates of a point on a spherical surface in model space;
世界空间(world space),世界空间是一个宏观的特殊坐标系,其代表了我们关心的最大坐标系,比如,如图6所示,图6是根据本发明实施例中的一种世界空间内球面上某点的坐标的示意图;World space (world space), the world space is a macroscopic special coordinate system, which represents the largest coordinate system we care about. For example, as shown in FIG. 6, FIG. A schematic diagram of the coordinates of a point on a sphere;
归一化,把向量的长度变为1;Normalize, change the length of the vector to 1;
UV流动,UV流动或UV平移是指沿着水平(U)方向,或垂直(V)方向移动纹理的UV坐标,以产生复杂的动画错觉;UV流动可以创建诸如火焰、流水或烟雾之类的效果;UV flow, UV flow or UV translation refers to moving the UV coordinates of a texture along the horizontal (U) direction, or the vertical (V) direction to create complex animation illusions; UV flow can create objects such as fire, water or smoke Effect;
根据本发明其中一实施例,提供了一种虚拟对象渲染方法的实施例,需要说明的是,在附图的流程图示出的步骤可以在诸如一组计算机可执行指令的计算机系统中执行,并且,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。According to one of the embodiments of the present invention, an embodiment of a virtual object rendering method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings may be executed in a computer system such as a set of computer-executable instructions, Also, although a logical order is shown in the flowcharts, in some cases the steps shown or described may be performed in an order different from that herein.
该方法实施例可以在移动终端、计算机终端或者类似的运算装置中执行。以运行在移动终端上为例,该移动终端可以是智能手机(如Android手机、iOS手机等)、平板电脑、掌上电脑以及移动互联网设备(MobileInternetDevices,简称为MID)、PAD、游戏机等终端设备。图1是根据本发明其中一实施例的一种虚拟对象渲染方法的移动终端的硬件结构框图。如图1所示,移动终端可以包括一个或多个(图1中仅示出一个)处理器102(处理器102可以包括但不限于中央处理器(CPU)、图形处理器(GPU)、数字信号处理(DSP)芯片、微处理器(MCU)、可编程逻辑器件(FPGA)、神经网络处理器(NPU)、张量处理器(TPU)、人工智能(AI)类型处理器等的处理装置)和用于存储数据的存储器104。可选地,上述移动终端还可以包括用于通信功能的传输设备106、输入输出设备108以及显示设备110。本领域普通技术人员可以理解,图1所示的结构仅为示意,其并不对上述移动终端的结构造成限定。例如,移动终端还可包括比图1中所示更多或者更少的组件,或者具有与图1所示不同的配置。The method embodiments may be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, the mobile terminal can be a smart phone (such as an Android mobile phone, an iOS mobile phone, etc.), a tablet computer, a PDA, and a terminal device such as Mobile Internet Devices (Mobile Internet Devices, referred to as MID), PAD, game consoles, etc. . FIG. 1 is a block diagram of a hardware structure of a mobile terminal according to a method for rendering a virtual object according to an embodiment of the present invention. As shown in FIG. 1 , the mobile terminal may include one or more (only one is shown in FIG. 1 ) processors 102 (the processors 102 may include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), a digital Processing devices for signal processing (DSP) chips, microprocessors (MCU), programmable logic devices (FPGA), neural network processors (NPU), tensor processors (TPU), artificial intelligence (AI) type processors, etc. ) and a
存储器104可用于存储计算机程序,例如,应用软件的软件程序以及模块,如本发明实施例中的虚拟对象渲染方法对应的计算机程序,处理器102通过运行存储在存储器104内的计算机程序,从而执行各种功能应用以及数据处理,即实现上述的对象处理方法。存储器104可包括高速随机存储器,还可包括非易失性存储器,如一个或者多个磁性存储装置、闪存、或者其他非易失性固态存储器。在一些实例中,存储器104可进一步包括相对于处理器102远程设置的存储器,这些远程存储器可以通过网络连接至移动终端。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。The
传输设备106用于经由一个网络接收或者发送数据。上述的网络具体实例可包括移动终端的通信供应商提供的无线网络。在一个实例中,传输设备106包括一个网络适配器(Network Interface Controller,简称为NIC),其可通过基站与其他网络设备相连从而可与互联网进行通讯。在一个实例中,传输设备106可以为射频(Radio Frequency,简称为RF)模块,其用于通过无线方式与互联网进行通讯。
输入输出设备108中的输入可以来自多个人体学接口设备(Human InterfaceDevice,简称为HID)。例如:键盘和鼠标、游戏手柄、其他专用游戏控制器(如:方向盘、鱼竿、跳舞毯、遥控器等)。部分人体学接口设备除了提供输入功能之外,还可以提供输出功能,例如:游戏手柄的力反馈与震动、控制器的音频输出等。The input in the input-output device 108 may come from a plurality of human interface devices (Human Interface Device, HID for short). For example: keyboard and mouse, gamepad, other specialized game controllers (eg: steering wheel, fishing rod, dance mat, remote control, etc.). In addition to providing input functions, some human interface devices can also provide output functions, such as force feedback and vibration of gamepads, and audio output of controllers.
显示设备110可以例如平视显示器(HUD)、触摸屏式的液晶显示器(LCD)和触摸显示器(也被称为“触摸屏”或“触摸显示屏”)。该液晶显示器可使得用户能够与移动终端的用户界面进行交互。在一些实施例中,上述移动终端具有图形用户界面(GUI),用户可以通过触摸触敏表面上的手指接触和/或手势来与GUI进行人机交互,此处的人机交互功能可选的包括如下交互:创建网页、绘图、文字处理、制作电子文档、游戏、视频会议、即时通信、收发电子邮件、通话界面、播放数字视频、播放数字音乐和/或网络浏览等、用于执行上述人机交互功能的可执行指令被配置/存储在一个或多个处理器可执行的计算机程序产品或可读存储介质中。
在本公开其中一种实施例中的虚拟对象渲染方法可以运行于本地终端设备或者是服务器。当虚拟对象渲染方法运行于服务器时,该方法则可以基于云交互系统来实现与执行,其中,云交互系统包括服务器和客户端设备。The virtual object rendering method in one of the embodiments of the present disclosure may run on a local terminal device or a server. When the virtual object rendering method runs on the 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 virtual object rendering method are completed on the cloud game server, and the function of the client device is used for data reception, Sending and presentation of game screen, for example, the client device can be a display device with data transmission function close to the user side, such as a mobile terminal, a TV, a computer, a handheld computer, etc.; but the information processing is performed by the cloud. Cloud gaming server. 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, taking a game as an example, the 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, conventionally, the game program is downloaded, installed and executed through an electronic 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 this embodiment, a virtual object rendering method running on the above mobile terminal is provided, and a graphical user interface is provided through a terminal device, wherein the terminal device may be the aforementioned local terminal device, or the aforementioned In the client device in the cloud interactive system, the graphical user interface at least partially displays a game scene, and the game scene at least partially includes a virtual object, wherein the virtual object may be the moon, the sun, or other models.
图2是根据本发明其中一实施例的一种虚拟对象渲染方法的流程图,通过终端设备提供一图形用户界面,如图2所示,该方法包括如下步骤:Fig. 2 is a flowchart of a method for rendering a virtual object according to an embodiment of the present invention. A graphical user interface is provided by a terminal device. As shown in Fig. 2, the method includes the following steps:
步骤S202,确定游戏场景的观察角度。Step S202, determining the viewing angle of the game scene.
在本发明上述步骤S202提供的技术方案中,游戏场景可以为游戏场景中由预设摄像机拍摄所得到的画面,游戏场景可以包括虚拟对象。观察角度可以为相对于游戏场景的观察角度,也可以为随着虚拟游戏角色的移动而变换的信息。In the technical solution provided by the above step S202 of the present invention, the game scene may be a picture captured by a preset camera in the game scene, and the game scene may include virtual objects. The observation angle may be the observation angle relative to the game scene, or may be information that changes with the movement of the virtual game character.
在该实施例中,通过将虚拟相机与朝向进行绑定,实现控制虚拟角色观察角度的目的,通过控制朝向,引起虚拟相机的转动,从而得到变化的游戏场景;而如果虚拟相机并不与朝向绑定,此时,只能对虚拟相机进行直接的限定,才能引起游戏场景观察角度的变化。In this embodiment, by binding the virtual camera with the orientation, the purpose of controlling the viewing angle of the virtual character is achieved, and by controlling the orientation, the rotation of the virtual camera is caused to obtain a changed game scene; and if the virtual camera is not aligned with the orientation Binding, at this time, only the virtual camera can be directly limited to change the viewing angle of the game scene.
可选地,可以通过移动虚拟相机的位置,以改变虚拟对象在游戏场景中的观察角度,比如,在移动端,通过向上下左右某一方向滑动屏幕,实现改变虚拟对象在游戏场景中的观察角度的目的,或者在电脑端,通过鼠标上下左右都有方向长按滑动游戏场景画面实现观察角度的改变。Optionally, the position of the virtual camera can be moved to change the viewing angle of the virtual object in the game scene. For example, on the mobile terminal, by sliding the screen in a certain direction up, down, left, and right, the observation of the virtual object in the game scene can be changed. The purpose of the angle, or on the computer side, the observation angle can be changed by long-pressing the mouse in the up, down, left, and right directions to slide the game scene screen.
可选地,游戏场景中由预设摄像机拍摄,得到场景画面,通过获取游戏场景中的信息,确定该场景画面中虚拟游戏角色的观察角度。Optionally, the game scene is shot by a preset camera to obtain a scene picture, and by acquiring information in the game scene, the observation angle of the virtual game character in the scene picture is determined.
步骤S204,基于观察角度对第一目标贴图进行溶解处理,得到溶解结果,其中,第一目标贴图用于表征虚拟对象的纹理图像。Step S204 , dissolving the first target map based on the observation angle to obtain a dissolution result, wherein the first target map is used to represent the texture image of the virtual object.
在本发明上述步骤S204提供的技术方案中,基于确定的游戏场景的观察角度对第一目标贴图进行溶解处理,得到溶解结果,其中,第一目标贴图可以为溶解贴图,可以用于生成虚拟对象溶解图片,可以用dissolve_tex表示。溶解处理可以为基于游戏视野信息对目标贴图进行平滑阶梯函数(smoothstep)溶解,从而得到溶解结果。溶解结果用于实现场景画面上的图形的消失,可以用step_dissolve表示。In the technical solution provided in the above step S204 of the present invention, the first target texture is dissolved based on the determined viewing angle of the game scene, and a dissolution result is obtained, wherein the first target texture can be a dissolution texture, which can be used to generate a virtual object Dissolve the image, which can be represented by dissolve_tex. The dissolving process may be to perform smooth step function (smoothstep) dissolving on the target texture based on the game field of view information, so as to obtain a dissolving result. The dissolution result is used to realize the disappearance of the graphics on the scene screen, which can be represented by step_dissolve.
步骤S206,基于溶解结果确定虚拟对象的目标透明值。Step S206, determining the target transparency value of the virtual object based on the dissolution result.
在本发明上述步骤S206提供的技术方案中,目标透明值可以为溶解值,可以作为目标透明通道,可以为Alpha通道,用于表示图像中像素点的透明信息,可以通过改变虚拟对象的透明通道从而达到使虚拟对象消失的效果,目标透明通道可以为带云层的月亮的透明通道。In the technical solution provided by the above step S206 of the present invention, the target transparency value can be a dissolution value, can be used as a target transparency channel, and can be an Alpha channel, which is used to represent the transparency information of pixels in the image, and can be used by changing the transparency channel of the virtual object. In order to achieve the effect of disappearing the virtual object, the target transparent channel can be the transparent channel of the moon with clouds.
可选地,通过对基于观察角度对第一目标贴图进行溶解处理,得到的溶解结果,对溶解结果进行处理,得到虚拟对象的目标透明值,将确定的目标透明值作为虚拟对象的透明通道。Optionally, by dissolving the first target map based on the observation angle to obtain a dissolving result, the dissolving result is processed to obtain a target transparency value of the virtual object, and the determined target transparency value is used as a transparency channel of the virtual object.
步骤S208,根据目标透明值,以渲染显示虚拟对象。Step S208, rendering and displaying the virtual object according to the target transparency value.
在本发明上述步骤S208提供的技术方案中,将计算得到的目标透明值作为虚拟对象的透明通道,对带透明通道的虚拟对象进行渲染显示,从而得到跟随观察角度变化的虚拟对象。In the technical solution provided in the above step S208 of the present invention, the calculated target transparency value is used as the transparent channel of the virtual object, and the virtual object with the transparent channel is rendered and displayed, thereby obtaining the virtual object that changes with the observation angle.
在该实施例中,可以将得到的溶解结果作为虚拟对象的透明值,将透明值作为虚拟对象的透明通道,渲染显示虚拟对象。In this embodiment, the obtained dissolving result can be used as the transparent value of the virtual object, and the transparent value can be used as the transparent channel of the virtual object, and the virtual object can be rendered and displayed.
通过本申请上述步骤S202至步骤S208,获取场景画面的游戏视野信息;基于游戏视野信息对目标贴图进行溶解处理,得到溶解结果,其中,目标贴图用于生成虚拟月亮对象的月食图像;基于溶解结果确定虚拟月亮对象的目标透明通道,以将虚拟月亮对象的图像由第一月食图像转换为第二月食图像。也就是说,本申请通过对目标贴图进行溶解处理,得到溶解结果,基于溶解结果确定虚拟月亮对象的目标透明通道,从而实现随视线变化而出现月圆月缺的目的,提高了对月亮对象的月食效果进行展现的灵活性,进而解决了对虚拟月亮对象的月食效果进行展现的灵活性低的技术问题,达到了提高对月亮对象的月食效果进行展现的灵活性的技术效果。Through the above-mentioned steps S202 to S208 of the present application, the game field of view information of the scene picture is obtained; based on the game field of view information, the target texture is dissolved to obtain a dissolution result, wherein the target texture is used to generate a lunar eclipse image of the virtual moon object; The result determines the target transparency channel of the virtual moon object to convert the image of the virtual moon object from the first lunar eclipse image to the second lunar eclipse image. That is to say, the present application obtains the dissolution result by dissolving the target map, and determines the target transparent channel of the virtual moon object based on the dissolution result, so as to achieve the purpose of appearing the full moon and the moon as the line of sight changes, and improve the understanding of the moon object. The flexibility of displaying the lunar eclipse effect solves the technical problem of low flexibility in displaying the lunar eclipse effect of the virtual moon object, and achieves the technical effect of improving the flexibility of displaying the lunar eclipse effect of the moon object.
下面对该实施例上述方法进行进一步介绍。The above method of this embodiment will be further described below.
作为一种可选的实施方式,步骤S202,获取游戏场景的观察角度,包括:实时获取游戏角色在游戏场景的观察视野,其中,游戏场景包括通过终端设备控制的游戏角色;根据观察视野,确定虚拟对象的观察角度。As an optional implementation manner, in step S202, obtaining the observation angle of the game scene includes: obtaining the observation field of view of the game character in the game scene in real time, wherein the game scene includes the game character controlled by the terminal device; according to the observation field of view, determining The viewing angle of the virtual object.
在该实施例中,随着游戏角色(虚拟游戏角色)(虚拟游戏角色)的移动,实时获取游戏角色在游戏场景的观察视野,根据获取的观察视野,确定虚拟对象的观察角度,其中,可以通过终端设备控制游戏角色的视野的观察角度。In this embodiment, along with the movement of the game character (virtual game character) (virtual game character), the observation field of view of the game character in the game scene is acquired in real time, and the observation angle of the virtual object is determined according to the acquired observation field, wherein the The viewing angle of the visual field of the game character is controlled by the terminal device.
可选地,对视野的调整可以通过对游戏中的自由视角的调整,从而引起游戏场景的观察角度的变化;或者当视野与游戏角色的朝向绑定时,可以通过调整游戏角色的视野,从而调整游戏场景的观察角度。Optionally, the field of view can be adjusted by adjusting the free angle of view in the game, thereby causing a change in the viewing angle of the game scene; or when the field of view is bound to the orientation of the game character, the field of view of the game character can be adjusted, thereby Adjust the viewing angle of the game scene.
作为一种可选的实施方式,获取第二目标贴图,其中,第二目标贴图用于表征游戏场景中虚拟云层的纹理图像,且随着时间的变化而变化;基于第二目标贴图确定虚拟对象的目标颜色;根据目标透明值,以渲染显示虚拟对象,包括:根据目标透明值和目标颜色,以渲染虚拟对象。As an optional implementation manner, a second target map is obtained, wherein the second target map is used to represent the texture image of the virtual cloud layer in the game scene, and changes with time; the virtual object is determined based on the second target map The target color; according to the target transparency value, to render and display the virtual object, including: according to the target transparency value and the target color, to render the virtual object.
可选地,第二目标贴图可以为云层的纹理贴图,用于调整虚拟对象的目标颜色,第二目标贴图可以云层的纹理贴图是随着时间变化而变化的,通过将第二目标贴图渲染显示得到的目标颜色和目标透明值进行叠加,对叠加结果进行渲染显示,得到随着时间变化的虚拟对象图片。Optionally, the second target map can be a texture map of the cloud layer, used to adjust the target color of the virtual object, and the second target map can be the texture map of the cloud layer that changes with time, and is displayed by rendering the second target map. The obtained target color and the target transparency value are superimposed, and the superimposed result is rendered and displayed to obtain a virtual object picture that changes with time.
可选地,将云层的纹理贴图与月亮贴图进行叠加得到月食变化,其中,两个贴图是通过与虚拟目标上的UV坐标对应,然后实现对虚拟对象的渲染显示,需要说明的是,云层的纹理贴图调整的是颜色,而月亮贴图调整的是透明度,两者相互不干扰。Optionally, the texture map of the cloud layer and the moon map are superimposed to obtain the change of the lunar eclipse, wherein the two maps are corresponding to the UV coordinates on the virtual target, and then the rendering display of the virtual object is realized. It should be noted that the cloud layer The texture map adjusts the color, while the moon map adjusts the transparency, and the two do not interfere with each other.
作为一种可选的实施方式,根据目标透明值和目标颜色,以渲染虚拟对象,包括:根据虚拟对象上目标纹理坐标对应的目标透明值和目标颜色,以渲染虚拟对象。As an optional implementation manner, rendering the virtual object according to the target transparency value and the target color includes: rendering the virtual object according to the target transparency value and the target color corresponding to the target texture coordinates on the virtual object.
在该实施例中,目标纹理信息用于表示在目标时间内按照目标速度进行变化的云层图像的纹理坐标;基于溶解结果确定虚拟月亮对象的目标透明通道,包括:基于目标纹理信息、溶解结果将虚拟月亮对象的原始透明通道转换为目标透明通道。In this embodiment, the target texture information is used to represent the texture coordinates of the cloud layer image that changes according to the target speed within the target time; determining the target transparent channel of the virtual moon object based on the dissolution result includes: based on the target texture information, the dissolution result The original alpha channel of the virtual moon object is converted to the target alpha channel.
可选地,目标纹理信息用于表示在目标时间内按照目标速度进行变化的云层图像的纹理坐标,可以用Tex2,input.uv表示,纹理坐标可以为UV坐标,用于定位图像上任意一个像素,通过纹理坐标可以将多边形的顶点和图像文件上的像素对应起来,从而实现在多边形表面定位纹理贴图,其中,贴图的U和V坐标的数值范围可以都是0到1。Optionally, the target texture information is used to represent the texture coordinates of the cloud layer image that changes according to the target speed within the target time, which can be represented by Tex2, input.uv, and the texture coordinates can be UV coordinates, which are used to locate any pixel on the image. , through the texture coordinates, the vertices of the polygon and the pixels on the image file can be corresponded, so that the texture map can be positioned on the surface of the polygon, where the U and V coordinates of the texture can both range from 0 to 1.
可选地,通过给虚拟月亮对象的纹理坐标加上目标时间内的每帧画面的生成时间(FrameTime)和云层移动的目标速度(CloudMoveSpeed)的乘积得到目标纹理信息,其中,目标纹理信息可以用tex2Color表示,可以通过下述公式进行表示:Optionally, the target texture information is obtained by adding the product of the generation time (FrameTime) of each frame of the picture within the target time to the texture coordinates of the virtual moon object and the target speed (CloudMoveSpeed) of the cloud layer movement, wherein the target texture information can be used tex2Color representation, which can be represented by the following formula:
HALF4HALF4
tex2color=SAMPLE_TEXTURE_LEVEL(Tex2,input.uv+float2(FrameTime*CloudMoveSpeed,0),-1)tex2color=SAMPLE_TEXTURE_LEVEL(Tex2,input.uv+float2(FrameTime*CloudMoveSpeed,0),-1)
其中,SAMPLE_TEXTURE_LEVEL表示纹理采样,用于使云层UV流动。Among them, SAMPLE_TEXTURE_LEVEL represents the texture sampling, which is used to make the cloud layer UV flow.
在该实施例中,基于目标纹理信息、溶解结果将虚拟月亮对象的原始透明通道转换为目标透明值,根据虚拟对象上目标纹理坐标对应的目标透明值和目标颜色,以渲染虚拟对象,其中,原始透明通道可以用AlphaMt1表示。In this embodiment, the original transparency channel of the virtual moon object is converted into a target transparency value based on the target texture information and the dissolution result, and the virtual object is rendered according to the target transparency value and target color corresponding to the target texture coordinates on the virtual object, wherein, The original transparency channel can be represented by AlphaMt1.
作为一种可选的实施方式,基于观察角度对第一目标贴图进行溶解处理,得到溶解结果,包括:基于观察角度确定目标平滑参数;基于目标平滑参数对第一目标贴图进行平滑处理,得到溶解结果。As an optional implementation manner, dissolving the first target texture based on the observation angle to obtain a dissolution result includes: determining a target smoothing parameter based on the viewing angle; smoothing the first target texture based on the target smoothing parameter to obtain a dissolution result result.
在该实施例中,基于目标纹理信息、溶解结果将虚拟月亮对象的原始透明通道转换为目标透明通道,包括:将目标纹理信息对应的云层图像添加至原始透明通道;基于溶解结果对带有云层图像的原始透明通道进行溶解处理,得到目标透明通道。In this embodiment, converting the original transparent channel of the virtual moon object into the target transparent channel based on the target texture information and the dissolution result includes: adding a cloud layer image corresponding to the target texture information to the original transparent channel; The original transparent channel of the image is dissolved to obtain the target transparent channel.
可选地,将目标纹理信息对应的云层图像添加至原始透明通道,比如,给月亮的原始透明通道加上云层uv流动的效果,对带有目标纹理信息的原始透明通道进行溶解处理,得到目标透明通道,其中,目标透明通道可以用finalcolor表示,可以通过下述公式进行表示:Optionally, add the cloud layer image corresponding to the target texture information to the original transparent channel, for example, add the effect of cloud layer uv flow to the original transparent channel of the moon, and dissolve the original transparent channel with the target texture information to obtain the target. Transparent channel, where the target transparent channel can be represented by finalcolor, which can be represented by the following formula:
HALF4HALF4
finalColor=HALF4((text0Color.rgb*lerp(float3(1.0),text2Color.rgb,CloudIntensity)+text3Color.rgb*text3Color.a*EmissiveIntensity),text0Color.a*step_dissolve*AlphaMt1)*ColorFactorfinalColor=HALF4((text0Color.rgb*lerp(float3(1.0),text2Color.rgb,CloudIntensity)+text3Color.rgb*text3Color.a*EmissiveIntensity),text0Color.a*step_dissolve*AlphaMt1)*ColorFactor
其中,text0Color.rgb表示:基础色的红绿蓝通道,lerp(float3(1.0)用于决定云彩强度的效果,CloudIntensity表示云层强度参数,text3Color.rgb表示云彩图的红绿蓝通道,text3Color.a表示云彩图的阿尔法通道,EmissiveIntensity表示目标对象发光强度参数,ColorFactor用于控制颜色灰度。Among them, text0Color.rgb represents: the red, green and blue channels of the base color, lerp(float3(1.0) is used to determine the effect of cloud intensity, CloudIntensity represents the cloud layer intensity parameter, text3Color.rgb represents the red, green and blue channels of the cloud map, text3Color.a Represents the alpha channel of the cloud map, EmissiveIntensity represents the luminous intensity parameter of the target object, and ColorFactor is used to control the color grayscale.
在该实施例中,平滑参数用于使图像变化更顺滑,可以为平滑参数最小值,s_min和平滑参数最大值,s_max,平滑处理可以为对目标贴片进行平滑阶梯溶解。可选地,将目标平滑参数作为平滑阶梯函数的前两个参数,目标贴片输入为最后一个参数,从而得到溶解结果,可以为:In this embodiment, the smoothing parameter is used to make the image change smoother, and can be the minimum value of the smoothing parameter, s_min, and the maximum value of the smoothing parameter, s_max, and the smoothing process can be smooth step-dissolving on the target patch. Optionally, the target smoothing parameter is used as the first two parameters of the smooth step function, and the target patch input is the last parameter, so as to obtain the dissolution result, which can be:
Float step_dissolve=smoothstep(s_min,s_max,dissolve_tex)Float step_dissolve=smoothstep(s_min,s_max,dissolve_tex)
作为一种可选的实施方式,基于观察角度确定目标平滑参数,包括:确定与观察角度对应的目标位置,其中,预设摄像机用于在目标位置上对游戏场景进行拍摄,以得到游戏场景中观察角度的场景画面;确定目标位置相对于虚拟月亮对象的位置的第一旋转角度;基于第一旋转角度确定目标平滑参数。As an optional implementation manner, determining the target smoothing parameter based on the observation angle includes: determining a target position corresponding to the observation angle, wherein a preset camera is used to shoot the game scene at the target position, so as to obtain the target position in the game scene. The scene picture of the observation angle; the first rotation angle of the target position relative to the position of the virtual moon object is determined; the target smoothing parameter is determined based on the first rotation angle.
在该实施例中,预设摄像机用于在目标位置上对游戏场景进行拍摄,以得到场景画面,从而确定与游戏视野信息对应的目标位置。其中,目标位置可以为将摄像机拍摄的场景转换到模型空间的位置,可以用locao_camera_position来表示,可以通过下述公式进行表示:In this embodiment, the preset camera is used to shoot the game scene at the target position to obtain the scene picture, so as to determine the target position corresponding to the game field of view information. Among them, the target position can be the position where the scene captured by the camera is converted to the model space, which can be represented by locao_camera_position, which can be represented by the following formula:
float4 local_camera_position=mul(FLOAT4(CameraPosition.xyz,1.0),World);float4 local_camera_position = mul(FLOAT4(CameraPosition.xyz, 1.0), World);
frag.local_camera_position=local_camera_position.xyzfrag.local_camera_position=local_camera_position.xyz
可选地,确定目标位置相对于虚拟月亮对象的位置的第一旋转角度,其中,虚拟月亮对象的位置可以为相机中各个顶点的位置,可以用cam_object表示,第一旋转角度可以为目标位置到虚拟月亮对象的中心点的角度,可以用distance表示,可以用atan2函数计算角度。Optionally, determine the first rotation angle of the target position relative to the position of the virtual moon object, wherein the position of the virtual moon object can be the position of each vertex in the camera, which can be represented by cam_object, and the first rotation angle can be the target position to The angle of the center point of the virtual moon object can be represented by distance, and the angle can be calculated by the atan2 function.
可选地,将计算出来的角度先加PI除以2,之后再将计算出来的角度先加PI除以2的结果除以PI,从而实现将第一旋转角度转换到0-1范围内,可以通过下述公式进行表示:Optionally, first add PI to the calculated angle and divide it by 2, and then divide the calculated angle by adding PI and dividing by 2 and divide the result by PI, so as to convert the first rotation angle into the range of 0-1, It can be expressed by the following formula:
Float3 cam_object=normalize(input.local_camera_position)Float3 cam_object=normalize(input.local_camera_position)
Float distance=(atan2(cam_object.z,abs(cam_object.x))+PI/2.0)/PI;//1-0.5-0Float distance=(atan2(cam_object.z,abs(cam_object.x))+PI/2.0)/PI; //1-0.5-0
其中,normalize为归一化函数,用于将虚拟月亮对象的目标位置处理在0-1之间,abs(cam_object.x)函数用于求取目标位置在x轴上的绝对值,cam_object.z表示为目标位置在z轴上的值。Among them, normalize is a normalization function, which is used to process the target position of the virtual moon object between 0 and 1. The abs(cam_object.x) function is used to obtain the absolute value of the target position on the x-axis, cam_object.z Represented as the value of the target position on the z-axis.
作为一种可选的实施方式,基于第一旋转角度确定所述目标平滑参数,包括:将第一旋转角度转换至第一值域范围内的第二旋转角度,其中,在第二旋转角度为第一值域范围的上限值时,渲染显示后的虚拟对象呈现第一显示状态,在第二旋转角度为第一值域范围的下限值时,渲染显示后的虚拟对象呈现第二显示状态;基于第二旋转角度确定目标平滑参数。As an optional implementation manner, determining the target smoothing parameter based on the first rotation angle includes: converting the first rotation angle to a second rotation angle within a first value range, where the second rotation angle is When the upper limit value of the first value range is the upper limit value of the first value range, the rendered virtual object presents the first display state, and when the second rotation angle is the lower limit value of the first value range range, the rendered and displayed virtual object presents the second display state. State; determines the target smoothing parameter based on the second rotation angle.
在该实施例中,由于需求要求,当虚拟月亮对象转到侧面90度的时候就消失,转到180度的时候再出现,所以通过计算将第一旋转角度转换至第一值域范围内的第二旋转角度,其中,第一值域范围可以为0-1范围内,即,上限值为靠近0的值,下限值为靠近1的值的值域范围,可以包括,将第一旋转角度中小于0的变为0,超过1的变成1,从而得到第二旋转角度,可以通过下述公式进行表示:In this embodiment, due to requirements, the virtual moon object disappears when it is turned to 90 degrees to the side, and reappears when it is turned to 180 degrees, so the first rotation angle is converted to a value within the first value range by calculating The second rotation angle, where the first value range can be in the range of 0-1, that is, the upper limit value is a value close to 0, and the lower limit value is the value range range of a value close to 1, which may include, If the rotation angle is less than 0, it becomes 0, and if it exceeds 1, it becomes 1, so as to obtain the second rotation angle, which can be expressed by the following formula:
Float distance=(atan2(cam_object.z,abs(cam_object.x))+PI/2.0)/PI;//1-0.5-0;Float distance=(atan2(cam_object.z,abs(cam_object.x))+PI/2.0)/PI; //1-0.5-0;
Float distance_fix=saturate(abs((distance-0.5)*2.0));//1-0-1Float distance_fix=saturate(abs((distance-0.5)*2.0)); //1-0-1
其中,distance_fix用于表示第二旋转角度,saturate用于把一个数限制在0-1范围内,小于0的变为0,超过1的变成1。Among them, distance_fix is used to indicate the second rotation angle, and saturate is used to limit a number within the range of 0-1. If it is less than 0, it will become 0, and if it exceeds 1, it will become 1.
可选地,在第二旋转角度为第一值域范围的上限值时,渲染显示后的虚拟对象呈现第一显示状态,比如,虚拟对象为月亮,则第一显示状态可以为满月状态,在第二旋转角度为第一值域范围的下限值时,渲染显示后的虚拟对象呈现第二显示状态,比如,虚拟对象为月亮,则第二显示状态可以为月全食状态,基于第二旋转角度确定目标平滑参数。Optionally, when the second rotation angle is the upper limit value of the first value range, the rendered virtual object presents the first display state, for example, if the virtual object is the moon, the first display state may be the full moon state, When the second rotation angle is the lower limit value of the first value range, the rendered virtual object presents a second display state. For example, if the virtual object is the moon, the second display state may be a total lunar eclipse state. Based on the second display state The rotation angle determines the target smoothing parameter.
作为一种可选的实施方式,基于第二旋转角度确定目标平滑参数,包括:将第二旋转角度转换为第二值域范围内的第三旋转角度,其中,第二值域范围小于第一值域范围;基于第三旋转角度确定平滑函数的第一平滑参数和第二平滑参数;基于目标平滑参数对第一目标贴图进行平滑处理,得到溶解结果,包括:将第一平滑参数、第二平滑参数和第一目标贴图输入至平滑函数中进行平滑处理,得到溶解结果,其中,溶解结果处于第一平滑参数和第二平滑参数之间。As an optional implementation manner, determining the target smoothing parameter based on the second rotation angle includes: converting the second rotation angle into a third rotation angle within a second value range, where the second value range is smaller than the first value range. value range; determining the first smoothing parameter and the second smoothing parameter of the smoothing function based on the third rotation angle; smoothing the first target texture based on the target smoothing parameter to obtain a dissolution result, including: combining the first smoothing parameter, the second smoothing parameter The smoothing parameter and the first target texture are input into the smoothing function for smoothing to obtain a dissolving result, wherein the dissolving result is between the first smoothing parameter and the second smoothing parameter.
在该实施例中,由于在旋转相机角度的过程中,靠近0-1的变化会很慢,因此,需要将第一值域范围稍微缩小一下,从而使角度变化更顺滑,可选地,将第二旋转角度转换为第二值域范围内的第三旋转角度,其中,第二值域范围小于第一值域范围。比如,第一值域范围可以为0-1,那么第二值域范围就可以为0.1-0.9或者是0.05-0.95,此处不做限定。In this embodiment, since in the process of rotating the camera angle, the change close to 0-1 will be very slow, therefore, the range of the first value range needs to be slightly narrowed, so as to make the angle change more smoothly, optionally, The second rotation angle is converted into a third rotation angle within a second value range, wherein the second value range is smaller than the first value range. For example, the range of the first value range may be 0-1, then the range of the second value range may be 0.1-0.9 or 0.05-0.95, which is not limited here.
可选地,使用平滑阶梯函数对第二旋转角度进行调整,得到第三旋转角度,第三旋转角度可以用distance_fix_smooth表示,可以通过下述公式进行表示:Optionally, a smooth step function is used to adjust the second rotation angle to obtain a third rotation angle. The third rotation angle can be represented by distance_fix_smooth, which can be represented by the following formula:
Float distance_fix=saturate(abs((distance-0.5)*2.0));//1-0-1;Float distance_fix=saturate(abs((distance-0.5)*2.0)); //1-0-1;
Float distance_fix_smooth=smoothstep(0.05,0.95,distance_fix);//0.9-1-0.9Float distance_fix_smooth=smoothstep(0.05,0.95,distance_fix); //0.9-1-0.9
其中,smoothstep函数具体为smoothstep(a,b,c),会把c的值域变到a-b之间,用于让整体的值域从0-1变成0.1-0.9或者是0.05-0.95。Among them, the smoothstep function is specifically smoothstep(a,b,c), which will change the value range of c to between a-b, which is used to change the overall value range from 0-1 to 0.1-0.9 or 0.05-0.95.
在该实施例中,将第三旋转角度的结果分别转换为第一平滑参数和第二平滑参数,其中,第一平滑参数可以用s_min表示,第二平滑参数可以用s_max表示,将第一平滑参数、第二平滑参数和第一目标贴图输入平滑函数中进行平滑处理,得到溶解结果,可以通过下述公式进行表示:In this embodiment, the result of the third rotation angle is converted into a first smoothing parameter and a second smoothing parameter, wherein the first smoothing parameter can be represented by s_min, and the second smoothing parameter can be represented by s_max, and the first smoothing parameter can be represented by s_max. The parameters, the second smoothing parameter and the first target texture are input into the smoothing function for smoothing to obtain the dissolution result, which can be expressed by the following formula:
Float s_min=saturate(distance_fix_smooth*(-2.0)+1.0);//saturate(-1~1)Float s_min=saturate(distance_fix_smooth*(-2.0)+1.0); //saturate(-1~1)
Float s_max=1.0-(saturate(distance_fix_smooth-0.5)*2.0Float s_max=1.0-(saturate(distance_fix_smooth-0.5)*2.0
Float step_dissolve=smoothstep(s_min,s_max,dissolve_tex)Float step_dissolve=smoothstep(s_min,s_max,dissolve_tex)
可选地,平滑函数使用可以为smoothstep(a,b,c),会把c的值域变到a-b之间,因而,溶解结果会处于第一平滑参数和第二平滑参数之间。Optionally, the smoothing function can be used as smoothstep(a,b,c), which will change the value range of c to between a-b, so the dissolution result will be between the first smoothing parameter and the second smoothing parameter.
作为一种可选的实施方式,确定与游戏视野信息对应的目标位置,包括:在模型空间中确定与游戏视野信息对应的目标位置。As an optional implementation manner, determining the target position corresponding to the game field of view information includes: determining the target position corresponding to the game field of view information in the model space.
在该实施例中,可以将游戏视野信息对应的位置转换到模型空间,从而得到在模型空间的目标位置。In this embodiment, the position corresponding to the game field of view information can be converted into the model space, so as to obtain the target position in the model space.
需要说明的是,关于模型空间与时间空间,可以为一个相对坐标与世界坐标的换算,通常建立模型空间坐标系是为了便于实时调整控制虚拟模型的角度和方位,只是模型空间坐标系要显示在图形用户界面,须换算成世界坐标系,然后由世界坐标系换算成屏幕(图形用户界面)坐标系,即可完成屏幕映射显示。It should be noted that, regarding the model space and time space, it can be a conversion between relative coordinates and world coordinates. Usually, the model space coordinate system is established to facilitate real-time adjustment and control of the angle and orientation of the virtual model, but the model space coordinate system should be displayed in the The graphical user interface must be converted to the world coordinate system, and then converted from the world coordinate system to the screen (graphical user interface) coordinate system, and the screen mapping display can be completed.
在该实施例中,获取场景画面的游戏视野信息;基于游戏视野信息对目标贴图进行溶解处理,得到溶解结果,其中,目标贴图用于生成虚拟月亮对象的月食图像;基于溶解结果确定虚拟月亮对象的目标透明通道,以将虚拟月亮对象的图像由第一月食图像转换为第二月食图像。也就是说,本申请通过对目标贴图进行溶解处理,得到溶解结果,基于溶解结果确定虚拟月亮对象的目标透明通道,从而实现随视线变化而出现月圆月缺的目的,提高了对月亮对象的月食效果进行展现的灵活性,进而解决了对虚拟月亮对象的月食效果进行展现的灵活性低的技术问题,达到了提高对月亮对象的月食效果进行展现的灵活性的技术效果。In this embodiment, the game field of view information of the scene picture is obtained; the target texture is dissolved based on the game field of view information to obtain a dissolution result, wherein the target texture is used to generate a lunar eclipse image of the virtual moon object; the virtual moon is determined based on the dissolution result The object's target transparency channel to convert the image of the virtual moon object from the first eclipse image to the second eclipse image. That is to say, the present application obtains the dissolution result by dissolving the target map, and determines the target transparent channel of the virtual moon object based on the dissolution result, so as to achieve the purpose of appearing the full moon and the moon as the line of sight changes, and improve the understanding of the moon object. The flexibility of displaying the lunar eclipse effect solves the technical problem of low flexibility in displaying the lunar eclipse effect of the virtual moon object, and achieves the technical effect of improving the flexibility of displaying the lunar eclipse effect of the moon object.
下面结合优选的实施方式对本发明实施例的技术方案进行进一步地举例介绍。The technical solutions of the embodiments of the present invention will be further exemplified below with reference to the preferred embodiments.
在现有技术方案中,对月食效果这一种自然现象是通过UV流动黑色月亮覆盖原有月亮,从而实现月食的一个效果,如图3所示,图3是根据本发明相关技术中的一种月食效果的示意图,现有技术方案无法实现随着视线变化而变化的特征。In the prior art solution, the natural phenomenon of the lunar eclipse effect is to cover the original moon through the UV flowing black moon, so as to realize an effect of lunar eclipse, as shown in FIG. 3, which is according to the related art of the present invention A schematic diagram of a lunar eclipse effect, the existing technical solution cannot achieve the feature that changes with the line of sight.
因而,本方案提出了一种可以跟随视线变化出现月圆月缺的效果方案,实现了跟随实现变换月食效果,如图4所示,图4是根据本发明其中一实施例的一种月食效果的示意图,纯正面的时候是一个正圆,但是随着视角的移动逐渐消散,到纯背面的时候就直接没有了,消散的时候星空粒子不是片状消散,有Z轴上的变化,与月食的效果相似。Therefore, this scheme proposes an effect scheme that can follow the change of sight to appear the full moon and the moon, and realizes the effect of changing the lunar eclipse. As shown in FIG. 4, FIG. The schematic diagram of the eclipse effect, when it is pure front, it is a perfect circle, but it gradually dissipates with the movement of the viewing angle, and it disappears directly when it reaches the pure back. Similar to the effect of a lunar eclipse.
下面对该实施例的上述方法进行进一步介绍。The above method of this embodiment will be further described below.
第一步,在顶点阶段,把相机位置转换到模型空间。可以为:The first step, at the vertex stage, transforms the camera position into model space. Can be:
float4 local_camera_position=mul(FLOAT4(CameraPosition.xyz,1.0),World);float4 local_camera_position = mul(FLOAT4(CameraPosition.xyz, 1.0), World);
frag.local_camera_position=local_camera_position.xyz。frag.local_camera_position=local_camera_position.xyz.
第二步,计算相机到模型中心点的角度,包括:用atan2函数计算角度(这里是弧度为单位,把角度/2pi,转换到0-1范围内,此时的值域是转换为0-0.5-1,如图7所示,图7是根据本发明中的一种计算角度的转换结果的示意图,可以为:The second step is to calculate the angle from the camera to the center point of the model, including: using the atan2 function to calculate the angle (here is the unit of radians, convert the angle/2pi to the range of 0-1, the value range at this time is converted to 0- 0.5-1, as shown in Figure 7, which is a schematic diagram of a conversion result of a calculated angle according to the present invention, which can be:
Float3 cam_object=normalize(input.local_camera_position)Float3 cam_object=normalize(input.local_camera_position)
Float distance=(atan2(cam_object.z,abs(cam_object.x))+PI/2.0)/PI。Float distance=(atan2(cam_object.z,abs(cam_object.x))+PI/2.0)/PI.
第三步,因为需求要求月亮转到侧面90度的时候就消失,转到180再出现,所以通过计算对值域范围进行转换,如图8所示,图8是根据本发明中的一种计算值域范围的转换结果的示意图,可以为:In the third step, because the requirement requires that the moon disappears when it turns to 90 degrees to the side, and reappears when it turns to 180 degrees, so the range of the value range is converted by calculation, as shown in Figure 8, which is according to one of the present invention. A schematic diagram of the conversion result of calculating the range of the value range, which can be:
Float distance=(atan2(cam_object.z,abs(cam_object.x))+PI/2.0)/PI;Float distance=(atan2(cam_object.z,abs(cam_object.x))+PI/2.0)/PI;
Float distance_fix=saturate(abs((distance-0.5)*2.0))。Float distance_fix=saturate(abs((distance-0.5)*2.0)).
其中,物体中心位于十字交叉的中心点,相机位于各个位置的时候,对应的角度数值,线性均匀变化,计算为saturate(abs((distance-0.5)*2)),Abs为取一个数的绝对值,Saturate为把一个数限制在0-1范围内,小于0的变为0,超过1的变成1,这样计算出的结果就实现图8中从左到右的变化,即,将值域从0-0.5-1转换为在1-0-1的范围内了。Among them, the center of the object is located at the center point of the cross, and when the camera is located at each position, the corresponding angle value changes linearly and uniformly, and is calculated as saturate(abs((distance-0.5)*2)), Abs is the absolute value of a number value, Saturate is to limit a number to the range of 0-1, if it is less than 0, it becomes 0, and if it exceeds 1, it becomes 1. In this way, the calculated result realizes the change from left to right in Figure 8, that is, the value of The domain has been converted from 0-0.5-1 to be in the range 1-0-1.
第四步,把0-1的值域调整变小,由于在旋转相机角度的时候,靠近0和1的变化会很慢,所以要通过设置参数实现稍微缩小域值范围,从而使角度变化更加顺滑,这里使用平滑阶梯函数调整,如图9所示,图9是根据本发明中的另一种计算值域范围的转换结果的示意图,可以为:The fourth step is to adjust the value range of 0-1 to be smaller, because when the camera angle is rotated, the change close to 0 and 1 will be very slow, so it is necessary to set the parameters to slightly narrow the range of the range, so that the angle changes more. Smooth, use smooth step function adjustment here, as shown in Figure 9, Figure 9 is a schematic diagram of the conversion result of another calculation value range according to the present invention, which can be:
Float distance_fix=saturate(abs((distance-0.5)*2.0));Float distance_fix=saturate(abs((distance-0.5)*2.0));
Float distance_fix_smooth=smoothstep(0.05,0.95,distance_fix);Float distance_fix_smooth=smoothstep(0.05,0.95,distance_fix);
其中,靠近1的时候月亮是完整的,靠近0的时候就是月全食,这里使用smoothstep函数让整体的值域从1-0-1变成0.9-1-0.9或者是0.05-0.95,这样就会变成图9右图中的样子。函数具体使用为smoothstep(a,b,c),会把c的值域变到a-b之间。Among them, the moon is complete when it is close to 1, and it is a total lunar eclipse when it is close to 0. Here, the smoothstep function is used to change the overall value range from 1-0-1 to 0.9-1-0.9 or 0.05-0.95, so that the It becomes like the picture on the right in Figure 9. The function is specifically used as smoothstep(a,b,c), which will change the range of c to between a-b.
第五步,对溶解贴图利用平滑阶梯函数进行溶解,图10是根据本发明中的一种溶解贴图的示意图,如图10所示,包括:将第四步中的结果分别转换为s_min和s_max两个值作为smoothstep的前两个参数,贴图输入作为最后一个参数,将溶解值作为月亮的透明通道实现溶解的效果,可以为:The fifth step is to use a smooth step function to dissolve the dissolve map. FIG. 10 is a schematic diagram of a dissolve map according to the present invention, as shown in FIG. 10 , including: converting the results in the fourth step into s_min and s_max respectively. The two values are used as the first two parameters of smoothstep, the texture input is used as the last parameter, and the dissolved value is used as the transparent channel of the moon to achieve the effect of dissolution, which can be:
Float s_min=saturate(distance_fix_smooth*(-2.0)+1.0);//saturate(-1~1)Float s_min=saturate(distance_fix_smooth*(-2.0)+1.0); //saturate(-1~1)
Float s_max=1.0-(saturate(distance_fix_smooth-0.5)*2.0Float s_max=1.0-(saturate(distance_fix_smooth-0.5)*2.0
Float step_dissolve=smoothstep(s_min,s_max,dissolve_tex)Float step_dissolve=smoothstep(s_min,s_max,dissolve_tex)
第六步,给月亮图加上云层uv流动的效果,即,UV+时间*速度,这样就可以实现一个简单的uv流动效果,可以为:The sixth step is to add the effect of cloud uv flow to the moon map, that is, UV + time * speed, so that a simple uv flow effect can be achieved, which can be:
HALF4HALF4
tex2color=SAMPLE_TEXTURE_LEVEL(Tex2,input.uv+float2(FrameTime*CloudMoveSpeed,0),-1)。tex2color=SAMPLE_TEXTURE_LEVEL(Tex2,input.uv+float2(FrameTime*CloudMoveSpeed,0),-1).
第七步,给把带云层的月亮的透明通道,根据第四步的结果进行溶解,从而实现跟随视线变化的月食效果,可以为:The seventh step is to dissolve the transparent channel of the moon with clouds according to the results of the fourth step, so as to realize the lunar eclipse effect that follows the change of sight, which can be:
HALF4HALF4
finalColor=HALF4((text0Color.rgb*lerp(float3(1.0),text2Color.rgb,CloudIntensity)+text3Color.rgb*text3Color.a*EmissiveIntensity),text0Color.a*step_dissolve*AlphaMt1)*ColorFactor。finalColor=HALF4((text0Color.rgb*lerp(float3(1.0),text2Color.rgb,CloudIntensity)+text3Color.rgb*text3Color.a*EmissiveIntensity),text0Color.a*step_dissolve*AlphaMt1)*ColorFactor.
在该实施例中,通过把相机位置转换到模型空间内,计算相机相对于模型中心点的旋转角度,把角度值转化到0-1之间,再对溶解贴图按照这个值进行溶解,最后把溶解值作为月亮的透明通道,进而解决了对虚拟月亮对象的月食效果进行展现的灵活性低的技术问题,达到了提高对月亮对象的月食效果进行展现的灵活性的技术效果。In this embodiment, by converting the camera position into the model space, the rotation angle of the camera relative to the model center point is calculated, and the angle value is converted to between 0 and 1, and then the dissolve map is dissolved according to this value, and finally the The dissolved value is used as the transparent channel of the moon, thereby solving the technical problem of low flexibility in displaying the lunar eclipse effect of the virtual moon object, and achieving the technical effect of improving the flexibility of displaying the lunar eclipse effect of the moon object.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到根据上述实施例的方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,或者网络设备等)执行本发明各个实施例所述的方法。From the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is better implementation. Based on this understanding, the technical solutions of the present invention can be embodied in the form of software products in essence or the parts that make contributions to the prior art, and the computer software products are stored in a storage medium (such as ROM/RAM, magnetic disk, CD-ROM), including several instructions to make a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in the various embodiments of the present invention.
本发明实施例还提供了一种虚拟对象渲染装置,该装置用于实现上述实施例及优选实施方式,已经进行过说明的不再赘述。如以下所使用的,术语“单元”可以实现预定功能的软件和/或硬件的组合。尽管以下实施例所描述的装置较佳地以软件来实现,但是硬件,或者软件和硬件的组合的实现也是可能并被构想的。An embodiment of the present invention further provides a virtual object rendering apparatus, which is used to implement the above-mentioned embodiments and preferred implementations, and what has been described will not be repeated. As used below, the term "unit" may be a combination of software and/or hardware that implements a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, implementations in hardware, or a combination of software and hardware, are also possible and contemplated.
图11是根据本发明实施例的一种虚拟对象渲染装置的结构框图,通过终端设备提供图形用户界面,图形用户界面至少部分地显示一游戏场景,游戏场景至少部分地包括一虚拟对象,如图11所示,该虚拟对象渲染装置110可以包括:获取单元111、溶解单元112和确定单元113。11 is a structural block diagram of a virtual object rendering apparatus according to an embodiment of the present invention. A graphical user interface is provided through a terminal device, and the graphical user interface at least partially displays a game scene, and the game scene at least partially includes a virtual object, as shown in FIG. As shown in 11 , the virtual
第一确定单元111,用于确定游戏场景的观察角度。The first determining unit 111 is configured to determine the viewing angle of the game scene.
溶解单元112,用于基于观察角度对第一目标贴图进行溶解处理,得到溶解结果,其中,第一目标贴图用于表征虚拟对象的纹理图像。The dissolving unit 112 is configured to perform dissolving processing on the first target map based on the observation angle to obtain a dissolving result, wherein the first target map is used to represent the texture image of the virtual object.
第二确定单元113,用于基于溶解结果确定虚拟对象的目标透明值。The second determining unit 113 is configured to determine the target transparency value of the virtual object based on the dissolution result.
渲染单元114,用于根据目标透明值,以渲染显示虚拟对象。The rendering unit 114 is configured to render and display the virtual object according to the target transparency value.
在该实施例的虚拟对象渲染装置中,本申请通过第一确定单元,确定游戏场景的观察角度;利用溶解单元,基于观察角度对第一目标贴图进行溶解处理,得到溶解结果,其中,第一目标贴图用于表征虚拟对象的纹理图像;利用第二确定单元,基于溶解结果确定虚拟对象的目标透明值;利用渲染单元,根据目标透明值,以渲染显示虚拟对象,从而基于溶解结果确定虚拟月亮对象的目标透明通道,实现随视线变化而出现月圆月缺的目的,提高了对月亮对象的月食效果进行展现的灵活性,进而解决了对虚拟月亮对象的月食效果进行展现的灵活性低的技术问题,达到了提高对月亮对象的月食效果进行展现的灵活性的技术效果。In the virtual object rendering device of this embodiment, the present application determines the viewing angle of the game scene through the first determining unit; the dissolving unit is used to dissolve the first target map based on the viewing angle to obtain a dissolution result, wherein the first The target map is used to represent the texture image of the virtual object; the second determination unit is used to determine the target transparency value of the virtual object based on the dissolution result; the rendering unit is used to render and display the virtual object according to the target transparency value, thereby determining the virtual moon based on the dissolution result The target transparent channel of the object realizes the purpose of appearing the full moon and the moon with the change of sight, improves the flexibility of displaying the lunar eclipse effect of the moon object, and solves the flexibility of displaying the lunar eclipse effect of the virtual moon object. Low technical problems, the technical effect of improving the flexibility of the presentation of the lunar eclipse effect of the lunar object is achieved.
需要说明的是,上述各个单元是可以通过软件或硬件来实现的,对于后者,可以通过以下方式实现,但不限于此:上述单元均位于同一处理器中;或者,上述各个单元以任意组合的形式分别位于不同的处理器中。It should be noted that the above-mentioned units can be implemented by software or hardware, and the latter can be implemented in the following ways, but not limited to this: the above-mentioned units are all located in the same processor; or, the above-mentioned units can be combined in any combination The forms are located in different processors.
本发明的实施例还提供了一种非易失性存储介质,该非易失性存储介质中存储有计算机程序,其中,计算机程序被设置为被处理器运行时执行本发明实施例的虚拟对象渲染方法。An embodiment of the present invention also provides a non-volatile storage medium, where a computer program is stored in the non-volatile storage medium, wherein the computer program is configured to execute the virtual object of the embodiment of the present invention when run by a processor render method.
可选地,在本实施例中,上述非易失性存储介质可以被设置为存储用于执行以下步骤的计算机程序:Optionally, in this embodiment, the above-mentioned non-volatile storage medium may be configured to store a computer program for executing the following steps:
S1,确定游戏场景的观察角度;S1, determine the viewing angle of the game scene;
S2,基于观察角度对第一目标贴图进行溶解处理,得到溶解结果,其中,第一目标贴图用于表征虚拟对象的纹理图像;S2, dissolving the first target map based on the observation angle to obtain a dissolution result, wherein the first target map is used to represent the texture image of the virtual object;
S3,基于溶解结果确定虚拟对象的目标透明值。S3. Determine the target transparency value of the virtual object based on the dissolution result.
S4,根据目标透明值,以渲染显示虚拟对象。S4, rendering and displaying the virtual object according to the target transparency value.
可选地,在本实施例中,上述非易失性存储介质可以包括但不限于:U盘、只读存储器(Read-Only Memory,简称为ROM)、随机存取存储器(Random Access Memory,简称为RAM)、移动硬盘、磁碟或者光盘等各种可以存储计算机程序的介质。Optionally, in this embodiment, the above-mentioned non-volatile storage medium may include but is not limited to: a U disk, a read-only memory (Read-Only Memory, referred to as ROM), and a random access memory (Random Access Memory, referred to as ROM) Various media that can store computer programs, such as RAM), mobile hard disks, magnetic disks or optical disks.
本发明的实施例还提供了一种电子装置,包括存储器和处理器,该存储器中存储有计算机程序,该处理器被设置为运行计算机程序以执行上述任一项方法实施例中的步骤。An embodiment of the present invention also provides an electronic device, comprising a memory and a processor, where a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any of the above method embodiments.
可选地,上述电子装置还可以包括传输设备以及输入输出设备,其中,该传输设备和上述处理器连接,该输入输出设备和上述处理器连接。Optionally, the above-mentioned electronic device may further include a transmission device and an input-output device, wherein the transmission device is connected to the above-mentioned processor, and the input-output device is connected to the above-mentioned processor.
可选地,在本实施例中,上述处理器可以被设置为通过计算机程序执行以下步骤:Optionally, in this embodiment, the above-mentioned processor may be configured to execute the following steps through a computer program:
S1,确定游戏场景的观察角度;S1, determine the viewing angle of the game scene;
S2,基于观察角度对第一目标贴图进行溶解处理,得到溶解结果,其中,第一目标贴图用于表征虚拟对象的纹理图像;S2, dissolving the first target map based on the observation angle to obtain a dissolution result, wherein the first target map is used to represent the texture image of the virtual object;
S3,基于溶解结果确定虚拟对象的目标透明值。S3. Determine the target transparency value of the virtual object based on the dissolution result.
S4,根据目标透明值,以渲染显示虚拟对象。S4, rendering and displaying the virtual object according to the target transparency value.
可选地,本实施例中的具体示例可以参考上述实施例及可选实施方式中所描述的示例,本实施例在此不再赘述。Optionally, for specific examples in this embodiment, reference may be made to the examples described in the foregoing embodiments and optional implementation manners, and details are not described herein again in this embodiment.
上述本发明实施例序号仅仅为了描述,不代表实施例的优劣。The above-mentioned serial numbers of the embodiments of the present invention are only for description, and do not represent the advantages or disadvantages of the embodiments.
在本发明的上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。In the above-mentioned embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
在本申请所提供的几个实施例中,应该理解到,所揭露的技术内容,可通过其它的方式实现。其中,以上所描述的装置实施例仅仅是示意性的,例如所述单元的划分,可以为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,单元或模块的间接耦合或通信连接,可以是电性或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are only illustrative, for example, the division of the units may be a logical function division, and there may be other division methods in actual implementation, for example, multiple units or components may be combined or Integration 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 interfaces, indirect coupling or communication connection of units or modules, and may be in electrical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and components shown as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple 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 each embodiment of the present invention 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. The above-mentioned integrated units may be implemented in the form of hardware, or may be implemented in the form of software functional units.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可为个人计算机、服务器或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。The integrated unit, if implemented in the form of a software functional unit and sold or used as an independent product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , including several instructions for causing 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 methods described in the various embodiments of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes .
以上所述仅是本发明的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本发明的保护范围。The above are only the preferred embodiments of the present invention. It should be pointed out that for those skilled in the art, without departing from the principles of the present invention, several improvements and modifications can be made. It should be regarded as the protection scope of the present invention.
Claims (12)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202111527719.7A CN114299207B (en) | 2021-12-14 | 2021-12-14 | Virtual object rendering method, device, readable storage medium and electronic device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202111527719.7A CN114299207B (en) | 2021-12-14 | 2021-12-14 | Virtual object rendering method, device, readable storage medium and electronic device |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN114299207A true CN114299207A (en) | 2022-04-08 |
| CN114299207B CN114299207B (en) | 2025-06-03 |
Family
ID=80968518
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202111527719.7A Active CN114299207B (en) | 2021-12-14 | 2021-12-14 | Virtual object rendering method, device, readable storage medium and electronic device |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN114299207B (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN114926579A (en) * | 2022-05-24 | 2022-08-19 | 网易(杭州)网络有限公司 | Rendering method and device of virtual three-dimensional model and electronic terminal |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20060132608A1 (en) * | 2004-12-22 | 2006-06-22 | Bendaniel Matt | Automated system and method for processing of astronomical images |
| CN108564646A (en) * | 2018-03-28 | 2018-09-21 | 腾讯科技(深圳)有限公司 | Rendering intent and device, storage medium, the electronic device of object |
| US20210074068A1 (en) * | 2017-10-22 | 2021-03-11 | Magical Technologies, Llc | Systems, Methods and Apparatuses of Digital Assistants in an Augmented Reality Environment and Local Determination of Virtual Object Placement and Apparatuses of Single or Multi-directional Lens as Portals Between a Physical World and a Digital World Component of the Augmented Reality Environment |
| CN112973117A (en) * | 2021-04-15 | 2021-06-18 | 腾讯科技(深圳)有限公司 | Interaction method of virtual objects, reward issuing method, device, equipment and medium |
| CN113769398A (en) * | 2021-09-14 | 2021-12-10 | 网易(杭州)网络有限公司 | Processing method, device and equipment of virtual sighting telescope and storage medium |
-
2021
- 2021-12-14 CN CN202111527719.7A patent/CN114299207B/en active Active
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20060132608A1 (en) * | 2004-12-22 | 2006-06-22 | Bendaniel Matt | Automated system and method for processing of astronomical images |
| US20210074068A1 (en) * | 2017-10-22 | 2021-03-11 | Magical Technologies, Llc | Systems, Methods and Apparatuses of Digital Assistants in an Augmented Reality Environment and Local Determination of Virtual Object Placement and Apparatuses of Single or Multi-directional Lens as Portals Between a Physical World and a Digital World Component of the Augmented Reality Environment |
| CN108564646A (en) * | 2018-03-28 | 2018-09-21 | 腾讯科技(深圳)有限公司 | Rendering intent and device, storage medium, the electronic device of object |
| CN112973117A (en) * | 2021-04-15 | 2021-06-18 | 腾讯科技(深圳)有限公司 | Interaction method of virtual objects, reward issuing method, device, equipment and medium |
| CN113769398A (en) * | 2021-09-14 | 2021-12-10 | 网易(杭州)网络有限公司 | Processing method, device and equipment of virtual sighting telescope and storage medium |
Non-Patent Citations (2)
| Title |
|---|
| MARC POMERANTZ ET.AL: "Multi-mission, Interactive 3D Visualization in a Web Browser for Robotic System and Space Flight Mission Development and Operations", 2019 IEEE INTERNATIONAL CONFERENCE ON SPACE MISSION CHALLENGES FOR INFORMATION TECHNOLOGY (SMC-IT), 11 October 2019 (2019-10-11) * |
| 陈小亮: "基于Java3D的太阳系虚拟仿真研究", 中国优秀硕士学位论文全文数据库, 15 July 2015 (2015-07-15) * |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN114926579A (en) * | 2022-05-24 | 2022-08-19 | 网易(杭州)网络有限公司 | Rendering method and device of virtual three-dimensional model and electronic terminal |
Also Published As
| Publication number | Publication date |
|---|---|
| CN114299207B (en) | 2025-06-03 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US8672753B2 (en) | Video game including effects for providing different experiences of the same video game world and a storage medium storing software for the video game | |
| WO2022247204A1 (en) | Game display control method, non-volatile storage medium and electronic device | |
| US20070139408A1 (en) | Reflective image objects | |
| US20130229413A1 (en) | Live editing and integrated control of image-based lighting of 3d models | |
| CN116958344A (en) | Animation generation method and device for virtual image, computer equipment and storage medium | |
| CN116271814A (en) | Scene picture processing method, device, storage medium and electronic device | |
| CN108043027B (en) | Storage medium, electronic device, game screen display method and device | |
| CN111696190A (en) | Lighting effects from luminous inserted content | |
| CN115375822A (en) | Cloud model rendering method and device, storage medium and electronic device | |
| CN115311395A (en) | Three-dimensional scene rendering method, device and equipment | |
| CN115082607B (en) | Virtual character hair rendering method, device, electronic equipment and storage medium | |
| CN114949863B (en) | Virtual character eye rendering method, device, electronic device and storage medium | |
| CN114820915A (en) | Method, device, storage medium and electronic device for rendering silhouette light | |
| CN114299207B (en) | Virtual object rendering method, device, readable storage medium and electronic device | |
| CN115713589A (en) | Image generation method and device for virtual building group, storage medium and electronic device | |
| CN115089964B (en) | Method, device, storage medium and electronic device for rendering virtual fog model | |
| CN115501590B (en) | Display method, display device, electronic equipment and storage medium | |
| CN115131489B (en) | Cloud layer rendering method and device, storage medium and electronic device | |
| CN114332316B (en) | A method, device, electronic device and storage medium for processing virtual characters | |
| CN114445531B (en) | Method, device, storage medium and electronic device for realizing thundercloud effect | |
| CN115439594A (en) | Filter effect rendering method and device of virtual model and storage medium | |
| CN116603235A (en) | Model information processing method, device, readable storage medium and electronic device | |
| CN116452704A (en) | Method and device for generating lens halation special effect, storage medium and electronic device | |
| CN115708956A (en) | Game picture updating method and device, computer equipment and medium | |
| CN114299211A (en) | Information processing method, information processing apparatus, readable storage medium, and electronic apparatus |
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 | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |