[go: up one dir, main page]

CN116531749A - Virtual object display method, device, equipment and storage medium - Google Patents

Virtual object display method, device, equipment and storage medium Download PDF

Info

Publication number
CN116531749A
CN116531749A CN202310333482.1A CN202310333482A CN116531749A CN 116531749 A CN116531749 A CN 116531749A CN 202310333482 A CN202310333482 A CN 202310333482A CN 116531749 A CN116531749 A CN 116531749A
Authority
CN
China
Prior art keywords
virtual object
projection
light data
light source
parallel
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
Application number
CN202310333482.1A
Other languages
Chinese (zh)
Inventor
赵俊宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN202310333482.1A priority Critical patent/CN116531749A/en
Publication of CN116531749A publication Critical patent/CN116531749A/en
Pending legal-status Critical Current

Links

Classifications

    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/50Controlling the output signals based on the game progress
    • A63F13/52Controlling the output signals based on the game progress involving aspects of the displayed game scene
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/005General purpose rendering architectures
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/06Ray-tracing
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F2300/00Features 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/60Methods for processing data by generating or executing the game program
    • A63F2300/66Methods for processing data by generating or executing the game program for rendering three dimensional images
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02BCLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO BUILDINGS, e.g. HOUSING, HOUSE APPLIANCES OR RELATED END-USER APPLICATIONS
    • Y02B20/00Energy efficient lighting technologies, e.g. halogen lamps or gas discharge lamps
    • Y02B20/40Control techniques providing energy savings, e.g. smart controller or presence detection

Landscapes

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

Abstract

本发明涉及计算机图形渲染领域,公开了一种虚拟对象显示方法、装置、设备及存储介质。该方法包括:获取作用于虚拟对象的光源信息,光源信息包括与虚拟对象垂直且与地面平行的平行光源所产生的平行光数据、以及与虚拟对象呈预设角度的额外光源所产生的额外光数据;利用平行光数据和额外光数据对虚拟对象进行亮度调整、以及利用额外光数据生成虚拟对象的投影,并对亮度调整后的虚拟对象和投影进行显示。本发明提升了在各种性能配置中对虚拟对象的光照效果和投影效果的准确性。

The invention relates to the field of computer graphic rendering, and discloses a virtual object display method, device, equipment and storage medium. The method includes: obtaining light source information acting on the virtual object, the light source information including parallel light data generated by a parallel light source perpendicular to the virtual object and parallel to the ground, and additional light generated by an additional light source at a preset angle to the virtual object Data; use the parallel light data and the extra light data to adjust the brightness of the virtual object, and use the extra light data to generate a projection of the virtual object, and display the brightness-adjusted virtual object and the projection. The invention improves the accuracy of the lighting effects and projection effects of virtual objects in various performance configurations.

Description

虚拟对象显示方法、装置、设备及存储介质Virtual object display method, device, equipment and storage medium

技术领域technical field

本发明涉及计算机图形渲染领域,尤其涉及一种虚拟对象显示方法、装置、设备及存储介质。The invention relates to the field of computer graphics rendering, in particular to a virtual object display method, device, equipment and storage medium.

背景技术Background technique

游戏内通常会有一个角色装备界面,或者商城时装界面用来展示角色时装效果。为了让角色更立体,会给角色添加投影和照亮,角色给地面的投影会让玩家感觉角色是踩在地面上的。在unity中现有的技术包括以下两种方案来给角色添加投影和照亮:第一种是通过平行光让角色产生投影,并通过点光射灯等额外光照亮角色。第二种是通过平行光来同时产生投影和照亮角色。但是由于两种方案用平行光生成投影,所以第一种方案会考虑到照亮角色,而使得平行光的角度设置不合理,会导致投影效果不佳,第二种方案需要额外光来照亮角色,在设备低配置模式下关闭额外光,则会导致光照不正常。There is usually a character equipment interface in the game, or a fashion interface in the mall to display the effect of character fashion. In order to make the character more three-dimensional, projection and lighting will be added to the character. The projection of the character to the ground will make the player feel that the character is stepping on the ground. The existing technologies in Unity include the following two schemes to add projection and lighting to the character: the first is to make the character produce projection through parallel light, and illuminate the character through additional light such as point light spotlight. The second is to use directional light to cast shadows and illuminate characters at the same time. However, since the two schemes use parallel light to generate projections, the first scheme will consider illuminating the character, which makes the angle setting of the parallel light unreasonable, which will lead to poor projection effects. The second scheme requires additional light to illuminate For the character, turning off the extra light in the low configuration mode of the device will cause the lighting to be abnormal.

发明内容Contents of the invention

本发明的主要目的在于解决现有角色展示方法在角色亮度和角色投影的展示效果上不够准确的技术问题。The main purpose of the present invention is to solve the technical problem that the existing character display method is not accurate enough in the display effect of character brightness and character projection.

本发明第一方面提供了一种虚拟对象显示方法,包括:获取作用于虚拟对象的光源信息,所述光源信息包括与所述虚拟对象垂直且与地面平行的平行光源所产生的平行光数据、以及与所述虚拟对象呈预设角度的额外光源所产生的额外光数据;利用所述平行光数据和所述额外光数据对所述虚拟对象进行亮度调整、以及利用所述额外光数据生成所述虚拟对象的投影,并对亮度调整后的虚拟对象和所述投影进行显示。The first aspect of the present invention provides a method for displaying a virtual object, including: acquiring light source information acting on the virtual object, the light source information including parallel light data generated by a parallel light source perpendicular to the virtual object and parallel to the ground, and additional light data generated by an additional light source at a preset angle to the virtual object; using the parallel light data and the additional light data to adjust the brightness of the virtual object, and using the additional light data to generate the The projection of the virtual object is displayed, and the virtual object and the projection after brightness adjustment are displayed.

本发明第二方面提供了一种虚拟对象显示装置,包括:获取模块,用于获取作用于虚拟对象的光源信息,所述光源信息包括与所述虚拟对象平行的光源所产生的平行光数据、以及与所述虚拟对象呈预设角度的光源所产生的额外光数据;调整显示模块,用于利用所述平行光数据和所述额外光数据对所述虚拟对象进行亮度调整、以及利用所述额外光数据生成所述虚拟对象的投影,并对亮度调整后的虚拟对象和所述投影进行显示。The second aspect of the present invention provides a virtual object display device, including: an acquisition module, configured to acquire light source information acting on a virtual object, where the light source information includes parallel light data generated by a light source parallel to the virtual object, and additional light data generated by a light source at a preset angle to the virtual object; an adjustment display module for adjusting the brightness of the virtual object by using the parallel light data and the additional light data, and using the The additional light data generates a projection of the virtual object and displays the brightness-adjusted virtual object and the projection.

本发明第三方面提供了一种虚拟对象显示设备,包括:存储器和至少一个处理器,所述存储器中存储有指令;所述至少一个处理器调用所述存储器中的所述指令,以使得所述虚拟对象显示设备执行上述的虚拟对象显示方法。The third aspect of the present invention provides a virtual object display device, including: a memory and at least one processor, the memory stores instructions; the at least one processor invokes the instructions in the memory, so that the The virtual object display device executes the above virtual object display method.

本发明的第四方面提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有指令,当其在计算机上运行时,使得计算机执行上述的虚拟对象显示方法。A fourth aspect of the present invention provides a computer-readable storage medium, where instructions are stored in the computer-readable storage medium, and when the computer-readable storage medium is run on a computer, it causes the computer to execute the above virtual object display method.

