CN115019020A - Model shadow generation method, device, readable storage medium and electronic device - Google Patents
Model shadow generation method, device, readable storage medium and electronic device Download PDFInfo
- Publication number
- CN115019020A CN115019020A CN202210623032.1A CN202210623032A CN115019020A CN 115019020 A CN115019020 A CN 115019020A CN 202210623032 A CN202210623032 A CN 202210623032A CN 115019020 A CN115019020 A CN 115019020A
- Authority
- CN
- China
- Prior art keywords
- model
- projection panel
- light source
- depth
- depth value
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T19/00—Manipulating 3D models or images for computer graphics
- G06T19/20—Editing of 3D images, e.g. changing shapes or colours, aligning objects or positioning parts
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T15/00—3D [Three Dimensional] image rendering
- G06T15/005—General purpose rendering architectures
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T15/00—3D [Three Dimensional] image rendering
- G06T15/50—Lighting effects
- G06T15/60—Shadow generation
Landscapes
- Engineering & Computer Science (AREA)
- Computer Graphics (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Architecture (AREA)
- Computer Hardware Design (AREA)
- General Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Processing Or Creating Images (AREA)
Abstract
Description
技术领域technical field
本公开涉及虚拟显示技术领域,具体而言,涉及一种模型阴影生成方法、模型阴影生成装置、计算机可读存储介质及电子设备。The present disclosure relates to the field of virtual display technology, and in particular, to a model shadow generation method, a model shadow generation device, a computer-readable storage medium, and an electronic device.
背景技术Background technique
随着计算机技术的发展,虚拟场景在学习、生活和工作各方面都逐渐发挥其作用。人们不断追求虚拟场景的真实性,提高真实性有多种方式,例如可以为虚拟场景中的模型添加阴影使得模型立体感更强,场景更加真实。With the development of computer technology, virtual scenes have gradually played their role in all aspects of study, life and work. People are constantly pursuing the authenticity of virtual scenes, and there are many ways to improve the authenticity. For example, shadows can be added to the models in the virtual scenes to make the models more three-dimensional and the scenes more realistic.
目前的方案,若要对一个模型进行阴影生成处理,需要场景存在其他模型去承载阴影,才能将投影呈现,导致阴影生成受限;并且,场景中的模型较多时,还会造成较大的性能压力,影响渲染效率和渲染效果。In the current solution, to perform shadow generation processing on a model, other models in the scene are required to carry shadows before the projection can be presented, resulting in limited shadow generation; moreover, when there are many models in the scene, it will also cause greater performance. Pressure, which affects rendering efficiency and rendering effect.
需要说明的是,在上述背景技术部分公开的信息仅用于加强对本公开的背景的理解,因此可以包括不构成对本领域普通技术人员已知的现有技术的信息。It should be noted that the information disclosed in the above Background section is only for enhancement of understanding of the background of the present disclosure, and therefore may contain information that does not form the prior art that is already known to a person of ordinary skill in the art.
发明内容SUMMARY OF THE INVENTION
本公开实施例的目的在于提供一种模型阴影生成方法、模型阴影生成装置、计算机可读存储介质及电子设备。通过在模型旁生成一投影面板,将投影面板的顶点位置转换到光源空间;采集模型在光源空间中的深度图,采集投影面板在光源空间下的深度值;对比深度图的第二深度值和投影面板第一深度值的大小,根据对比结果得到阴影。可以降低阴影生成受限制程度,降低阴影生成的性能压力并提高计算效率。The purpose of the embodiments of the present disclosure is to provide a model shadow generation method, a model shadow generation device, a computer-readable storage medium, and an electronic device. By generating a projection panel next to the model, the vertex position of the projection panel is converted to the light source space; the depth map of the model in the light source space is collected, and the depth value of the projection panel in the light source space is collected; the second depth value of the depth map and The size of the first depth value of the projection panel, and the shadow is obtained according to the comparison result. It can reduce the throttling degree of shadow generation, reduce the performance pressure of shadow generation and improve computational efficiency.
本公开实施例的第一方面提供了一种模型阴影生成方法,所述方法包括:A first aspect of the embodiments of the present disclosure provides a model shadow generation method, the method comprising:
在模型旁生成一投影面板,将所述投影面板的顶点位置转换到光源空间;A projection panel is generated next to the model, and the vertex positions of the projection panel are converted into the light source space;
采集所述模型在所述光源空间中的深度图,采集所述投影面板的多个顶点位置在光源空间下的第一深度值,其中,所述深度图包含所述模型的多个顶点位置在所述光源空间中的第二深度值;Collect a depth map of the model in the light source space, and collect first depth values of multiple vertex positions of the projection panel in the light source space, wherein the depth map includes multiple vertex positions of the model in a second depth value in the light source space;
对比所述深度图的所述第二深度值和所述投影面板的所述第一深度值的大小,根据对比结果将所述投影面板区分为第一部分和第二部分;comparing the magnitudes of the second depth value of the depth map and the first depth value of the projection panel, and distinguishing the projection panel into a first part and a second part according to the comparison result;
将包括所述第一部分和所述第二部分的所述投影面板作为阴影。The projection panel including the first part and the second part is used as a shadow.
在本公开的一种示例性实施例中,所述将所述投影面板的顶点位置转换到光源空间的步骤,包括:In an exemplary embodiment of the present disclosure, the step of converting the vertex position of the projection panel to the light source space includes:
将投影面板的顶点位置从模型空间转到世界空间,然后从所述世界空间转到光源空间。Converts the vertex positions of the projection panel from model space to world space, and then from said world space to light space.
在本公开的一种示例性实施例中,所述根据对比结果将所述投影面板区分为第一部分和第二部分的步骤,包括:In an exemplary embodiment of the present disclosure, the step of distinguishing the projection panel into a first part and a second part according to a comparison result includes:
当所述深度图的所述第二深度值小于所述投影面板的所述第一深度值,则以第一状态进行显示;When the second depth value of the depth map is smaller than the first depth value of the projection panel, display in a first state;
当所述深度图的所述第二深度值大于所述投影面板的所述第一深度值,则以第二状态进行显示;When the second depth value of the depth map is greater than the first depth value of the projection panel, display in a second state;
将以所述投影面板中以第一状态进行显示的部分作为第一部分,将所述投影面板中以第二状态进行显示的部分作为第二部分。The portion of the projection panel that is displayed in the first state is referred to as the first portion, and the portion of the projection panel that is displayed in the second state is referred to as the second portion.
在本公开的一种示例性实施例中,在所述将包括所述第一部分和所述第二部分的所述投影面板作为阴影的步骤之后,所述方法还包括:In an exemplary embodiment of the present disclosure, after the step of using the projection panel including the first portion and the second portion as a shadow, the method further includes:
剔除所述第二部分并保留第一部分,将所述第一部分作为最终阴影结果。The second part is culled and the first part is kept as the final shadow result.
在本公开的一种示例性实施例中,所述在模型旁生成一投影面板的步骤,包括:In an exemplary embodiment of the present disclosure, the step of generating a projection panel beside the model includes:
在模型下方生成一水平放置的投影面板;Generate a horizontally placed projection panel below the model;
其中,模型上方为所述模型指向所述光源空间的光源位置的第一方向,所述模型下方为所述第一方向的反方向。Wherein, the top of the model is the first direction of the light source position of the model pointing to the light source space, and the bottom of the model is the opposite direction of the first direction.
在本公开的一种示例性实施例中,所述方法还包括:In an exemplary embodiment of the present disclosure, the method further includes:
在所述模型后方生成一垂直于水平方向的背景面板,所述背景面板与所述投影面板垂直,用以承载其他渲染内容;A background panel perpendicular to the horizontal direction is generated behind the model, and the background panel is perpendicular to the projection panel for carrying other rendering contents;
其中,模型前方为所述模型指向所述光源空间中虚拟相机的第二方向,所述模型后方为所述第二方向的反方向。Wherein, the front of the model is the second direction in which the model points to the virtual camera in the light source space, and the rear of the model is the opposite direction of the second direction.
在本公开的一种示例性实施例中,对比所述深度图的第二深度值和所述投影面板的所述第一深度值的大小的步骤,包括:In an exemplary embodiment of the present disclosure, the step of comparing the magnitude of the second depth value of the depth map and the first depth value of the projection panel includes:
将在所述光源空间下构建的坐标系中具有相同坐标的一个第二深度值和一个第一深度值作为一个对比组;Taking a second depth value and a first depth value with the same coordinates in the coordinate system constructed under the light source space as a comparison group;
根据所述深度图的多个第二深度值与所述投影面板的多个第一深度值,确定多个对比组分别进行大小对比。According to a plurality of second depth values of the depth map and a plurality of first depth values of the projection panel, a plurality of comparison groups are determined for size comparison respectively.
根据本公开实施例的第二方面,提供一种模型阴影生成装置,所述装置包括:According to a second aspect of the embodiments of the present disclosure, there is provided an apparatus for generating model shadows, the apparatus comprising:
投影面板模块,用于在模型旁生成一投影面板,将所述投影面板的顶点位置转换到光源空间;a projection panel module, used for generating a projection panel beside the model, and converting the vertex position of the projection panel to the light source space;
深度采集模块,用于采集所述模型在所述光源空间中的深度图,采集所述投影面板的多个顶点位置在光源空间下的第一深度值,其中,所述深度图包含所述模型的多个顶点位置在所述光源空间中的第二深度值;a depth acquisition module, configured to collect a depth map of the model in the light source space, and collect first depth values of multiple vertex positions of the projection panel in the light source space, wherein the depth map includes the model The second depth value of the plurality of vertex positions in the light source space;
深度对比模块,用于对比所述深度图的所述第二深度值和所述投影面板的所述第一深度值的大小,根据对比结果将所述投影面板区分为第一部分和第二部分;a depth comparison module, configured to compare the magnitudes of the second depth value of the depth map and the first depth value of the projection panel, and to distinguish the projection panel into a first part and a second part according to the comparison result;
阴影结果模块,用于将包括所述第一部分和所述第二部分的所述投影面板作为阴影。A shadow result module, configured to use the projection panel including the first part and the second part as a shadow.
在本公开的一种示例性实施例中,所述投影面板模块,用于将投影面板的顶点位置从模型空间转到世界空间,然后从所述世界空间转到光源空间。In an exemplary embodiment of the present disclosure, the projection panel module is configured to convert the vertex positions of the projection panel from the model space to the world space, and then from the world space to the light source space.
在本公开的一种示例性实施例中,所述深度对比模块,用于当所述深度图的所述第二深度值小于所述投影面板的所述第一深度值,则以第一状态进行显示;In an exemplary embodiment of the present disclosure, the depth comparison module is configured to enter a first state when the second depth value of the depth map is smaller than the first depth value of the projection panel to display;
当所述深度图的所述第二深度值大于所述投影面板的所述第一深度值,则以第二状态进行显示;When the second depth value of the depth map is greater than the first depth value of the projection panel, display in a second state;
将以所述投影面板中以第一状态进行显示的部分作为第一部分,将所述投影面板中以第二状态进行显示的部分作为第二部分。The portion of the projection panel that is displayed in the first state is referred to as the first portion, and the portion of the projection panel that is displayed in the second state is referred to as the second portion.
在本公开的一种示例性实施例中,所述装置还包括:In an exemplary embodiment of the present disclosure, the apparatus further includes:
剔除模块,用于在所述将包括所述第一部分和所述第二部分的所述投影面板作为阴影的步骤之后,剔除所述第二部分并保留第一部分,将所述第一部分作为最终阴影结果。a culling module for culling the second part and retaining the first part after the step of using the projection panel including the first part and the second part as a shadow, and using the first part as a final shadow result.
在本公开的一种示例性实施例中,所述投影面板模块,用于在模型下方生成一水平放置的投影面板;In an exemplary embodiment of the present disclosure, the projection panel module is used to generate a horizontally placed projection panel under the model;
其中,模型上方为所述模型指向所述光源空间的光源位置的第一方向,所述模型下方为所述第一方向的反方向。Wherein, the top of the model is the first direction of the light source position of the model pointing to the light source space, and the bottom of the model is the opposite direction of the first direction.
在本公开的一种示例性实施例中,所述装置还包括:In an exemplary embodiment of the present disclosure, the apparatus further includes:
背景面板模块,用于在所述模型后方生成一垂直于水平方向的背景面板,所述背景面板与所述投影面板垂直,用以承载其他渲染内容;The background panel module is used to generate a background panel perpendicular to the horizontal direction behind the model, and the background panel is perpendicular to the projection panel for carrying other rendering contents;
其中,模型前方为所述模型指向所述光源空间中虚拟相机的第二方向,所述模型后方为所述第二方向的反方向。Wherein, the front of the model is the second direction in which the model points to the virtual camera in the light source space, and the rear of the model is the opposite direction of the second direction.
在本公开的一种示例性实施例中,所述深度对比模块,用于将在所述光源空间下构建的坐标系中具有相同坐标的一个第二深度值和一个第一深度值作为一个对比组;In an exemplary embodiment of the present disclosure, the depth comparison module is configured to use a second depth value and a first depth value with the same coordinates in the coordinate system constructed in the light source space as a comparison Group;
根据所述深度图的多个第二深度值与所述投影面板的多个第一深度值,确定多个对比组分别进行大小对比。According to a plurality of second depth values of the depth map and a plurality of first depth values of the projection panel, a plurality of comparison groups are determined for size comparison respectively.
根据本公开实施例的第三方面,提供了一种计算机可读存储介质,其上存储有计算机程序,程序被处理器执行时实现如上述实施例中第一方面所述的模型阴影生成方法。According to a third aspect of the embodiments of the present disclosure, there is provided a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, implements the method for generating model shadows according to the first aspect of the foregoing embodiments.
根据本公开实施例的第四方面,提供了一种电子设备,包括:一个或多个处理器;存储装置,用于存储一个或多个程序,当一个或多个程序被一个或多个处理器执行时,使得一个或多个处理器实现如上述实施例中第一方面所述的模型阴影生成方法。According to a fourth aspect of the embodiments of the present disclosure, there is provided an electronic device, comprising: one or more processors; a storage device for storing one or more programs, when the one or more programs are processed by one or more When the processor is executed, one or more processors are made to implement the model shadow generation method described in the first aspect of the above embodiment.
根据本公开的第五方面,提供一种计算机程序产品或计算机程序,该计算机程序产品或计算机程序包括计算机指令,该计算机指令存储在计算机可读存储介质中。计算机设备的处理器从计算机可读存储介质读取该计算机指令,处理器执行该计算机指令,使得该计算机设备执行上述的各种可选实现方式中提供的方法。According to a fifth aspect of the present disclosure, there is provided a computer program product or computer program comprising computer instructions stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to cause the computer device to perform the methods provided in the various optional implementations described above.
本公开实施例提供的技术方案可以包括以下有益效果:The technical solutions provided by the embodiments of the present disclosure may include the following beneficial effects:
在本公开的一些实施例所提供的技术方案中,可以通过在模型旁生成一投影面板,将投影面板的顶点位置转换到光源空间;采集模型在所述光源空间中的深度图,采集投影面板在光源空间下的深度值;对比该两个深度值,根据对比结果将投影面板区分为第一部分和第二部分以得到阴影。实施本公开的实施例,一方面,通过生成投影面板,从而在生成阴影时不再需要场景中还要包括更多的其他模型例如地面模型,降低了性能压力;另一方面,通过投影面板来获得阴影,不再需要其他模型,能够使得阴影生成的限制更少,不再需要做场景中各模型资源间的阴影计算,提高了计算效率和阴影可控性。In the technical solutions provided by some embodiments of the present disclosure, a projection panel can be generated beside the model to convert the vertex position of the projection panel to the light source space; the depth map of the model in the light source space is collected, and the projection panel is collected The depth value in the light source space; compare the two depth values, and divide the projection panel into the first part and the second part according to the comparison result to obtain the shadow. Implementing the embodiments of the present disclosure, on the one hand, by generating a projection panel, it is no longer necessary to include more other models, such as ground models, in the scene when generating shadows, which reduces performance pressure; To obtain shadows, other models are no longer required, which can make shadow generation less restrictive, and no longer need to perform shadow calculations between model resources in the scene, which improves computational efficiency and shadow controllability.
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本公开。It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure.
附图说明Description of drawings
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本公开的实施例,并与说明书一起用于解释本公开的原理。显而易见地,下面描述中的附图仅仅是本公开的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description serve to explain the principles of the disclosure. Obviously, the drawings in the following description are only some embodiments of the present disclosure, and for those of ordinary skill in the art, other drawings can also be obtained from these drawings without creative effort.
图1示意性示出了可以应用本公开实施例的一种模型阴影生成方法及模型阴影生成装置的示例性终端设备的示意图;FIG. 1 schematically shows a schematic diagram of an exemplary terminal device to which a model shadow generation method and a model shadow generation apparatus according to an embodiment of the present disclosure can be applied;
图2示意性示出了根据本公开的一个实施例的模型阴影生成方法流程图;FIG. 2 schematically shows a flowchart of a model shadow generation method according to an embodiment of the present disclosure;
图3示意性示出了根据本公开的一个实施例中深度值对比的界面示意图;FIG. 3 schematically shows a schematic interface diagram of depth value comparison according to an embodiment of the present disclosure;
图4示意性示出了根据本公开的一个实施例中模型、背景面板和投影面板的界面示意图;FIG. 4 schematically shows a schematic interface diagram of a model, a background panel and a projection panel according to an embodiment of the present disclosure;
图5示意性示出了根据本公开的一个实施例中的模型阴影生成装置的结构框图;FIG. 5 schematically shows a structural block diagram of a model shadow generating apparatus according to an embodiment of the present disclosure;
图6示意性示出了适于用来实现本公开实施例的终端设备的计算机系统的结构示意图。FIG. 6 schematically shows a schematic structural diagram of a computer system suitable for implementing a terminal device according to an embodiment of the present disclosure.
具体实施方式Detailed ways
现在将参考附图更全面地描述示例实施方式。然而,示例实施方式能够以多种形式实施,且不应被理解为限于在此阐述的范例;相反,提供这些实施方式使得本公开将更加全面和完整,并将示例实施方式的构思全面地传达给本领域的技术人员。所描述的特征、结构或特性可以以任何合适的方式结合在一个或更多实施方式中。在下面的描述中,提供许多具体细节从而给出对本公开的实施方式的充分理解。然而,本领域技术人员将意识到,可以实践本公开的技术方案而省略所述特定细节中的一个或更多,或者可以采用其它的方法、组元、装置、步骤等。在其它情况下,不详细示出或描述公知技术方案以避免喧宾夺主而使得本公开的各方面变得模糊。Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments, however, can be embodied in various forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided in order to give a thorough understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced without one or more of the specific details, or other methods, components, devices, steps, etc. may be employed. In other instances, well-known solutions have not been shown or described in detail to avoid obscuring aspects of the present disclosure.
此外,附图仅为本公开的示意性图解,并非一定是按比例绘制。图中相同的附图标记表示相同或类似的部分,因而将省略对它们的重复描述。附图中所示的一些方框图是功能实体,不一定必须与物理或逻辑上独立的实体相对应。可以采用软件形式来实现这些功能实体,或在一个或多个硬件模块或集成电路中实现这些功能实体,或在不同网络和/或处理器装置和/或微控制器装置中实现这些功能实体。Furthermore, the drawings are merely schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus their repeated descriptions will be omitted. Some of the block diagrams shown in the figures are functional entities that do not necessarily necessarily correspond to physically or logically separate entities. These functional entities may be implemented in software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
图1示出了可以应用本公开实施例的一种模型阴影生成方法及模型阴影生成装置的示例性终端设备的示意图。FIG. 1 shows a schematic diagram of an exemplary terminal device to which a model shadow generation method and a model shadow generation apparatus according to an embodiment of the present disclosure can be applied.
如图1所示,终端设备可以包括终端设备101、102、103中的一个或多个。终端设备101、102、103可以是具有显示屏的各种电子设备,包括但不限于台式计算机、便携式计算机、智能手机和平板电脑等等。As shown in FIG. 1 , the terminal device may include one or more of the
附图中的流程图和框图,图示了按照本公开各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,上述模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图或流程图中的每个方框、以及框图或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。The flowchart and block diagrams in the Figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code that contains one or more logical functions for implementing the specified functions executable instructions. It should also be noted that, in some alternative implementations, the functions noted in the blocks may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It is also noted that each block of the block diagrams or flowchart illustrations, and combinations of blocks in the block diagrams or flowchart illustrations, can be implemented in special purpose hardware-based systems that perform the specified functions or operations, or can be implemented using A combination of dedicated hardware and computer instructions is implemented.
描述于本公开实施例中所涉及到的单元可以通过软件的方式实现,也可以通过硬件的方式来实现,所描述的单元也可以设置在处理器中。其中,这些单元的名称在某种情况下并不构成对该单元本身的限定。The units involved in the embodiments of the present disclosure may be implemented in software or hardware, and the described units may also be provided in a processor. Among them, the names of these units do not constitute a limitation on the unit itself under certain circumstances.
作为另一方面,本公开还提供了一种计算机可读存储介质。该计算机可读存储介质可以是上述实施例中描述的终端设备中所包含的;也可以是单独存在,而未装配入该终端设备中。上述计算机可读存储介质承载有一个或者多个程序,当上述一个或者多个程序被一个该终端设备执行时,使得该终端设备实现如下述实施例中所述的方法。例如,所述的终端设备可以实现如图2所示的各个步骤等。As another aspect, the present disclosure also provides a computer-readable storage medium. The computer-readable storage medium may be included in the terminal device described in the above embodiments; or may exist alone without being assembled into the terminal device. The above-mentioned computer-readable storage medium carries one or more programs, and when the above-mentioned one or more programs are executed by a terminal device, the terminal device can implement the methods described in the following embodiments. For example, the terminal device can implement the steps shown in FIG. 2 and the like.
本公开的示例性实施例中的模型位于虚拟场景中,场景可以是计算机、手机、平板电脑等智能终端设备通过数字化通讯技术勾勒出的数字化场景,数字化场景可以是在智能终端设备的显示屏上,也可以是投射到其它显示设备上。该虚拟场景可以包括房屋、楼宇、园林、桥梁、水池等建筑物或构筑物,还可以包括山地、河流、湖泊等自然景观以及工具、生物等任意的虚拟物品,本示例性实施例对此不做特殊限定。The model in the exemplary embodiment of the present disclosure is located in a virtual scene. The scene may be a digital scene outlined by intelligent terminal devices such as computers, mobile phones, and tablet computers through digital communication technology. The digital scene may be displayed on the display screen of the intelligent terminal device. , or projected to other display devices. The virtual scene may include buildings or structures such as houses, buildings, gardens, bridges, pools, etc., and may also include natural landscapes such as mountains, rivers, lakes, and any virtual items such as tools and creatures, which are not done in this exemplary embodiment. Special restrictions.
本示例实施方式提供了一种模型阴影生成方法,参考图2所示,该模型阴影生成方法可以包括以下步骤:This example embodiment provides a model shadow generation method. Referring to FIG. 2 , the model shadow generation method may include the following steps:
步骤S210、在模型旁生成一投影面板,将所述投影面板的顶点位置转换到光源空间。Step S210 , generating a projection panel beside the model, and converting the vertex position of the projection panel to the light source space.
步骤S220、采集所述模型在所述光源空间中的深度图,采集所述投影面板的多个顶点位置在光源空间下的第一深度值,其中,所述深度图包含所述模型的多个顶点位置在所述光源空间中的第二深度值。Step S220: Collect a depth map of the model in the light source space, and collect first depth values of multiple vertex positions of the projection panel in the light source space, wherein the depth map includes multiple The second depth value of the vertex position in the light source space.
步骤S230、对比所述深度图的所述第二深度值和所述投影面板的所述第一深度值的大小,根据对比结果将所述投影面板区分为第一部分和第二部分。Step S230 , comparing the magnitudes of the second depth value of the depth map and the first depth value of the projection panel, and distinguishing the projection panel into a first part and a second part according to the comparison result.
步骤S240、将包括所述第一部分和所述第二部分的所述投影面板作为阴影。Step S240, using the projection panel including the first part and the second part as a shadow.
实施图3所示的模型阴影生成方法,可以通过在模型旁生成一投影面板,将投影面板的顶点位置转换到光源空间;采集模型在所述光源空间中的深度图,采集投影面板在光源空间下的深度值;对比该两个深度值,根据对比结果将投影面板区分为第一部分和第二部分以得到阴影。实施本公开的实施例,一方面,通过生成投影面板,从而在生成阴影时不再需要场景中还要包括更多的其他承载模型例如地面模型,降低了渲染性能压力,不再需要做场景中各模型资源的计算,提高了计算效率;另一方面,通过投影面板来获得阴影,不再需要其他模型,能够使得阴影生成的限制更少,灵活度更高。To implement the model shadow generation method shown in FIG. 3, a projection panel can be generated beside the model to convert the vertex position of the projection panel to the light source space; the depth map of the model in the light source space is collected, and the projection panel is collected in the light source space. The depth value below; compare the two depth values, and divide the projection panel into the first part and the second part according to the comparison result to get the shadow. Implementing the embodiments of the present disclosure, on the one hand, by generating a projection panel, it is no longer necessary to include more other bearing models such as ground models in the scene when generating shadows, which reduces the pressure on rendering performance, and no longer needs to be done in the scene. The calculation of each model resource improves the calculation efficiency; on the other hand, obtaining shadows through the projection panel eliminates the need for other models, making shadow generation less restrictive and more flexible.
下面,对于本示例实施方式的上述步骤进行更加详细的说明。Hereinafter, the above steps of the present exemplary embodiment will be described in more detail.
在步骤S210中,在模型旁生成一投影面板,将所述投影面板的顶点位置转换到光源空间。In step S210, a projection panel is generated beside the model, and the vertex positions of the projection panel are converted into the light source space.
光源空间是指以灯光或其他光源为原点构建的三维空间。可以是通过引擎矩阵来将投影面板的顶点位置转换到光源空间,利用C#脚本把物体的Transform信息传入Shader,然后根据这些信息手动构建模型转光源空间的矩阵。The light source space refers to the three-dimensional space constructed with the light or other light source as the origin. You can convert the vertex position of the projection panel to the light source space through the engine matrix, use the C# script to pass the Transform information of the object into the Shader, and then manually construct the matrix of the model to the light source space based on this information.
在本公开实施例中,投影面板本身可以是一个模型。在模型旁生成投影面板,可以是在模型的任意相对方向生成,例如在模型上方或下方。举例而言,当模型是一个人物模型,则可以在模型的脚下生成投影面板模型,该投影面板模型只是用于承载阴影,渲染量小于实际的地面模型或地板模型。In embodiments of the present disclosure, the projection panel itself may be a model. Generate projection panels next to the model, either in any relative direction to the model, such as above or below the model. For example, when the model is a character model, a projection panel model can be generated at the foot of the model, the projection panel model is only used to carry shadows, and the rendering amount is smaller than the actual ground model or floor model.
在一种实施例中,模型可以没有类似于人物模型的方向特征,;iru人物模型的头部以上就是上方,脚步以下就是下方。当模型为球形,可以根据从球形模型指向光源空间中的光源的方向作为模型上方;也可以进一步的,取该方向在垂直方向的分量作为模型的上方。In one embodiment, the model may not have directional features similar to the character model; above the head of the iru character model is above, and below the footsteps is below. When the model is spherical, the direction from the spherical model to the light source in the light source space can be used as the upper part of the model; further, the vertical component of this direction can be taken as the upper part of the model.
在步骤S220中,采集所述模型在所述光源空间中的深度图,采集所述投影面板的多个顶点位置在光源空间下的第一深度值,其中,所述深度图包含所述模型的多个顶点位置在所述光源空间中的第二深度值。In step S220, a depth map of the model in the light source space is collected, and first depth values of multiple vertex positions of the projection panel in the light source space are collected, wherein the depth map includes the depth map of the model. a second depth value of the plurality of vertex positions in the light source space.
在本公开实施例中,深度图像(depth image)也被称为距离影像(range image),是指将从图像采集器或虚拟相机到场景中各点的距离(深度)作为像素值的图像,可以反映物体表面的几何形状。In this embodiment of the present disclosure, a depth image is also called a range image, which refers to an image in which the distance (depth) from an image collector or a virtual camera to each point in the scene is taken as a pixel value, It can reflect the geometric shape of the surface of the object.
深度图(shadow map)可以理解为光源空间下的深度图像,记录了从光源位置出发到场景物件最近表面的深度,即从光源位置出发到最近表面的深度,在本公开实施例中可以是包括到投影面板以及模型的表面,即深度图包含模型的多个顶点位置在光源空间中的第二深度值,也包括投影面板在光源空间中的第二深度值。通常用来生成平行光(direction light)的阴影。也可以是点光源,对应得到全向深度图(omnidirectionalshadow maps)。The depth map (shadow map) can be understood as a depth image in the light source space, which records the depth from the light source position to the nearest surface of the scene object, that is, the depth from the light source position to the nearest surface. In this embodiment of the present disclosure, it may include To the projection panel and the surface of the model, that is, the depth map contains the second depth values of the multiple vertex positions of the model in the light source space, and also includes the second depth value of the projection panel in the light source space. Often used to generate shadows for direction lights. It can also be a point light source, corresponding to omnidirectional shadow maps.
深度图的获取,采用的方法可以是可以在光源上挂载一个相机,用正交显示,光源相机需要可看见待投射的模型。然后给光源相机挂载相机渲染深度的脚本,在编辑器中给光源相机绑定RenderTexture到RenderTarget,直接在Project面板里创建,分辨率可以设置为1024。处理光源深度图和光源相机矩阵传入的脚本,投影矩阵需要经过GL类的转换函数处理,防止OpenGL和DX不一致。随后这个脚本可以挂载至主相机或GameObject上。最后是接收Shadowmap的shader,并对两个像素位置进行距离上的比较。还可以是通过pcf5x5方法、VSM方法或是其他方法。本公开实施例再次不做限制。To obtain the depth map, the method can be to mount a camera on the light source and display it in an orthogonal manner. The light source camera needs to see the model to be projected. Then mount the camera rendering depth script to the light source camera, bind the RenderTexture to the RenderTarget for the light source camera in the editor, and create it directly in the Project panel. The resolution can be set to 1024. To process the incoming script of the light source depth map and the light source camera matrix, the projection matrix needs to be processed by the conversion function of the GL class to prevent inconsistency between OpenGL and DX. This script can then be mounted on the main camera or GameObject. The last is the shader that receives the Shadowmap and compares the distance between the two pixel positions. It can also be through the pcf5x5 method, the VSM method or other methods. Again, the embodiments of the present disclosure are not limited.
深度图是在光源空间下获取的,因此将投影面板的顶点位置转换到光源空间后,再采集投影面板的深度值可以使得深度信息得到统一。根据投影面板上的顶点位置到光源的距离得到各顶点位置的第一深度值。The depth map is obtained in the light source space, so after converting the vertex position of the projection panel to the light source space, and then collecting the depth value of the projection panel can make the depth information unified. The first depth value of each vertex position is obtained according to the distance from the vertex position on the projection panel to the light source.
在步骤S230中,对比所述深度图的所述第二深度值和所述投影面板的所述第一深度值的大小,根据对比结果将所述投影面板区分为第一部分和第二部分。In step S230, the magnitudes of the second depth value of the depth map and the first depth value of the projection panel are compared, and the projection panel is divided into a first part and a second part according to the comparison result.
在对比所述深度图的深度值和所述投影面板深度值的过程中,一般会出现两种对比结果。即某一个点的深度图的深度值小于投影面板上对应点的深度值;或某一个点的深度图的深度值大于投影面板上对应点的深度值。则可以将第一种对比结果对应点以第一状态例如纯白色显示,第一种对比结果对应点的集合作为第一部分,则可以将第一种对比结果以第二状态例如纯黑色显示,第二种对比结果对应点的集合作为第二部分显示。In the process of comparing the depth value of the depth map and the depth value of the projection panel, there are generally two comparison results. That is, the depth value of the depth map of a certain point is smaller than the depth value of the corresponding point on the projection panel; or the depth value of the depth map of a certain point is greater than the depth value of the corresponding point on the projection panel. Then the corresponding points of the first comparison result can be displayed in a first state, such as pure white, and the set of corresponding points of the first comparison result can be used as the first part, then the first comparison result can be displayed in a second state, such as pure black, and the first comparison result can be displayed in a second state, such as pure black. The set of corresponding points of the two comparison results is displayed as the second part.
在一种实施例中,深度图和投影面板都是在光源空间下得到的,因此两者适用于同一个基于光源空间构建的三维坐标系。深度图实际就是在投影面板和在投影面板之上的模型为基础得到的,因此可以将在光源空间下构建的坐标系中具有相同坐标的一个第二深度值和一个第一深度值作为一个对比组。根据深度图中的多个第二深度值与投影面板的多个顶点位置的第一深度值,确定多个对比组分别进行大小对比。In one embodiment, both the depth map and the projection panel are obtained in the light source space, so both are applicable to the same three-dimensional coordinate system constructed based on the light source space. The depth map is actually obtained based on the projection panel and the model on the projection panel, so a second depth value and a first depth value with the same coordinates in the coordinate system constructed in the light source space can be used as a comparison. Group. According to the plurality of second depth values in the depth map and the first depth values of the plurality of vertex positions of the projection panel, a plurality of comparison groups are determined for size comparison respectively.
在步骤S240中,将包括所述第一部分和所述第二部分的所述投影面板作为阴影。In step S240, the projection panel including the first part and the second part is used as a shadow.
由于第一部分和第二部分是以不同方式进行显示,则可以在该两部分以不同方式显示的基础上,再进一步设置第一部分和第二部分的显示方式例如显示颜色。举例而言,将第一部分设置为黑色显示,第二部分显示为白色,则就可以得到模型的阴影。Since the first part and the second part are displayed in different ways, on the basis that the two parts are displayed in different ways, the display modes of the first part and the second part, such as display colors, can be further set. For example, set the first part to be displayed in black and the second part to be displayed in white, and you can get the shadow of the model.
如图3所示,包括场景中有一人物模型得到的深度图310、投影面板顶点位置的深度值图320和经过对比后的投影面板330,该投影面板330包括黑色的第一部分和白色的第二部分。因为投影面板上的顶点位置在光源空间中与光源的距离各自不同,因此,投影面板顶点位置的深度值图320上的深度值为不均匀。As shown in FIG. 3 , it includes a
本公开的一个实施例还提出一种模型阴影生成方法的实现方式,所述将所述投影面板的顶点位置转换到光源空间的步骤,包括:An embodiment of the present disclosure further provides an implementation manner of a model shadow generation method. The step of converting the vertex position of the projection panel to the light source space includes:
将投影面板的顶点位置从模型空间转到世界空间,然后从所述世界空间转到光源空间。Converts the vertex positions of the projection panel from model space to world space, and then from said world space to light space.
在本公开实施例中,模型空间是指和某个模型或者说是对象有关的。模型空间也即对象空间或局部空间。每个模型都有自己独立的坐标空间,当其坐标空间移动或旋转的时候,模型空间也会跟着它移动和旋转。当移动游戏模型,模型空间也跟随移动。In this embodiment of the present disclosure, the model space refers to a certain model or object. Model space is also known as object space or local space. Each model has its own independent coordinate space, and when its coordinate space moves or rotates, the model space also moves and rotates with it. When the game model is moved, the model space moves with it.
世界空间是一个特殊的坐标系,世界空间可以被用于描述绝对位置(指世界坐标系中的位置),通常世界空间的原点放置在游戏空间的中心。所有对象都以世界空间的位置(0,0,0)为中心放置。要创建世界空间矩阵,就要对对象进行转换(比如平移,旋转,缩放)。世界空间是由每个对象的转换所定义的,位移,旋转以及缩放。通过世界空间矩阵可以将对象顶点从自身模型空间转换到世界空间中,然后再从所述世界空间转到光源空间。World space is a special coordinate system that can be used to describe absolute positions (referring to positions in the world coordinate system). Usually the origin of world space is placed in the center of the game space. All objects are placed centered at the world space position (0, 0, 0). To create a world space matrix, transform the object (eg translate, rotate, scale). World space is defined by each object's transformation, displacement, rotation, and scaling. The world space matrix transforms object vertices from its own model space into world space, and then from said world space into light space.
构建一个物体从模型空间转换到世界空间的变换矩阵需要得到它在世界空间下的变换信息,可以通过Unity(三维互动内容创作和运营平台)的矩阵unity_ObjectToWorld来完成。还可以是利用C#脚本把物体的Transform信息传入Shader中,然后根据这些信息手动构建模型转世界空间的矩阵,获取到信息后,在Shader中构建五个4x4矩阵,分别是平移矩阵,三个旋转矩阵,和缩放矩阵。本公开实施例在此不限制如何将投影面板的顶点位置从模型空间转到世界空间。To construct a transformation matrix for transforming an object from model space to world space, it is necessary to obtain its transformation information in world space, which can be done through the matrix unity_ObjectToWorld of Unity (3D interactive content creation and operation platform). You can also use the C# script to pass the Transform information of the object into the Shader, and then manually construct the matrix of the model to the world space based on this information. After obtaining the information, construct five 4x4 matrices in the Shader, which are translation matrices, three Rotation matrix, and scaling matrix. The embodiments of the present disclosure do not limit how to transfer the vertex positions of the projection panel from the model space to the world space.
本公开的一个实施例还提出一种模型阴影生成方法的实现方式,在所述将包括所述第一部分和所述第二部分的所述投影面板作为阴影的步骤之后,所述方法还包括:An embodiment of the present disclosure further provides an implementation manner of a method for generating shadows of a model. After the step of using the projection panel including the first part and the second part as a shadow, the method further includes:
剔除所述第二部分并保留第一部分,将所述第一部分作为最终阴影结果。The second part is culled and the first part is kept as the final shadow result.
在本公开实施例中,得到的投影面板包括第一部分和第二部分;其中,根据不同的部分对应不同的显示方式,第一部分即可完整的表示阴影范围,可以通过剔除投影面板的第二部分来保留第一部分。In the embodiment of the present disclosure, the obtained projection panel includes a first part and a second part; wherein, according to different parts corresponding to different display modes, the first part can completely represent the shadow range, and the second part of the projection panel can be eliminated by eliminating to keep the first part.
举例而言可以通过反向剔除来去掉第二部分,将某一个点的深度图的深度值小于投影面板上对应点的深度值时的对比结果作为1,将某一个点的深度图的第二深度值大于投影面板上对应点的第一深度值时的对比结果作为0,然后交换结果值完成反向剔除。For example, the second part can be removed by reverse culling. The comparison result when the depth value of the depth map of a certain point is smaller than the depth value of the corresponding point on the projection panel is taken as 1, and the second part of the depth map of a certain point is taken as 1. When the depth value is greater than the first depth value of the corresponding point on the projection panel, the comparison result is taken as 0, and then the result value is exchanged to complete reverse culling.
实施本公开的实施例,通过在将包括第一部分和第二部分的投影面板作为阴影的步骤之后,删除第二部分并保留第一部分,将第一部分作为最终阴影结果。能够进一步减少场景中包含的资源,降低性能压力。Embodiments of the present disclosure are implemented by deleting the second part and retaining the first part after the step of using the projection panel including the first part and the second part as a shadow, and using the first part as the final shadow result. It can further reduce the resources contained in the scene and reduce the performance pressure.
在实际的场景渲染中,往往渲染的是复杂场景,场景中可以包括人物模型,建筑模型,环境模型等等。例如,对人物模型进行阴影生成时,人物模型背后可以是一个建筑模型,人物模型和人物模型背后的建筑模型一起构成一个完整的画面。但是,在模型过多的情况下,渲染压力比较大,可能导致模型的渲染精度不高、渲染结果缺失等等不佳效果。In actual scene rendering, complex scenes are often rendered, which may include character models, architectural models, environment models, and so on. For example, when performing shadow generation on a character model, a building model may be behind the character model, and the character model and the building model behind the character model together constitute a complete picture. However, in the case of too many models, the rendering pressure is relatively high, which may lead to poor rendering accuracy of the model, lack of rendering results, etc.
基于此,本公开的一个实施例还提出一种模型阴影生成方法的实现方式。所述方法还包括:Based on this, an embodiment of the present disclosure further proposes an implementation manner of a method for generating shadows of a model. The method also includes:
在所述模型后方生成一垂直于水平方向的背景面板,所述背景面板与所述投影面板垂直,用以承载其他渲染内容;A background panel perpendicular to the horizontal direction is generated behind the model, and the background panel is perpendicular to the projection panel for carrying other rendering contents;
其中,模型前方为所述模型指向所述光源空间中虚拟相机的第二方向,所述模型后方为所述第二方向的反方向。Wherein, the front of the model is the second direction in which the model points to the virtual camera in the light source space, and the rear of the model is the opposite direction of the second direction.
在本公开实施例中,模型前方或模型后方的确定与前述模式上方或下方的确定方式相同,在此不再赘述。In the embodiment of the present disclosure, the determination of the front of the model or the rear of the model is the same as the determination of the above or the bottom of the model, which will not be repeated here.
在本公开实施例中,可以将除需要对其进行投影生成的模型之外的其他模型作为二维图渲染在该背景面板上,即通过二维图替换大量的需要生成的模型,不需要渲染更多的三维模型。相比于需要渲染三维模型,在背景面板上渲染二维图所需要的性能更少,且即使渲染高精度的二维图,也不会造成大的性能压力。另外,还可以将用户交互界面中用于实现用户功能的内容也显示在背景面板,而不需要额外的其他三维模型。In this embodiment of the present disclosure, other models other than the models that need to be generated by projection can be rendered on the background panel as two-dimensional images, that is, a large number of models to be generated are replaced by two-dimensional images, and no rendering is required. More 3D models. Compared with the need to render a 3D model, rendering a 2D image on the background panel requires less performance, and even rendering a high-precision 2D image will not cause a lot of performance pressure. In addition, the content used to implement user functions in the user interaction interface can also be displayed on the background panel without requiring additional other three-dimensional models.
举例而言,如图4所示,包括背景面板410、投影面板420和虚拟相机430。虚拟相机430用于在虚拟场景中取景,取景内容将通过图形用户界面向用户传达,本实施例对虚拟相机430与人物模型之间的相对高度和相对角度不做限制。背景面板410位于人物模型的后方,投影面板420位于人物模型的下方,投影面板420水平放置在人物模型下方,背景面板410垂直放置在人物模型后方。For example, as shown in FIG. 4 , a
实施本公开的实施例,通过在所述模型旁生成一背景面板,用以承载其他渲染内容。能够在画面渲染时不再需要场景中放置其它模型资源,降低了渲染性能压力;另外,通过背景面板来承载其他的渲染内容,能够在保持场景完整性和丰富性的情况下,在背景面板上承载二维图,可以提高场景画面的精细度。By implementing the embodiments of the present disclosure, a background panel is generated beside the model to carry other rendering contents. It is no longer necessary to place other model resources in the scene during screen rendering, which reduces the pressure on rendering performance; in addition, the background panel is used to carry other rendering content, which can maintain the integrity and richness of the scene. Carrying a two-dimensional image can improve the fineness of the scene picture.
进一步的,本示例实施方式中,还提供了一种模型阴影生成装置。参考图5所示,该模型阴影生成装置500可以包括:Further, in this exemplary embodiment, a model shadow generating apparatus is also provided. Referring to Fig. 5, the model shadow generating apparatus 500 may include:
投影面板模块501,用于在模型旁生成一投影面板,将所述投影面板的顶点位置转换到光源空间;The
深度采集模块502,用于采集所述模型在所述光源空间中的深度图,采集所述投影面板的多个顶点位置在光源空间下的第一深度值,其中,所述深度图包含所述模型的多个顶点位置在所述光源空间中的第二深度值;A
深度对比模块503,用于对比所述深度图的所述第二深度值和所述投影面板的所述第一深度值的大小,根据对比结果将所述投影面板区分为第一部分和第二部分;A
阴影结果模块504,用于将包括所述第一部分和所述第二部分的所述投影面板作为阴影。The
在本公开的一种示例性实施例中,所述投影面板模块,用于将投影面板的顶点位置从模型空间转到世界空间,然后从所述世界空间转到光源空间。In an exemplary embodiment of the present disclosure, the projection panel module is configured to convert the vertex positions of the projection panel from the model space to the world space, and then from the world space to the light source space.
在本公开的一种示例性实施例中,所述深度对比模块,用于当所述深度图的所述第二深度值小于所述投影面板的所述第一深度值,则以第一状态进行显示;In an exemplary embodiment of the present disclosure, the depth comparison module is configured to enter a first state when the second depth value of the depth map is smaller than the first depth value of the projection panel to display;
当所述深度图的所述第二深度值大于所述投影面板的所述第一深度值,则以第二状态进行显示;When the second depth value of the depth map is greater than the first depth value of the projection panel, display in a second state;
将以所述投影面板中以第一状态进行显示的部分作为第一部分,将所述投影面板中以第二状态进行显示的部分作为第二部分。The portion of the projection panel that is displayed in the first state is referred to as the first portion, and the portion of the projection panel that is displayed in the second state is referred to as the second portion.
在本公开的一种示例性实施例中,所述装置还包括:In an exemplary embodiment of the present disclosure, the apparatus further includes:
剔除模块,用于在所述将包括所述第一部分和所述第二部分的所述投影面板作为阴影的步骤之后,剔除所述第二部分并保留第一部分,将所述第一部分作为最终阴影结果。a culling module for culling the second part and retaining the first part after the step of using the projection panel including the first part and the second part as a shadow, and using the first part as a final shadow result.
在本公开的一种示例性实施例中,所述投影面板模块,用于在模型下方生成一水平放置的投影面板;In an exemplary embodiment of the present disclosure, the projection panel module is used to generate a horizontally placed projection panel under the model;
其中,模型上方为所述模型指向所述光源空间的光源位置的第一方向,所述模型下方为所述第一方向的反方向。Wherein, the top of the model is the first direction of the light source position of the model pointing to the light source space, and the bottom of the model is the opposite direction of the first direction.
在本公开的一种示例性实施例中,所述装置还包括:In an exemplary embodiment of the present disclosure, the apparatus further includes:
背景面板模块,用于在所述模型后方生成一垂直于水平方向的背景面板,所述背景面板与所述投影面板垂直,用以承载其他渲染内容;The background panel module is used to generate a background panel perpendicular to the horizontal direction behind the model, and the background panel is perpendicular to the projection panel for carrying other rendering contents;
其中,模型前方为所述模型指向所述光源空间中虚拟相机的第二方向,所述模型后方为所述第二方向的反方向。Wherein, the front of the model is the second direction in which the model points to the virtual camera in the light source space, and the rear of the model is the opposite direction of the second direction.
在本公开的一种示例性实施例中,所述深度对比模块,用于将在所述光源空间下构建的坐标系中具有相同坐标的一个第二深度值和一个第一深度值作为一个对比组;In an exemplary embodiment of the present disclosure, the depth comparison module is configured to use a second depth value and a first depth value with the same coordinates in the coordinate system constructed in the light source space as a comparison Group;
根据所述深度图的多个第二深度值与所述投影面板的多个第一深度值,确定多个对比组分别进行大小对比。According to a plurality of second depth values of the depth map and a plurality of first depth values of the projection panel, a plurality of comparison groups are determined for size comparison respectively.
图6示出了适于用来实现本公开实施例的终端设备的计算机系统的结构示意图。FIG. 6 shows a schematic structural diagram of a computer system suitable for implementing a terminal device according to an embodiment of the present disclosure.
需要说明的是,图6示出的终端设备的计算机系统仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。It should be noted that the computer system of the terminal device shown in FIG. 6 is only an example, and should not impose any limitations on the functions and scope of use of the embodiments of the present disclosure.
计算机系统包括中央处理单元(CPU),其可以根据存储在只读存储器(ROM)中的程序或者从存储部分加载到随机访问存储器(RAM)203中的程序而执行各种适当的动作和处理。在(RAM)中,还存储有系统操作所需的各种程序和数据。(CPU)、(ROM)以及(RAM)通过总线彼此相连。输入/输出(I/O)接口也连接至总线。The computer system includes a central processing unit (CPU) that can perform various appropriate actions and processes according to programs stored in a read only memory (ROM) or loaded from a storage section into a random access memory (RAM) 203 . In (RAM), various programs and data necessary for system operation are also stored. (CPU), (ROM), and (RAM) are connected to each other through a bus. Input/output (I/O) interfaces are also connected to the bus.
以下部件连接至(I/O)接口:包括键盘、鼠标等的输入部分;包括诸如阴极射线管(CRT)、液晶显示器(LCD)等以及扬声器等的输出部分;包括硬盘等的存储部分;以及包括诸如LAN卡、调制解调器等的网络接口卡的通信部分。通信部分经由诸如因特网的网络执行通信处理。驱动器也根据需要连接至(I/O)接口。可拆卸介质,诸如磁盘、光盘、磁光盘、半导体存储器等等,根据需要安装在驱动器上,以便于从其上读出的计算机程序根据需要被安装入存储部分。The following components are connected to the (I/O) interface: an input section including a keyboard, a mouse, etc.; an output section including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section including a hard disk, etc.; and Includes the communication part of a network interface card such as a LAN card, modem, etc. The communication section performs communication processing via a network such as the Internet. Drives are also connected to the (I/O) interface as required. Removable media, such as magnetic disks, optical disks, magneto-optical disks, semiconductor memories, etc., are mounted on the drive as needed, so that the computer program read therefrom is installed into the storage section as needed.
特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在计算机可读存储介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信部分从网络上被下载和安装,和/或从可拆卸介质被安装。在该计算机程序被中央处理单元(CPU)执行时,执行本公开的方法和装置中限定的各种功能。应当注意,尽管在上文详细描述中提及了用于动作执行的设备的若干模块或者单元,但是这种划分并非强制性的。实际上,根据本公开的实施方式,上文描述的两个或更多模块或者单元的特征和功能可以在一个模块或者单元中具体化。反之,上文描述的一个模块或者单元的特征和功能可以进一步划分为由多个模块或者单元来具体化。In particular, according to embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a computer-readable storage medium, the computer program containing program code for performing the method illustrated in the flowchart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication portion, and/or installed from a removable medium. When the computer program is executed by a central processing unit (CPU), the various functions defined in the method and apparatus of the present disclosure are performed. It should be noted that although several modules or units of the apparatus for action performance are mentioned in the above detailed description, this division is not mandatory. Indeed, according to embodiments of the present disclosure, the features and functions of two or more modules or units described above may be embodied in one module or unit. Conversely, the features and functions of one module or unit described above may be further divided into multiple modules or units to be embodied.
由于本公开的示例实施例的虚拟道具交换装置的各个功能模块与上述虚拟道具交换方法的示例实施例的步骤对应,因此对于本公开装置实施例中未披露的细节和效果,请参照本公开上述的虚拟道具交换方法的实施例。Since each functional module of the virtual prop exchanging apparatus of the exemplary embodiment of the present disclosure corresponds to the steps of the above-mentioned exemplary embodiment of the virtual prop exchanging method, for details and effects not disclosed in the apparatus embodiment of the present disclosure, please refer to the above-mentioned example of the present disclosure. An embodiment of the virtual prop exchange method.
以上这些模块可以是被配置成实施以上方法的一个或多个集成电路,例如:一个或多个特定集成电路(Application Specific Integrated Circuit,简称ASIC),或,一个或多个微处理器(Digital Singnal Processor,简称DSP),或,一个或者多个现场可编程门阵列(Field Programmable Gate Array,简称FPGA)等。再如,当以上某个模块通过处理元件调度程序代码的形式实现时,该处理元件可以是通用处理器,例如中央处理器(CentralProcessing Unit,简称CPU)或其它可以调用程序代码的处理器。再如,这些模块可以集成在一起,以片上系统(System-on-a-chip,简称SOC)的形式实现。The above modules may be one or more integrated circuits configured to implement the above methods, such as: one or more specific integrated circuits (Application Specific Integrated Circuit, ASIC for short), or one or more microprocessors (Digital Singnal) Processor, referred to as DSP), or, one or more Field Programmable Gate Array (Field Programmable Gate Array, referred to as FPGA) and the like. For another example, when one of the above modules is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (Central Processing Unit, CPU for short) or other processors that can call program codes. For another example, these modules can be integrated together and implemented in the form of a system-on-a-chip (SOC for short).
在本公开所提供的实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the embodiments provided in the present disclosure, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the apparatus embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not implemented. On the other hand, the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能单元的形式实现。In addition, each functional unit in 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 unit may be implemented in the form of hardware, or may be implemented in the form of hardware plus software functional units.
上述以软件功能单元的形式实现的集成的单元,可以存储在一个计算机可读取存储介质中。上述软件功能单元存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或处理器(英文:processor)执行本发明各个实施例所述方法的部分步骤。The above-mentioned integrated units implemented in the form of software functional units can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, and includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (English: processor) to execute the various embodiments of the present invention. part of the method.
上仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以权利要求的保护范围为准。The above are only specific embodiments of the present application, but the protection scope of the present application is not limited to this. Any person skilled in the art who is familiar with the technical scope disclosed in the present application can easily think of changes or replacements, which should be covered within the scope of the present application. within the scope of protection of this application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202210623032.1A CN115019020A (en) | 2022-06-01 | 2022-06-01 | Model shadow generation method, device, readable storage medium and electronic device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202210623032.1A CN115019020A (en) | 2022-06-01 | 2022-06-01 | Model shadow generation method, device, readable storage medium and electronic device |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN115019020A true CN115019020A (en) | 2022-09-06 |
Family
ID=83072845
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202210623032.1A Pending CN115019020A (en) | 2022-06-01 | 2022-06-01 | Model shadow generation method, device, readable storage medium and electronic device |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN115019020A (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN115814407A (en) * | 2022-10-20 | 2023-03-21 | 网易(杭州)网络有限公司 | Information processing method, information processing apparatus, storage medium, and electronic apparatus |
Citations (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US6876362B1 (en) * | 2002-07-10 | 2005-04-05 | Nvidia Corporation | Omnidirectional shadow texture mapping |
| CN101127127A (en) * | 2007-09-29 | 2008-02-20 | 腾讯科技(深圳)有限公司 | Shade drafting method and rendering device |
| US20090033661A1 (en) * | 2007-08-01 | 2009-02-05 | Miller Gavin S P | Spatially-Varying Convolutions for Rendering Soft Shadow Effects |
| CN102096907A (en) * | 2009-12-11 | 2011-06-15 | 英特尔公司 | Image processing technique |
| US20120001911A1 (en) * | 2009-03-27 | 2012-01-05 | Thomson Licensing | Method for generating shadows in an image |
| US20160125642A1 (en) * | 2014-10-31 | 2016-05-05 | Google Inc. | Efficient Computation of Shadows for Circular Light Sources |
| US20200380790A1 (en) * | 2019-06-03 | 2020-12-03 | Eidos Interactive Corp. | Systems and methods for augmented reality applications |
-
2022
- 2022-06-01 CN CN202210623032.1A patent/CN115019020A/en active Pending
Patent Citations (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US6876362B1 (en) * | 2002-07-10 | 2005-04-05 | Nvidia Corporation | Omnidirectional shadow texture mapping |
| US20090033661A1 (en) * | 2007-08-01 | 2009-02-05 | Miller Gavin S P | Spatially-Varying Convolutions for Rendering Soft Shadow Effects |
| CN101127127A (en) * | 2007-09-29 | 2008-02-20 | 腾讯科技(深圳)有限公司 | Shade drafting method and rendering device |
| US20120001911A1 (en) * | 2009-03-27 | 2012-01-05 | Thomson Licensing | Method for generating shadows in an image |
| CN102096907A (en) * | 2009-12-11 | 2011-06-15 | 英特尔公司 | Image processing technique |
| US20160125642A1 (en) * | 2014-10-31 | 2016-05-05 | Google Inc. | Efficient Computation of Shadows for Circular Light Sources |
| US20200380790A1 (en) * | 2019-06-03 | 2020-12-03 | Eidos Interactive Corp. | Systems and methods for augmented reality applications |
Non-Patent Citations (1)
| Title |
|---|
| 王珊: "视野驱动的自适应阴影图", 《计算机工程与应用》, no. 15, 21 May 2011 (2011-05-21), pages 213 - 216 * |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN115814407A (en) * | 2022-10-20 | 2023-03-21 | 网易(杭州)网络有限公司 | Information processing method, information processing apparatus, storage medium, and electronic apparatus |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN111008422B (en) | A method and system for making a real-world map of a building | |
| CN111354062B (en) | Multi-dimensional spatial data rendering method and device | |
| CN113674389B (en) | Scene rendering method and device, electronic equipment and storage medium | |
| CN113724368B (en) | Image acquisition system, three-dimensional reconstruction method, device, equipment and storage medium | |
| WO2021228031A1 (en) | Rendering method, apparatus and system | |
| CN113112581A (en) | Texture map generation method, device and equipment for three-dimensional model and storage medium | |
| JP7277548B2 (en) | SAMPLE IMAGE GENERATING METHOD, APPARATUS AND ELECTRONIC DEVICE | |
| CN114842127B (en) | Terrain rendering method and device, electronic equipment, medium and product | |
| WO2022063260A1 (en) | Rendering method and apparatus, and device | |
| CN114998514A (en) | A method and device for generating a virtual character | |
| CN115937389A (en) | Shadow rendering method, device, storage medium and electronic equipment | |
| CN116109684A (en) | Online video monitoring two-dimensional and three-dimensional data mapping method and device for variable electric field station | |
| CN112288878B (en) | Augmented reality preview method and preview device, electronic equipment and storage medium | |
| KR20230013099A (en) | Geometry-aware augmented reality effects using real-time depth maps | |
| CN114742940A (en) | Method, device and equipment for constructing virtual image texture map and storage medium | |
| US20080111814A1 (en) | Geometric tagging | |
| CN115019020A (en) | Model shadow generation method, device, readable storage medium and electronic device | |
| CN115311414A (en) | Live-action rendering method and device based on digital twinning and related equipment | |
| CN114820904A (en) | Illumination-supporting pseudo-indoor rendering method, apparatus, medium, and device | |
| WO2024255620A1 (en) | Image processing method and apparatus, and device, medium and program product | |
| CN115810086B (en) | Three-dimensional scene reconstruction method, device, computer equipment and storage medium | |
| Chai et al. | Cultural heritage assets optimization workflow for interactive system development | |
| CN112862981B (en) | Method and apparatus for presenting a virtual representation, computer device and storage medium | |
| CN114708387A (en) | Method and device for constructing three-dimensional model, electronic equipment and storage medium | |
| CN113643426A (en) | A method, device and storage medium for updating a simulated urban building model |
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 |