本发明提供的技术方案中,通过照亮虚拟对象的平行光由于与虚拟对象平行,所以可以形成更好的照亮效果,与地面垂直,所以不会产生投影,只用额外光来生成投影是通过调节合适的角度且不受平行光影响,可以生成正确的投影。高配下同时开启平行光和额外光使得投影和照亮角色都正常,低配模式下关闭额外光也能正确照亮角色。In the technical solution provided by the present invention, the parallel light that illuminates the virtual object can form a better lighting effect because it is parallel to the virtual object, and is perpendicular to the ground, so no projection will be generated, and only extra light is used to generate projection. By adjusting the appropriate angle and not being affected by parallel light, the correct projection can be generated. Turning on the parallel light and the extra light at the same time under high configuration makes the projection and illumination of the character normal, and turning off the extra light under the low configuration mode can also illuminate the character correctly.

附图说明Description of drawings

图1为本发明实施例中虚拟对象显示方法的一实施例示意图;FIG. 1 is a schematic diagram of an embodiment of a virtual object display method in an embodiment of the present invention;

图2为本发明实施例中虚拟对象光源照射效果的实施例示意图;Fig. 2 is a schematic diagram of an embodiment of the illumination effect of a virtual object light source in an embodiment of the present invention;

图3为本发明实施例中虚拟对象显示方法的另一实施例示意图;Fig. 3 is a schematic diagram of another embodiment of the virtual object display method in the embodiment of the present invention;

图4为本发明实施例中虚拟对象显示装置的一个实施例示意图;Fig. 4 is a schematic diagram of an embodiment of a virtual object display device in an embodiment of the present invention;

图5为本发明实施例中虚拟对象显示装置的另一个实施例示意图;Fig. 5 is a schematic diagram of another embodiment of the virtual object display device in the embodiment of the present invention;

图6为本发明实施例中虚拟对象显示设备的一个实施例示意图。Fig. 6 is a schematic diagram of an embodiment of a virtual object display device in an embodiment of the present invention.

具体实施方式Detailed ways

本发明实施例提供了一种虚拟对象显示方法、装置、设备及存储介质,获取作用于虚拟对象的光源信息,光源信息包括与虚拟对象垂直且与地面平行的平行光源所产生的平行光数据、以及与虚拟对象呈预设角度的额外光源所产生的额外光数据;利用平行光数据和额外光数据对虚拟对象进行亮度调整、以及利用额外光数据生成虚拟对象的投影,并对亮度调整后的虚拟对象和投影进行显示。本发明提升了在各种性能配置中对虚拟对象的光照效果和投影效果的准确性。Embodiments of the present invention provide a virtual object display method, device, device, and storage medium to obtain light source information acting on a virtual object. The light source information includes parallel light data generated by a parallel light source perpendicular to the virtual object and parallel to the ground, and additional light data generated by an additional light source with a preset angle to the virtual object; use the parallel light data and the additional light data to adjust the brightness of the virtual object, and use the additional light data to generate the projection of the virtual object, and adjust the brightness Virtual objects and projections are displayed. The invention improves the accuracy of the lighting effect and the projection effect of the virtual object in various performance configurations.

本发明的说明书和权利要求书及上述附图中的术语“第一”、“第二”、“第三”、“第四”等(如果存在)是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的实施例能够以除了在这里图示或描述的内容以外的顺序实施。此外,术语“包括”或“具有”及其任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。The terms "first", "second", "third", "fourth", etc. (if any) in the description and claims of the present invention and the above drawings are used to distinguish similar objects, and not necessarily Used to describe a specific sequence or sequence. It is to be understood that the terms so used are interchangeable under appropriate circumstances such that the embodiments described herein can be practiced in sequences other than those illustrated or described herein. Furthermore, the term "comprising" or "having" and any variations thereof, are intended to cover a non-exclusive inclusion, for example, a process, method, system, product or device comprising a sequence of steps or elements is not necessarily limited to those explicitly listed instead, may include other steps or elements not explicitly listed or inherent to the process, method, product or apparatus.

为便于理解,下面对本发明实施例的具体流程进行描述,请参阅图1,本发明实施例中虚拟对象显示方法的一个实施例包括:For ease of understanding, the specific process of the embodiment of the present invention is described below, please refer to FIG. 1, an embodiment of the virtual object display method in the embodiment of the present invention includes:

101、获取作用于虚拟对象的光源信息,所述光源信息包括与所述虚拟对象垂直且与地面平行的平行光源所产生的平行光数据、以及与所述虚拟对象呈预设角度的额外光源所产生的额外光数据;101. Acquire light source information acting on a virtual object, the light source information includes parallel light data generated by a parallel light source perpendicular to the virtual object and parallel to the ground, and data generated by an additional light source at a preset angle to the virtual object Additional light data generated;

可以理解的是,本发明的执行主体可以为虚拟对象显示装置,还可以是终端或者服务器,具体此处不做限定。本发明实施例以终端装置为执行主体为例进行说明。It can be understood that the subject of execution of the present invention may be a virtual object display device, and may also be a terminal or a server, which is not specifically limited here. The embodiment of the present invention is described by taking a terminal device as an execution subject as an example.

本实施例中,产生平行光数据的主要光源作为平行光源,产生额外光数据的额外光源作为辅助光源,由于在手机低配机上会出现帧率降低的情况,故提供高配置和低配置的显示方式,在高配置的显示方式下会同时开启平行光源和额外光源,在低配置的显示方式下只会开启平行光源。需注意的是,由于如Unity urp等工具,只支持一盏平行光源,故此处的额外光源即为非平行光源,比如探射光源等。In this embodiment, the main light source that generates parallel light data is used as a parallel light source, and the additional light source that generates additional light data is used as an auxiliary light source. Since the frame rate will decrease on low-end mobile phones, high-configuration and low-configuration displays are provided. In the display mode of high configuration, the parallel light source and the additional light source will be turned on at the same time, and in the display mode of low configuration, only the parallel light source will be turned on. It should be noted that since tools such as Unity urp only support one parallel light source, the additional light source here is a non-parallel light source, such as a probe light source.

具体的,如图2所示,作用于虚拟对象的平行光数据,由于平行光源平行于地面且垂直于虚拟对象,故不会将光源打在地面上,只会用于照亮虚拟对象,不会产生投影,同时不会因为在低配置模式下缺少额外光数据而使得对虚拟对象的光照不正常。作用于虚拟对象的额外光数据,由于额外光源与虚拟对象呈预设角度,比如上方60°,预设较好的角度会使得虚拟对象可以投影保持正常,同时也不会受到高配模式下平行光的照射影响而使得虚拟对象的投影被拉长。Specifically, as shown in Figure 2, the parallel light data acting on the virtual object, because the parallel light source is parallel to the ground and perpendicular to the virtual object, will not hit the light source on the ground, but will only be used to illuminate the virtual object. Shadows are produced, and virtual objects are not lit incorrectly due to the lack of extra light data in low configuration mode. The extra light data acting on the virtual object, because the extra light source and the virtual object are at a preset angle, such as 60° above, a better preset angle will allow the virtual object to project normally and will not be affected by the parallel light in the high-end mode The projection of the virtual object is elongated due to the influence of the illumination.

102、利用所述平行光数据和所述额外光数据对所述虚拟对象进行亮度调整、以及利用所述额外光数据生成所述虚拟对象的投影,并对亮度调整后的虚拟对象和所述投影进行显示。102. Use the parallel light data and the additional light data to adjust the brightness of the virtual object, and use the additional light data to generate a projection of the virtual object, and adjust the brightness of the virtual object and the projection to display.

本实施例中,在计算虚拟对象在地面上的投影时,只会利用呈预设角度作用于所述虚拟对象的额外光源发光生成预投影的平行光数据;因为平行光源与地面平行,所以不会在地貌上产生投影,故不需要利用平行光数据来计算投影。此处通过设置平行光数据的角度将平行光数据与用于生成投影的额外光数据区分开来,是为了保证在终端装置高低配的显示模式切换时,保证投影仅与平行光数据相关,投影信息仅与额外光数据相关,产生的投影不会被拉长。In this embodiment, when calculating the projection of the virtual object on the ground, only the extra light source acting on the virtual object at a preset angle is used to emit light to generate pre-projected parallel light data; because the parallel light source is parallel to the ground, there is no A projection will be generated on the terrain, so there is no need to use parallel light data to calculate the projection. Here, by setting the angle of the parallel light data to distinguish the parallel light data from the extra light data used to generate the projection, it is to ensure that the projection is only related to the parallel light data when the display mode of the terminal device is switched between high and low. The information is only related to the extra light data, the resulting projections are not stretched.

本实施例中,平行光数据用于照亮虚拟对象,在存在或者不存在额外光数据的情况下,都能保证虚拟对象被正常照亮,即保证在终端装置高低配的先显示模式切换时,保证虚拟对象的正常显示亮度。In this embodiment, the parallel light data is used to illuminate the virtual object, and it can ensure that the virtual object is normally illuminated in the presence or absence of additional light data, that is, when the first display mode of the terminal device is switched between high and low , to ensure the normal display brightness of the virtual object.

本实施例中,可以通过平行光数据和额外光数据产生光照贴图,渲染至虚拟对象的二维或者三维模型上,来对虚拟对象进行亮度调整,使得虚拟对象呈现被照亮的效果。然后通过额外光数据产生投影遮罩,在虚拟对象的投影位置上进行渲染,将投影遮罩渲染至游戏场景中,比如在虚拟对象的正下方地面上,或者偏离虚拟对象预设距离的地面上,主要取决于额外光源的预设角度的大小,根据预设角度的光源和虚拟对象的连接直线,与地面的交叉位置,来设置投影位置。在渲染了光照贴图和投影遮罩之后,即可在移动终端界面上进行显示,包括虚拟对象和在地面上的投影。In this embodiment, parallel light data and additional light data can be used to generate light maps and render them on the 2D or 3D model of the virtual object to adjust the brightness of the virtual object so that the virtual object appears illuminated. Then use the additional light data to generate a projection mask, render it at the projection position of the virtual object, and render the projection mask to the game scene, such as on the ground directly below the virtual object, or on the ground that deviates from the virtual object at a preset distance , mainly depends on the size of the preset angle of the additional light source, and the projection position is set according to the intersection position between the light source at the preset angle and the virtual object, and the intersection position with the ground. After the lightmap and projection mask are rendered, they can be displayed on the mobile terminal interface, including virtual objects and projections on the ground.

本发明实施例中,通过照亮虚拟对象的平行光由于与虚拟对象平行,所以可以形成更好的照亮效果,与地面垂直,所以不会产生投影,只用额外光来生成投影是通过调节合适的角度且不受平行光影响,可以生成正确的投影。高配下同时开启平行光和额外光使得投影和照亮角色都正常,低配模式下关闭额外光也能正确照亮角色。In the embodiment of the present invention, because the parallel light that illuminates the virtual object is parallel to the virtual object, a better lighting effect can be formed, and it is perpendicular to the ground, so no projection will be generated. Only additional light is used to generate projection by adjusting Proper angle and not affected by parallel light can produce correct shadow. Turning on the parallel light and the extra light at the same time under high configuration makes the projection and illumination of the character normal, and turning off the extra light under the low configuration mode can also illuminate the character correctly.

请参阅图3,本发明实施例中虚拟对象显示方法的另一个实施例包括:Referring to Fig. 3, another embodiment of the virtual object display method in the embodiment of the present invention includes:

201、检测对所述虚拟对象设置的显示性能模式;201. Detect the display performance mode set for the virtual object;

202、当检测到对所述虚拟对象设置的显示性能模式为高配模式时,控制所述平行光源发光、以及控制与所述额外光源发光,并作用于所述虚拟对象;202. When it is detected that the display performance mode set for the virtual object is a high configuration mode, control the parallel light source to emit light and the additional light source to emit light, and act on the virtual object;

203、当检测到对所述虚拟对象设置的显示性能模式为低配模式时,控制所述平行光源发光,并作用于所述虚拟对象;203. When it is detected that the display performance mode set for the virtual object is a low configuration mode, control the parallel light source to emit light and act on the virtual object;

本实施例中,在高配模式下,会同时控制额外光源发光来生成虚拟对象的投影,以及控制平行光源发光来结合额外光源照亮虚拟对象;在低配模式,该第二模式下,为了减少消耗,只会控制平行光源发光来照亮虚拟对象,不会产生投影。In this embodiment, in the high configuration mode, the additional light source is controlled to emit light to generate the projection of the virtual object, and the parallel light source is controlled to emit light to combine with the additional light source to illuminate the virtual object; in the low configuration mode, in the second mode, in order to reduce consumption, it will only control parallel light sources to illuminate virtual objects, and will not produce projections.

204、获取作用于虚拟对象的光源信息,所述光源信息包括与所述虚拟对象垂直且与地面平行的平行光源所产生的平行光数据、以及与所述虚拟对象呈预设角度的额外光源所产生的额外光数据;204. Obtain light source information acting on the virtual object, the light source information includes parallel light data generated by a parallel light source perpendicular to the virtual object and parallel to the ground, and data generated by an additional light source at a preset angle to the virtual object Additional light data generated;

205、利用所述额外光数据调整所述投影片的属性参数,并基于调整属性参数后的投影片,生成所述虚拟对象的投影;205. Use the additional light data to adjust the attribute parameters of the projection sheet, and generate a projection of the virtual object based on the projection sheet after adjusting the attribute parameters;

本实施例中,在所述虚拟对象的投影位置设置有投影片,专门用于接受虚拟对象的投影并进行显示,以防止平行光源反射或者其他形式照射到地面影响投影生成,以及投影片直接叠加在背景上不用处理接缝问题,较好的模拟出虚拟对象站在场景中的效果(直接在地面上形成投影容易在地表与背景板的衔接上出现接缝);同时编写新的投影函数,仅用于计算额外光数据,不计算平行光数据,使得在投影片上生成和显示的投影仅与额外光数据相关。通过投影片,也可以实现额外光数据和平行光数据的隔离。In this embodiment, a projection sheet is set at the projection position of the virtual object, which is specially used to accept the projection of the virtual object and display it, so as to prevent the parallel light source from reflecting or illuminating the ground in other ways to affect the projection generation, and the projection sheet is directly superimposed There is no need to deal with the seam problem on the background, and it can better simulate the effect of the virtual object standing in the scene (directly forming a projection on the ground will easily cause seams on the connection between the ground surface and the background board); at the same time, write a new projection function, Used only to calculate extra light data, not directional light data, so that projections generated and displayed on slides are only associated with extra light data. The isolation of additional light data and parallel light data can also be achieved by transparencies.

具体的,可以在三维软件如Unity、UE4中,为投影片编写新的Shader(着色器),同时设置该新的Shader的半透明混合模式,以用于混合额外光数据在该Shader上的投影。根据额外光数据,改变投影片属性参数,如颜色、透明度,将额外光数据在投影片上的投影区域显示出来,生成投影样式,并将投影片的其他区域透明化,以隐藏其他区域显示。Specifically, in 3D software such as Unity and UE4, a new Shader (shader) can be written for the projection film, and the translucent mixing mode of the new Shader can be set at the same time to be used for mixing the projection of additional light data on the Shader . According to the extra light data, change the properties parameters of the slide, such as color and transparency, display the projection area of the extra light data on the slide, generate a projection style, and make other areas of the slide transparent to hide other areas.

在一种实施方式中,所述利用所述额外光数据调整所述投影片的属性参数包括:所述投影片的混合模式为半透明混合模式,且所述投影片的初始属性设置为透明属性;根据所述额外光数据对应的预设角度,利用预设的投影函数,计算所述额外光数据在所述投影片所处的投影像素;根据所述额外光数据,调整所述投影像素上的颜色值和透明度。In one embodiment, the adjusting the attribute parameters of the projection sheet by using the additional light data includes: the blending mode of the projection sheet is a translucent blending mode, and the initial attribute of the projection sheet is set to a transparent attribute ; According to the preset angle corresponding to the additional light data, using a preset projection function, calculate the projection pixel where the additional light data is located on the projection sheet; adjust the projection pixel on the projection pixel according to the additional light data The color value and transparency of the .

在一种实施方式中,所述根据所述额外光数据,调整所述投影像素上的颜色值和透明度包括:根据所述额外光数据,判断呈预设角度作用于所述虚拟对象的光照量是否大于预设数量;若所述光照量大于预设数量,则根据所述额外光数据,计算所述投影像素上的第一颜色值和第一透明度;若所述光照量不大于预设数量,则将所述投影像素调整为预设的第二颜色值和预设的第二透明度。In one embodiment, the adjusting the color value and transparency of the projected pixel according to the additional light data includes: judging the amount of light acting on the virtual object at a preset angle according to the additional light data Whether it is greater than a preset amount; if the amount of illumination is greater than a preset amount, calculate the first color value and first transparency on the projected pixel according to the additional light data; if the amount of illumination is not greater than a preset amount , the projected pixels are adjusted to a preset second color value and a preset second transparency.

本实施例中,以Unity示例,可以直接在针对投影片编写的Shader中,将该Shader的Shader RenderType设置为Transparent,即设置呈现方式为全透明的Shader:Tags{"RenderType"="Transparent""Queue"="Transparent""RenderPipeline"="LightweightPipeline""IgnoreProjector"="True"}。然后通过设置该Shader为BlendSrcAlpha OneMinusSrcAlpha,即传统半透明混合方式,可以用于混合高配模式的光源数据。In this embodiment, taking Unity as an example, you can directly set the Shader RenderType of the Shader to Transparent in the Shader written for the slideshow, that is, set the rendering mode to be fully transparent Shader: Tags{"RenderType"="Transparent"" Queue"="Transparent" "RenderPipeline"="LightweightPipeline" "IgnoreProjector"="True"}. Then by setting the Shader to BlendSrcAlpha OneMinusSrcAlpha, that is, the traditional semi-transparent blending method, it can be used to blend the light source data of the high-end mode.

具体的,通过编写新的投影函数PixelAdditionalShadow,设置该投影函数内不计算平行光数据。在检查额外光数据的光照量是否大于预设数量时,比如预设数量为0,则判断光照量是否大于0,如果不大于0则直接返回0:UNITY_BRANCH;if(_AdditionalLightsCount.x<=0);return 0;,此时可以预设对应的第二颜色值为任意值或者不改变投影片的颜色值,然后预设对应的第二透明度为100%,即隐藏该投影片,使得虚拟对象没有投影。Specifically, by writing a new projection function PixelAdditionalShadow, the parallel light data is not calculated in the projection function. When checking whether the illumination amount of the additional light data is greater than the preset amount, for example, if the preset amount is 0, then judge whether the illumination amount is greater than 0, and return 0 directly if it is not greater than 0: UNITY_BRANCH; if(_AdditionalLightsCount.x<=0) ;return 0;, at this time, you can preset the corresponding second color value to any value or not change the color value of the slide, and then preset the corresponding second transparency to 100%, that is, hide the slide so that the virtual object does not projection.

具体的,遍历所有额外光数据,确定光源数据在投影片所处的投影像素,然后将额外光数据的投影叠加,可以通过添加参数_BaseColor来控制投影像素的颜色及透明度:Light light=(Light)0;ForEachAdditionalLight(light);{shadow+=light.shadowAttenuation;};return shadow*_BaseColor。Specifically, iterate through all the extra light data, determine the projection pixel where the light source data is located on the slide, and then overlay the projection of the extra light data. You can control the color and transparency of the projected pixel by adding the parameter _BaseColor: Light light=(Light )0; ForEachAdditionalLight(light); {shadow+=light.shadowAttenuation;}; return shadow*_BaseColor.

在一种实施方式中,若所述投影片的初始属性设置为非透明属性,则在所述根据所述额外光数据,调整所述投影像素上的颜色值和透明度之后,还包括:获取所述投影片中除了所述投影像素之外的其他非投影像素,并将所述非投影像素从非透明属性调整为透明属性,以将所述非投影像素所在的区域隐藏。In one embodiment, if the initial attribute of the projected sheet is set to be non-transparent, after adjusting the color value and transparency of the projected pixel according to the additional light data, further comprising: obtaining the other non-projected pixels in the projection sheet except the projected pixels, and adjust the property of the non-projected pixels from non-transparent to transparent, so as to hide the area where the non-projected pixels are located.

如前述所示,如果投影片的混合模式为半透明混合模式,且投影片属性为透明属性;投影片中的非投影像素不会显示投影,此时投影片属性参数为透明参数,即透明度为1,投影片已经是被隐藏而不可见,故无需对投影片执行任何操作。如果所述投影片属性参数的初始设置为非透明参数,则此时投影片的非投影像素的透明度小于1,在终端装置的界面上默认为可见,则此时需要将非投影像素的属性参数由非透明参数调整为透明参数,即将非投影像素的透明度调整为1,即可对非投影像素进行隐藏。As mentioned above, if the blending mode of the slideshow is translucent, and the slideshow attribute is transparent; the non-projected pixels in the slideshow will not display projection, and the slideshow attribute parameter is a transparent parameter, that is, the transparency is 1. The slideshow is already hidden and invisible, so there is no need to perform any operations on the slideshow. If the initial setting of the slide attribute parameter is a non-transparent parameter, then the transparency of the non-projected pixels of the slide is less than 1 at this time, and it is visible by default on the interface of the terminal device, then the attribute parameter of the non-projected pixel needs to be set to Adjust the non-transparent parameter to the transparent parameter, that is, adjust the transparency of the non-projected pixel to 1, so that the non-projected pixel can be hidden.

206、利用所述平行光数据和所述额外光数据,计算在所述虚拟对象表面上的光照信息、以及确定所述虚拟对象表面各区域存在的阴影遮蔽关系;206. Using the parallel light data and the additional light data, calculate the lighting information on the surface of the virtual object, and determine the shadow shading relationship existing in each area of the surface of the virtual object;

207、基于所述光照信息和所述阴影遮蔽关系,调整所述虚拟对象表面上的亮度、以及利用所述额外光数据生成所述虚拟对象的投影,并对亮度调整后的虚拟对象和所述投影进行显示。207. Based on the illumination information and the shadow-shading relationship, adjust the brightness on the surface of the virtual object, and use the additional light data to generate a projection of the virtual object, and adjust the brightness of the virtual object and the virtual object projection to display.

本实施例中,在终端装置的高低配显示模式下,都会对虚拟对象进行照亮,来使得虚拟对象的显示更加自然和真实且清晰,即光源信息中至少包括平行光数据。此处先基于平行光数据计算得到的在虚拟对象的光照信息,来调整虚拟对象表面的的亮度,在平行光照下虚拟对象的显示会更加自然和真实,故此处优选调整虚拟对象的平行光照亮度。In this embodiment, in the high-low configuration display mode of the terminal device, the virtual object will be illuminated to make the display of the virtual object more natural, real and clear, that is, the light source information includes at least parallel light data. Here, the brightness information on the virtual object is first calculated based on the parallel light data to adjust the brightness of the virtual object surface. The display of the virtual object under the parallel light will be more natural and real. Therefore, it is preferable to adjust the parallel light brightness of the virtual object here. .

具体的,可以开启平行光数据的平行光投影,在角色界面平行光平视角色,平行光投影不会投射到地面,只会投射到虚拟对象上,为虚拟对象每个部位之间提供阴影遮蔽关系,比如脸部受到头发的遮蔽,肢体受到衣物的遮蔽等,在受遮蔽的部位产生阴影。这样在终端装置的低配模式下,关闭额外光数据的时候,虚拟对象依然能够受到均匀的照明。Specifically, parallel light projection of parallel light data can be enabled, and parallel light projection can be used to look up at the character in the character interface. Parallel light projection will not be projected on the ground, but only on the virtual object, providing shadow and shading relationships between each part of the virtual object. , For example, the face is covered by hair, the limbs are covered by clothing, etc., and shadows are generated in the covered parts. In this way, in the low configuration mode of the terminal device, when the extra light data is turned off, the virtual object can still be uniformly illuminated.

上面对本发明实施例中虚拟对象显示方法进行了描述,下面对本发明实施例中虚拟对象显示装置进行描述,请参阅图4,本发明实施例中虚拟对象显示装置一个实施例包括:The virtual object display method in the embodiment of the present invention is described above, and the virtual object display device in the embodiment of the present invention is described below. Please refer to FIG. 4. An embodiment of the virtual object display device in the embodiment of the present invention includes:

获取模块301,用于获取作用于虚拟对象的光源信息,所述光源信息包括与所述虚拟对象平行的光源所产生的平行光数据、以及与所述虚拟对象呈预设角度的光源所产生的额外光数据;An acquisition module 301, configured to acquire light source information acting on a virtual object, the light source information including parallel light data generated by a light source parallel to the virtual object, and parallel light data generated by a light source at a preset angle to the virtual object additional light data;

调整显示模块302,用于利用所述平行光数据和所述额外光数据对所述虚拟对象进行亮度调整、以及利用所述额外光数据生成所述虚拟对象的投影,并对亮度调整后的虚拟对象和所述投影进行显示。The adjustment display module 302 is configured to use the parallel light data and the additional light data to adjust the brightness of the virtual object, and use the additional light data to generate a projection of the virtual object, and to adjust the brightness of the virtual object. The object and the projection are displayed.

本发明实施例中,通过照亮虚拟对象的平行光由于与虚拟对象平行,所以可以形成更好的照亮效果,与地面垂直,所以不会产生投影,只用额外光来生成投影是通过调节合适的角度且不受平行光影响,可以生成正确的投影。高配下同时开启平行光和额外光使得投影和照亮角色都正常,低配模式下关闭额外光也能正确照亮角色。In the embodiment of the present invention, because the parallel light that illuminates the virtual object is parallel to the virtual object, a better lighting effect can be formed, and it is perpendicular to the ground, so no projection will be generated. Only additional light is used to generate projection by adjusting Proper angle and not affected by parallel light can produce correct shadow. Turning on the parallel light and the extra light at the same time under high configuration makes the projection and illumination of the character normal, and turning off the extra light under the low configuration mode can also illuminate the character correctly.

请参阅图5,本发明实施例中虚拟对象显示装置的另一个实施例包括:Referring to Fig. 5, another embodiment of the virtual object display device in the embodiment of the present invention includes:

获取模块301,用于获取作用于虚拟对象的光源信息,所述光源信息包括与所述虚拟对象平行的光源所产生的平行光数据、以及与所述虚拟对象呈预设角度的光源所产生的额外光数据;An acquisition module 301, configured to acquire light source information acting on a virtual object, the light source information including parallel light data generated by a light source parallel to the virtual object, and parallel light data generated by a light source at a preset angle to the virtual object additional light data;

调整显示模块302,用于利用所述平行光数据和所述额外光数据对所述虚拟对象进行亮度调整、以及利用所述额外光数据生成所述虚拟对象的投影,并对亮度调整后的虚拟对象和所述投影进行显示。The adjustment display module 302 is configured to use the parallel light data and the additional light data to adjust the brightness of the virtual object, and use the additional light data to generate a projection of the virtual object, and to adjust the brightness of the virtual object. The object and the projection are displayed.

具体的,在所述虚拟对象的投影位置设置有投影片;所述调整显示模块302包括投影片调整单元3021,用于:Specifically, a projection sheet is set at the projection position of the virtual object; the adjustment display module 302 includes a projection sheet adjustment unit 3021 for:

利用所述额外光数据调整所述投影片的属性参数,并基于调整属性参数后的投影片,生成所述虚拟对象的投影。The additional light data is used to adjust the attribute parameters of the projection sheet, and the projection of the virtual object is generated based on the projection sheet after the attribute parameters are adjusted.

具体的,所述投影片的混合模式为半透明混合模式,且所述投影片的初始属性设置为透明属性;所述投影片调整单元3021还用于:Specifically, the blending mode of the slide is a translucent blending mode, and the initial attribute of the slide is set to a transparent attribute; the slide adjustment unit 3021 is further configured to:

根据所述额外光数据对应的预设角度,利用预设的投影函数,计算所述额外光数据在所述投影片所处的投影像素;According to the preset angle corresponding to the additional light data, using a preset projection function, calculate the projection pixel where the additional light data is located on the slide;

根据所述额外光数据,调整所述投影像素上的颜色值和透明度。Color values and transparency on the projected pixels are adjusted based on the additional light data.

具体的,所述投影片调整单元3021还用于:Specifically, the slide adjustment unit 3021 is also used for:

根据所述额外光数据,判断呈预设角度作用于所述虚拟对象的光照量是否大于预设数量;According to the additional light data, determine whether the amount of light acting on the virtual object at a preset angle is greater than a preset amount;

若所述光照量大于预设数量,则根据所述额外光数据,计算所述投影像素上的第一颜色值和第一透明度;If the amount of illumination is greater than a preset amount, calculating a first color value and a first transparency on the projected pixel according to the additional light data;

若所述光照量不大于预设数量,则将所述投影像素调整为预设的第二颜色值和预设的第二透明度。If the illumination amount is not greater than a preset amount, adjusting the projected pixels to a preset second color value and a preset second transparency.

具体的,若所述投影片的初始属性设置为非透明属性,所述调整显示模块302还包括隐藏单元3022,用于:Specifically, if the initial attribute of the slide is set to a non-transparent attribute, the adjustment display module 302 also includes a hidden unit 3022, configured to:

获取所述投影片中除了所述投影像素之外的其他非投影像素,并将所述非投影像素从非透明属性调整为透明属性,以将所述非投影像素所在的区域隐藏。Obtaining other non-projected pixels in the projection sheet except the projected pixels, and adjusting the non-transparent property of the non-projected pixels to a transparent property, so as to hide the area where the non-projected pixels are located.

具体的,所述调整显示模块302还包括亮度调整单元3023,用于:Specifically, the adjustment display module 302 also includes a brightness adjustment unit 3023, configured to:

利用所述平行光数据和所述额外光数据,计算在所述虚拟对象表面上的光照信息、以及确定所述虚拟对象表面各区域存在的阴影遮蔽关系;Using the parallel light data and the additional light data, calculate the lighting information on the surface of the virtual object, and determine the shadow shading relationship existing in each area of the virtual object surface;

基于所述光照信息和所述阴影遮蔽关系,调整所述虚拟对象表面上的亮度。Adjusting the brightness on the surface of the virtual object based on the illumination information and the shadow occlusion relationship.

具体的,所述虚拟对象显示装置还包括光源控制模块303,用于:Specifically, the virtual object display device further includes a light source control module 303, configured to:

检测对所述虚拟对象设置的显示性能模式;detecting a display performance mode set for the virtual object;

当检测到对所述虚拟对象设置的显示性能模式为高配模式时,控制所述平行光源发光、以及控制与所述额外光源发光,并作用于所述虚拟对象;When it is detected that the display performance mode set for the virtual object is a high configuration mode, control the parallel light source to emit light and the additional light source to emit light, and act on the virtual object;

当检测到对所述虚拟对象设置的显示性能模式为低配模式时,控制所述平行光源发光,并作用于所述虚拟对象。When it is detected that the display performance mode set for the virtual object is a low configuration mode, control the parallel light source to emit light and act on the virtual object.

上面图4和图5从模块化功能实体的角度对本发明实施例中的虚拟对象显示装置进行详细描述,下面从硬件处理的角度对本发明实施例中虚拟对象显示设备进行详细描述。The above Fig. 4 and Fig. 5 describe the virtual object display device in the embodiment of the present invention in detail from the perspective of modular functional entities, and the following describes the virtual object display device in the embodiment of the present invention in detail from the perspective of hardware processing.

图6是本发明实施例提供的一种虚拟对象显示设备的结构示意图,该虚拟对象显示设备500可因配置或性能不同而产生比较大的差异,可以包括一个或一个以上处理器(central processing units,CPU)510(例如,一个或一个以上处理器)和存储器520,一个或一个以上存储应用程序533或数据532的存储介质530(例如一个或一个以上海量存储设备)。其中,存储器520和存储介质530可以是短暂存储或持久存储。存储在存储介质530的程序可以包括一个或一个以上模块(图示没标出),每个模块可以包括对虚拟对象显示设备500中的一系列指令操作。更进一步地,处理器510可以设置为与存储介质530通信,在虚拟对象显示设备500上执行存储介质530中的一系列指令操作。6 is a schematic structural diagram of a virtual object display device provided by an embodiment of the present invention. The virtual object display device 500 may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units) , CPU) 510 (eg, one or more processors) and memory 520, one or more storage media 530 (eg, one or more mass storage devices) for storing application programs 533 or data 532. Wherein, the memory 520 and the storage medium 530 may be temporary storage or persistent storage. The program stored in the storage medium 530 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the virtual object display device 500 . Furthermore, the processor 510 may be configured to communicate with the storage medium 530 , and execute a series of instruction operations in the storage medium 530 on the virtual object display device 500 .

虚拟对象显示设备500还可以包括一个或一个以上电源540,一个或一个以上有线或无线网络接口550,一个或一个以上输入输出接口560,和/或,一个或一个以上操作系统531,例如Windows Serve,Mac OS X,Unix,Linux,FreeBSD等等。本领域技术人员可以理解,图6示出的虚拟对象显示设备结构并不构成对虚拟对象显示设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。The virtual object display device 500 may also include one or more power sources 540, one or more wired or wireless network interfaces 550, one or more input and output interfaces 560, and/or, one or more operating systems 531, such as Windows Server , Mac OS X, Unix, Linux, FreeBSD, etc. Those skilled in the art can understand that the structure of the virtual object display device shown in FIG. 6 does not constitute a limitation on the virtual object display device, and may include more or less components than those shown in the illustration, or combine certain components, or have different Part placement.

本发明还提供一种虚拟对象显示设备,所述计算机设备包括存储器和处理器,存储器中存储有计算机可读指令,计算机可读指令被处理器执行时,使得处理器执行如下所述的虚拟对象显示方法的步骤:The present invention also provides a virtual object display device. The computer device includes a memory and a processor. Computer-readable instructions are stored in the memory. When the computer-readable instructions are executed by the processor, the processor executes the virtual object as described below. Steps to show method:

获取作用于虚拟对象的光源信息,所述光源信息包括与所述虚拟对象垂直且与地面平行的平行光源所产生的平行光数据、以及与所述虚拟对象呈预设角度的额外光源所产生的额外光数据;Obtain light source information acting on the virtual object, the light source information includes parallel light data generated by a parallel light source perpendicular to the virtual object and parallel to the ground, and parallel light data generated by an additional light source at a preset angle to the virtual object additional light data;

利用所述平行光数据和所述额外光数据对所述虚拟对象进行亮度调整、以及利用所述额外光数据生成所述虚拟对象的投影,并对亮度调整后的虚拟对象和所述投影进行显示。Using the parallel light data and the additional light data to adjust the brightness of the virtual object, and using the additional light data to generate a projection of the virtual object, and display the brightness-adjusted virtual object and the projection .

可选的,所述利用所述额外光数据生成所述虚拟对象的投影包括:Optionally, the generating the projection of the virtual object by using the additional light data includes:

在所述虚拟对象的投影位置设置有投影片;A slide is set at the projection position of the virtual object;

利用所述额外光数据调整所述投影片的属性参数,并基于调整属性参数后的投影片,生成所述虚拟对象的投影。The additional light data is used to adjust the attribute parameters of the projection sheet, and the projection of the virtual object is generated based on the projection sheet after the attribute parameters are adjusted.

可选的,所述利用所述额外光数据调整所述投影片的属性参数包括:Optionally, the adjusting the attribute parameters of the slide by using the additional light data includes:

所述投影片的混合模式为半透明混合模式,且所述投影片的初始属性设置为透明属性;The blending mode of the slide is a translucent blending mode, and the initial attribute of the slide is set to a transparent attribute;

根据所述额外光数据对应的预设角度,利用预设的投影函数,计算所述额外光数据在所述投影片所处的投影像素;According to the preset angle corresponding to the additional light data, using a preset projection function, calculate the projection pixel where the additional light data is located on the slide;

根据所述额外光数据,调整所述投影像素上的颜色值和透明度。Color values and transparency on the projected pixels are adjusted based on the additional light data.

可选的,所述根据所述额外光数据,调整所述投影像素上的颜色值和透明度包括:Optionally, the adjusting the color value and transparency on the projected pixel according to the additional light data includes:

根据所述额外光数据,判断呈预设角度作用于所述虚拟对象的光照量是否大于预设数量;According to the additional light data, determine whether the amount of light acting on the virtual object at a preset angle is greater than a preset amount;

若所述光照量大于预设数量,则根据所述额外光数据,计算所述投影像素上的第一颜色值和第一透明度;If the amount of illumination is greater than a preset amount, calculating a first color value and a first transparency on the projected pixel according to the additional light data;

若所述光照量不大于预设数量,则将所述投影像素调整为预设的第二颜色值和预设的第二透明度。If the illumination amount is not greater than a preset amount, adjusting the projected pixels to a preset second color value and a preset second transparency.

可选的,若所述投影片的初始属性设置为非透明属性,则在所述根据所述额外光数据,调整所述投影像素上的颜色值和透明度之后,还包括:Optionally, if the initial attribute of the projection sheet is set to a non-transparent attribute, after adjusting the color value and transparency of the projected pixel according to the additional light data, the method further includes:

获取所述投影片中除了所述投影像素之外的其他非投影像素,并将所述非投影像素从非透明属性调整为透明属性,以将所述非投影像素所在的区域隐藏。Obtaining other non-projected pixels in the projection sheet except the projected pixels, and adjusting the non-transparent property of the non-projected pixels to a transparent property, so as to hide the area where the non-projected pixels are located.

可选的,所述利用所述平行光数据和所述额外光数据对所述虚拟对象进行亮度调整包括:Optionally, adjusting the brightness of the virtual object by using the parallel light data and the additional light data includes:

利用所述平行光数据和所述额外光数据,计算在所述虚拟对象表面上的光照信息、以及确定所述虚拟对象表面各区域存在的阴影遮蔽关系;Using the parallel light data and the additional light data, calculate the lighting information on the surface of the virtual object, and determine the shadow shading relationship existing in each area of the virtual object surface;

基于所述光照信息和所述阴影遮蔽关系,调整所述虚拟对象表面上的亮度。Adjusting the brightness on the surface of the virtual object based on the illumination information and the shadow occlusion relationship.

可选的,在所述获取作用于虚拟对象的光源信息之前,还包括:Optionally, before the acquisition of light source information acting on the virtual object, the method further includes:

检测对所述虚拟对象设置的显示性能模式;detecting a display performance mode set for the virtual object;

当检测到对所述虚拟对象设置的显示性能模式为高配模式时,控制所述平行光源发光、以及控制与所述额外光源发光,并作用于所述虚拟对象;When it is detected that the display performance mode set for the virtual object is a high configuration mode, control the parallel light source to emit light and the additional light source to emit light, and act on the virtual object;

当检测到对所述虚拟对象设置的显示性能模式为低配模式时,控制所述平行光源发光,并作用于所述虚拟对象。When it is detected that the display performance mode set for the virtual object is a low configuration mode, control the parallel light source to emit light and act on the virtual object.

本发明还提供一种计算机可读存储介质,该计算机可读存储介质可以为非易失性计算机可读存储介质,该计算机可读存储介质也可以为易失性计算机可读存储介质,所述计算机可读存储介质中存储有指令,当所述指令在计算机上运行时,使得计算机执行如下所述的虚拟对象显示方法的步骤:The present invention also provides a computer-readable storage medium. The computer-readable storage medium may be a non-volatile computer-readable storage medium. The computer-readable storage medium may also be a volatile computer-readable storage medium. Instructions are stored in the computer-readable storage medium, and when the instructions are run on the computer, the computer is made to perform the following steps of the virtual object display method:

获取作用于虚拟对象的光源信息,所述光源信息包括与所述虚拟对象垂直且与地面平行的平行光源所产生的平行光数据、以及与所述虚拟对象呈预设角度的额外光源所产生的额外光数据;Obtain light source information acting on the virtual object, the light source information includes parallel light data generated by a parallel light source perpendicular to the virtual object and parallel to the ground, and parallel light data generated by an additional light source at a preset angle to the virtual object additional light data;

利用所述平行光数据和所述额外光数据对所述虚拟对象进行亮度调整、以及利用所述额外光数据生成所述虚拟对象的投影,并对亮度调整后的虚拟对象和所述投影进行显示。Using the parallel light data and the additional light data to adjust the brightness of the virtual object, and using the additional light data to generate a projection of the virtual object, and display the brightness-adjusted virtual object and the projection .

可选的,所述利用所述额外光数据生成所述虚拟对象的投影包括:Optionally, the generating the projection of the virtual object by using the additional light data includes:

在所述虚拟对象的投影位置设置有投影片;A slide is set at the projection position of the virtual object;

利用所述额外光数据调整所述投影片的属性参数,并基于调整属性参数后的投影片,生成所述虚拟对象的投影。The additional light data is used to adjust the attribute parameters of the projection sheet, and the projection of the virtual object is generated based on the projection sheet after the attribute parameters are adjusted.

可选的,所述利用所述额外光数据调整所述投影片的属性参数包括:Optionally, the adjusting the attribute parameters of the slide by using the additional light data includes:

所述投影片的混合模式为半透明混合模式,且所述投影片的初始属性设置为透明属性;The blending mode of the slide is a translucent blending mode, and the initial attribute of the slide is set to a transparent attribute;

根据所述额外光数据对应的预设角度,利用预设的投影函数,计算所述额外光数据在所述投影片所处的投影像素;According to the preset angle corresponding to the additional light data, using a preset projection function, calculate the projection pixel where the additional light data is located on the slide;

根据所述额外光数据,调整所述投影像素上的颜色值和透明度。Color values and transparency on the projected pixels are adjusted based on the additional light data.

可选的,所述根据所述额外光数据,调整所述投影像素上的颜色值和透明度包括:Optionally, the adjusting the color value and transparency on the projected pixel according to the additional light data includes:

根据所述额外光数据,判断呈预设角度作用于所述虚拟对象的光照量是否大于预设数量;According to the additional light data, determine whether the amount of light acting on the virtual object at a preset angle is greater than a preset amount;

若所述光照量大于预设数量,则根据所述额外光数据,计算所述投影像素上的第一颜色值和第一透明度;If the amount of illumination is greater than a preset amount, calculating a first color value and a first transparency on the projected pixel according to the additional light data;

若所述光照量不大于预设数量,则将所述投影像素调整为预设的第二颜色值和预设的第二透明度。If the illumination amount is not greater than a preset amount, adjusting the projected pixels to a preset second color value and a preset second transparency.

可选的,若所述投影片的初始属性设置为非透明属性,则在所述根据所述额外光数据,调整所述投影像素上的颜色值和透明度之后,还包括:Optionally, if the initial attribute of the projection sheet is set to a non-transparent attribute, after adjusting the color value and transparency of the projected pixel according to the additional light data, the method further includes:

获取所述投影片中除了所述投影像素之外的其他非投影像素,并将所述非投影像素从非透明属性调整为透明属性,以将所述非投影像素所在的区域隐藏。Obtaining other non-projected pixels in the projection sheet except the projected pixels, and adjusting the non-transparent property of the non-projected pixels to a transparent property, so as to hide the area where the non-projected pixels are located.

可选的,所述利用所述平行光数据和所述额外光数据对所述虚拟对象进行亮度调整包括:Optionally, adjusting the brightness of the virtual object by using the parallel light data and the additional light data includes:

利用所述平行光数据和所述额外光数据,计算在所述虚拟对象表面上的光照信息、以及确定所述虚拟对象表面各区域存在的阴影遮蔽关系;Using the parallel light data and the additional light data, calculate the lighting information on the surface of the virtual object, and determine the shadow shading relationship existing in each area of the virtual object surface;

基于所述光照信息和所述阴影遮蔽关系,调整所述虚拟对象表面上的亮度。Adjusting the brightness on the surface of the virtual object based on the illumination information and the shadow occlusion relationship.

可选的,在所述获取作用于虚拟对象的光源信息之前,还包括:Optionally, before the acquisition of light source information acting on the virtual object, the method further includes:

检测对所述虚拟对象设置的显示性能模式;detecting a display performance mode set for the virtual object;

当检测到对所述虚拟对象设置的显示性能模式为高配模式时,控制所述平行光源发光、以及控制与所述额外光源发光,并作用于所述虚拟对象;When it is detected that the display performance mode set for the virtual object is a high configuration mode, control the parallel light source to emit light and the additional light source to emit light, and act on the virtual object;

当检测到对所述虚拟对象设置的显示性能模式为低配模式时,控制所述平行光源发光,并作用于所述虚拟对象。When it is detected that the display performance mode set for the virtual object is a low configuration mode, control the parallel light source to emit light and act on the virtual object.

所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and brevity of the description, the specific working process of the above-described system, device and unit can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here.

所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read-only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated unit is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the essence of the technical solution of the present invention 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 to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the method described in each embodiment of the present invention. 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 various media that can store program codes. .

以上所述,以上实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围。As mentioned above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: it can still understand the foregoing The technical solutions recorded in each embodiment are modified, or some of the technical features are replaced equivalently; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the various embodiments of the present invention.

Claims (10)

1. A virtual object display method, characterized in that the virtual object display method comprises:
acquiring light source information acting on a virtual object, wherein the light source information comprises parallel light data generated by a parallel light source which is perpendicular to the virtual object and parallel to the ground and additional light data generated by an additional light source which forms a preset angle with the virtual object;
and performing brightness adjustment on the virtual object by using the parallel light data and the extra light data, generating projection of the virtual object by using the extra light data, and displaying the virtual object and the projection after brightness adjustment.
2. The virtual object display method of claim 1, wherein the generating a projection of the virtual object using the additional light data comprises:
a projection film is arranged at the projection position of the virtual object;
and adjusting the attribute parameters of the projection film by using the extra light data, and generating the projection of the virtual object based on the projection film after adjusting the attribute parameters.
3. The virtual object display method according to claim 2, wherein the adjusting the attribute parameter of the projection film using the additional light data comprises:
the mixed mode of the projection film is a semitransparent mixed mode, and the initial attribute of the projection film is set as a transparent attribute;
calculating projection pixels of the extra light data on the projection film by using a preset projection function according to a preset angle corresponding to the extra light data;
and adjusting the color value and the transparency on the projection pixel according to the extra light data.
4. A virtual object display method as recited in claim 3, wherein said adjusting color values and transparency on said projected pixels based on said additional light data comprises:
judging whether the illumination quantity acting on the virtual object at a preset angle is larger than a preset quantity or not according to the extra light data;
if the illumination quantity is larger than the preset quantity, calculating a first color value and a first transparency on the projection pixel according to the extra light data;
and if the illumination quantity is not greater than the preset quantity, adjusting the projection pixels into a preset second color value and a preset second transparency.
5. The virtual object display method according to claim 3 or 4, further comprising, after said adjusting the color value and transparency on the projection pixel according to the additional light data, if the initial attribute of the projection film is set to a non-transparent attribute:
and acquiring other non-projection pixels except the projection pixels in the projection film, and adjusting the non-projection pixels from non-transparent attributes to transparent attributes so as to hide the area where the non-projection pixels are located.
6. The virtual object display method according to any one of claims 1 to 4, wherein the brightness adjustment of the virtual object using the parallel light data and the additional light data includes:
calculating illumination information on the surface of the virtual object and determining a shadow masking relation existing in each area of the surface of the virtual object by using the parallel light data and the extra light data;
and adjusting the brightness on the surface of the virtual object based on the illumination information and the shadow masking relation.
7. The virtual object display method according to any one of claims 1 to 4, further comprising, before the acquiring the light source information acting on the virtual object:
detecting a display performance mode set for the virtual object;
when the display performance mode set for the virtual object is detected to be a high-configuration mode, controlling the parallel light source to emit light, controlling the additional light source to emit light, and acting on the virtual object;
when the display performance mode set for the virtual object is detected to be the low-configuration mode, the parallel light source is controlled to emit light and act on the virtual object.
8. A virtual object display device, characterized in that the virtual object display device comprises:
the device comprises an acquisition module, a display module and a display module, wherein the acquisition module is used for acquiring light source information acting on a virtual object, and the light source information comprises parallel light data generated by a light source parallel to the virtual object and extra light data generated by a light source at a preset angle with the virtual object;
and the adjustment display module is used for adjusting the brightness of the virtual object by utilizing the parallel light data and the extra light data, generating the projection of the virtual object by utilizing the extra light data, and displaying the virtual object with the brightness adjusted and the projection.
9. A virtual object display device, the virtual object display device comprising: a memory and at least one processor, the memory having instructions stored therein;
the at least one processor invokes the instructions in the memory to cause the virtual object display device to perform the steps of the virtual object display method of any one of claims 1-7.
10. A computer readable storage medium having instructions stored thereon, which when executed by a processor, implement the steps of the virtual object display method of any of claims 1-7.
CN202310333482.1A 2023-03-28 2023-03-28 Virtual object display method, device, equipment and storage medium Pending CN116531749A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310333482.1A CN116531749A (en) 2023-03-28 2023-03-28 Virtual object display method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310333482.1A CN116531749A (en) 2023-03-28 2023-03-28 Virtual object display method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116531749A true CN116531749A (en) 2023-08-04

Family

ID=87456707

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310333482.1A Pending CN116531749A (en) 2023-03-28 2023-03-28 Virtual object display method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116531749A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH1125286A (en) * 1997-07-04 1999-01-29 Mitsubishi Electric Corp Shadow processing method
US20100134495A1 (en) * 2008-11-28 2010-06-03 Canon Kabushiki Kaisha Mixed reality presentation system and brightness adjustment method of virtual light source
US20140267270A1 (en) * 2013-03-12 2014-09-18 Autodesk, Inc. Shadow rendering in a 3d scene based on physical light sources
KR20160006087A (en) * 2014-07-08 2016-01-18 삼성전자주식회사 Device and method to display object with visual effect
CN105278905A (en) * 2014-07-08 2016-01-27 三星电子株式会社 Device and method to display object with visual effect
US20170193690A1 (en) * 2016-01-04 2017-07-06 Samsung Electronics Co., Ltd. 3d rendering method and apparatus

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH1125286A (en) * 1997-07-04 1999-01-29 Mitsubishi Electric Corp Shadow processing method
US20100134495A1 (en) * 2008-11-28 2010-06-03 Canon Kabushiki Kaisha Mixed reality presentation system and brightness adjustment method of virtual light source
US20140267270A1 (en) * 2013-03-12 2014-09-18 Autodesk, Inc. Shadow rendering in a 3d scene based on physical light sources
KR20160006087A (en) * 2014-07-08 2016-01-18 삼성전자주식회사 Device and method to display object with visual effect
CN105278905A (en) * 2014-07-08 2016-01-27 三星电子株式会社 Device and method to display object with visual effect
US20170193690A1 (en) * 2016-01-04 2017-07-06 Samsung Electronics Co., Ltd. 3d rendering method and apparatus

Similar Documents

Publication Publication Date Title
CA2282637C (en) Method for rendering shadows on a graphical display
CN102396003B (en) For adding the method for shade to the object in computer graphical
US8081190B2 (en) System and method for optimizing a graphics intensive software program for the user&#39;s graphics hardware
US7164419B2 (en) System and method for optimizing a graphics intensive software program for the user&#39;s graphics hardware
US20070046665A1 (en) Apparatus and program for image generation
US9183654B2 (en) Live editing and integrated control of image-based lighting of 3D models
EP1159713A1 (en) Method and apparatus for processing images
CN111340684B (en) Method and device for processing graphics in game
US20150042654A1 (en) Point and click lighting for image based lighting surfaces
CN114494570A (en) Three-dimensional model rendering method and device, storage medium and computer equipment
CN106600712A (en) Texture replacing method based on two dimension image
RU2422902C2 (en) Two-dimensional/three-dimensional combined display
CN116310056A (en) Rendering method, rendering device, equipment and medium for three-dimensional model
US7286129B1 (en) Two-sided stencil testing system and method
US20100207943A1 (en) Modular shader architecture and method for computerized image rendering
WO2023116396A1 (en) Rendering display method and apparatus, computer device, and storage medium
CN114392551A (en) Display control method, device and electronic device for virtual object
CN116531749A (en) Virtual object display method, device, equipment and storage medium
JPH09330422A (en) Three-dimensional graphic display method and display system
JP7328651B2 (en) Generation device, generation method and generation program
Ramos Unreal Engine 5 Shaders and Effects Cookbook: Over 50 recipes to help you create materials and utilize advanced shading techniques
Shreiner et al. An interactive introduction to opengl programming
JP4493401B2 (en) 3D computer graphic display system and program
TWI410890B (en) Method and apparatus emulating branch structure
Buck Learning OpenGL ES for iOS: A hands-on guide to modern 3d graphics programming

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