Model projection rendering method and device, electronic equipment and computer storage medium
By calculating and using model position offset data to generate the position data of the projection model, and directly performing shadow rendering, solving the problem of skeletal binding complexity in the proxy model method, and achieving efficient and easy-to-implement custom projection generation.
Patent Information
- Application Number
- CN202411940977.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-05-30
AI Technical Summary
When using the proxy model to generate projection effects of the role grid model, complex bone binding and animation processing of the original model and proxy model is required, resulting in large workload and high implementation difficulty.
By loading the target model and model position offset data, the position data of each vertex in the projection model is directly calculated, and shadow rendering is performed based on these data to generate target projections, avoiding bone binding of the original model and the projection model.
Simplifies the complexity and implementation difficulty of implementing custom projection shapes, reduces workload, and enables efficient and easy-to-implement custom projection generation.
Smart Images

Figure CN120070712A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of 3D rendering technology, and particularly to a rendering method, device, electronic device, and computer-readable storage medium for model projection. Background Art
[0002] In related technologies, as a commonly used model projection rendering method, the proxy model method realizes the effect of custom projection shape through two models in 3D modeling software such as Maya. Specifically, one of the models is the original model, which is used for normal display and animation in the scene; and the other model, that is, the "projection proxy model", is specially designed for the projection effect and is not directly displayed in the scene itself. In the proxy model method, the user first creates a modified, simplified, or deformed model as the projection proxy model in Maya according to the shape and characteristics of the original model. By precisely controlling the geometric shape of the projection proxy model, the desired projection effect can be generated, which will not affect the appearance of the original model.
[0003] However, when using the proxy model method to generate the projection effect for the character mesh model, it is necessary to perform skeleton binding and animation processing on both the original model and the proxy model, which involves a huge amount of work and complex skeleton binding relationships, resulting in higher complexity and implementation difficulty. Summary of the Invention
[0004] This application provides a rendering method, device, electronic device, and computer-readable storage medium for model projection, so as to generate a custom projection for the target model in an efficient and easy-to-implement manner.
[0005] In a first aspect, an embodiment of this application provides a rendering method for model projection, and the method includes:
[0006] Loading, through a first rendering application, a target model and model position offset data, where the target model includes a first number of first vertices, the projection model includes the first number of second vertices, the first vertices and the second vertices correspond one by one, the vertex numbers of the first vertices are the same as the vertex numbers of the corresponding second vertices, and the model position offset data is the position offset data of each of the second vertices in the projection model relative to the corresponding first vertex in the target model calculated through a second rendering application;
[0007] Determining, through the first rendering application, the position data of each of the second vertices in the projection model according to the position data of each of the first vertices in the target model and the model position offset data;
[0008] Through the first rendering application, shadow rendering is performed according to the position data of each of the second vertices to generate a target projection for the target model, and the shape of the target projection is the same as the shape of the projection of the projection model.
[0009] In a second aspect, an embodiment of the present application provides a rendering device for model projection, and the device includes:
[0010] An acquisition module, configured to load a target model and model position offset data through a first rendering application, where the target model includes a first number of first vertices, the projection model includes the first number of second vertices, the first vertices and the second vertices correspond one by one, the vertex numbers of the first vertices are the same as the vertex numbers of the corresponding second vertices, and the model position offset data is the position offset data of each of the second vertices in the projection model relative to the corresponding first vertices in the target model calculated through a second rendering application;
[0011] A determination module, configured to determine the position data of each of the second vertices in the projection model according to the position data of each of the first vertices in the target model and the model position offset data through the first rendering application;
[0012] A processing module, configured to perform shadow rendering according to the position data of each of the second vertices through the first rendering application to generate a target projection for the target model, and the shape of the target projection is the same as the shape of the projection of the projection model.
[0013] In a third aspect, an embodiment of the present application provides an electronic device, and the electronic device includes:
[0014] A memory and a processor, the memory and the processor are coupled;
[0015] The memory is used to store one or more computer instructions;
[0016] The processor is configured to execute the one or more computer instructions to implement the rendering method for model projection according to any one of the above first aspects.
[0017] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which one or more computer instructions are stored, and characterized in that the instructions are executed by a processor to implement the rendering method for model projection according to any one of the above first aspects.
[0018] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, and when the computer program is executed by a processor, the rendering method for model projection according to any one of the above first aspects is implemented.
[0019] Compared with the prior art, the present application has the following advantages:
[0020] In the rendering method of model projection provided by the present application, the position offset data of each second vertex in the projection model relative to the corresponding first vertex in the target model is calculated by the second rendering application. In the first rendering application, the target model and the model position offset data are directly used. Here, only the position data of each second vertex in the projection model is restored (without rendering the projection model), and shadow rendering is performed only based on the position data of each second vertex in the projection model to generate a projection for the target model. This process only needs to restore and calculate the position data of each second vertex in the projection model through the target model and the model position offset data, and then perform shadow rendering based on the position data of each second vertex in the projection model to generate a projection for the target model, without binding the complex bone binding relationship between the target model and the projection model. Therefore, the complexity and implementation difficulty of implementing a custom projection shape are greatly reduced, and a custom projection can be generated for the target model in an efficient and easy-to-implement manner. At the same time, in only the first rendering application, only the target model is rendered, and the projection model does not need to be rendered, and finally the resulting file package is also smaller. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The drawings described herein are used to provide a further understanding of the present application, and constitute a part of the present application. The schematic embodiments of the present application and their descriptions are used to explain the present application, and do not constitute an improper limitation of the present application. In the drawings:
[0022] Figure 1 is a schematic flow chart of the rendering method of model projection provided by one embodiment of the present application;
[0023] Figure 2 is a schematic diagram of a left-handed coordinate system and a right-handed coordinate system provided by one embodiment of the present application;
[0024] Figure 3 is a schematic diagram of the effect of the projection generated for the target model provided by one embodiment of the present application;
[0025] Figure 4 is a schematic structural diagram of the rendering device of model projection provided by one embodiment of the present application;
[0026] Figure 5 is a schematic hardware structure diagram of an electronic device provided by one embodiment of the present application.
[0027] Through the above-mentioned drawings, specific embodiments of the present application have been shown, and there will be more detailed descriptions hereinafter. These drawings and text descriptions are not intended to limit the scope of the concept of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0028] To make the objectives, advantages and features of this application clearer, the following provides a clear and complete description of this application in combination with the accompanying drawings and specific embodiments. In the following description, many specific details are set forth to facilitate a thorough understanding of this application. However, the described embodiments are only a part of the embodiments of this application, rather than all of them. All other embodiments obtained by those of ordinary skill in the art without making creative efforts fall within the scope of protection of this application.
[0029] It should be noted that in the description of this application, the terms "first", "second", etc. are only used for descriptive purposes and cannot be construed as indicating or implying relative importance, as well as a specific order or sequence. For those of ordinary skill in the art, the specific meanings of the above terms in this application can be understood according to specific circumstances. In addition, in the description of this application, unless otherwise specified, the term "plurality" means two or more. The term "and / or" describes the associated relationship of associated objects and indicates that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. The character " / " generally represents an "or" relationship between the associated objects before and after. The terms "comprising" and "having" and any of their variations are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device comprising a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0030] To facilitate an understanding of the technical solution of this application, relevant concepts involved in this application are first introduced.
[0031] In the fields of digital entertainment and visual arts, 3D modeling and rendering technologies play a crucial role, especially in game development, movie special effects, and virtual reality (VR) and augmented reality (AR) applications.
[0032] The projection effect of 3D models under light is one of the important factors affecting visual realism and artistic style. Traditionally, game rendering engines (such as Unreal Engine, Unity, etc.) follow physical laws to simulate light and projection, ensuring that the shadow performance of models conforms to the physical laws of the real world. This approach is very effective in games or applications that pursue a high degree of realism. However, in some artworks that pursue a unique visual style, the default physical projection effect may limit users' creative expression. Moreover, this physical projection effect often appears limited in games that pursue artistic stylization. Specifically, users may want to adjust the projection shape of the model to achieve a specific visual effect. The realization of this specific visual effect often breaks free from the constraints of physical laws, allowing users to freely customize the projection effect of the model according to the scene requirements and artistic concepts. For example, modify the range of the projection of the character's hat, and optimize the unnaturalness of the character's facial shadow caused by the prominent brow bone.
[0033] With the continuous development of the game industry and artistic creation, stylized visual 3D games are increasingly popular among players and audiences. Such games often pursue distinct colors, exaggerated shapes, and unique artistic styles rather than absolute realism. Therefore, in the processing of model projection, it is also necessary to break free from the constraints of traditional physical rules and allow users to freely customize the projection effect of the model according to the scene requirements and artistic concepts.
[0034] Next, the existing technologies related to this application and the problems existing in the existing technologies will be described:
[0035] In related technologies, the proxy model method, as a commonly used model projection rendering method, realizes the effect of customizing the projection shape through two models in 3D modeling software such as Maya. Specifically, one of the models is the original model, which is used for normal display and animation in the scene; while the other model, namely the "projection proxy model", is specifically designed for the projection effect and is not directly displayed in the scene itself. In the proxy model method, users first create a modified, simplified, or deformed model as the projection proxy model in Maya according to the shape and characteristics of the original model. By precisely controlling the geometric shape of the projection proxy model to generate the desired projection effect, this will not affect the appearance of the original model.
[0036] However, when using the proxy model method to generate the projection effect for the character mesh model, it is necessary to perform bone binding and animation processing on both the original model and the proxy model. This involves a huge amount of work and complex bone binding relationships, resulting in high complexity and implementation difficulty. In addition, in the proxy model method, mainly by performing bone binding on both the original model and the proxy model, it is ensured that the proxy model follows the dynamic changes of the original model, thereby driving the synchronous change of the projection shape. However, due to the complex bone binding relationships between the models and the huge amount of work brought by them, and it is easy to make mistakes, it is difficult to meet the requirement that the projection shape of the projection proxy model follows the deformation of the original model in real time.
[0037] In order to solve the problems existing in the above related technologies, the present application provides a rendering method for model projection, a rendering device for model projection corresponding to the method, an electronic device capable of implementing the rendering method for model projection, and a computer-readable storage medium. The following provides embodiments to elaborate on the above method, device, electronic device, and computer-readable storage medium in detail.
[0038] In order to make the purpose and technical solution of the present application clearer and more intuitive, the method provided by the embodiments of the present application will be described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application. It can be understood that the following several embodiments can exist independently, and the embodiments and features in the embodiments provided by the present application can be combined with each other without conflict. For the same or similar content, it will not be repeated in different embodiments. In addition, the step sequence in the following method embodiments is only an example and is not strictly limited. In some cases, the steps shown or described can be executed in a different order.
[0039] The present application provides a rendering method for model projection, a device, an electronic device, and a computer-readable storage medium. Specifically, the rendering method for model projection in one embodiment of the present application can be executed by a computer device, where the computer device can be a terminal or a server, etc. The terminal can be a smart phone, a tablet computer, a notebook computer, a touch screen, etc. The terminal can also include a client, and the client can be a game application client, a browser client with a game program, or an instant messaging client, etc. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, and big data and artificial intelligence platforms.
[0040] Next, in combination withFigure 1 A description is given of the rendering method for model projection provided in one embodiment of the present application. Figure 1 It is a schematic flowchart of the rendering method for model projection provided in one embodiment of the present application.
[0041] As Figure 1 shown, the rendering method for the model projection includes steps S10 - S40:
[0042] S10. Through a first rendering application, load a target model and model position offset data. The target model includes a first number of first vertices, and the projection model includes a first number of second vertices. The first vertices and the second vertices are in one-to-one correspondence, and the vertex numbers of the first vertices are the same as the vertex numbers of the corresponding second vertices. The model position offset data is the position offset data of each second vertex in the projection model relative to the corresponding first vertex in the target model calculated through a second rendering application.
[0043] S20. Through the first rendering application, determine the position data of each second vertex in the projection model according to the position data of each first vertex in the target model and the model position offset data.
[0044] S30. Through the first rendering application, perform shadow rendering according to the position data of each second vertex to generate a target projection for the target model. The shape of the target projection is the same as the shape of the projection of the projection model.
[0045] Next, a detailed description is given of steps S10 - S30.
[0046] As mentioned above, the first rendering application is a three-dimensional production software with high rendering performance, such as Unreal Engine (UE), and the second rendering application is a three-dimensional production software with high modeling performance, such as Maya. Among them, Maya, as a powerful 3D computer graphics software, is widely used in fields such as modeling, animation, simulation, and rendering. Its flexible modeling tools and powerful UV editing functions provide a solid foundation for creating high-quality models. And Unreal Engine (UE), with its high rendering performance and flexible material system, has become the preferred platform for many game developers. In the embodiments of the present application, the first rendering application can be Unreal Engine, and the second rendering application can be Maya. By combining the modeling advantages of Maya and the rendering capabilities of Unreal Engine, high-quality 3D projection effects can be achieved.
[0047] In the embodiment of the present application, the target model and the model position offset data are loaded through the first rendering application. The target model is the model for which the user is to generate a custom projection. For example, the target model is a nasal bone model, and the user will generate a custom nasal bone projection for this nasal bone model. The model position offset data is the position offset data of each vertex in the projection model relative to each vertex in the target model calculated through the second rendering application. The projection of the projection model meets the preset projection shape requirement for generating a projection for the target model, that is, the projection of the projection model conforms to the preset projection shape requirement for the user to generate a custom projection for the target model. The projection model can be a model obtained by deforming the target model. The target model includes a first number of first vertices, and the projection model includes a first number of second vertices. The first vertices and the second vertices are in one-to-one correspondence, and the vertex numbers of the first vertices are the same as the vertex numbers of the corresponding second vertices. This ensures that the model position offset calculation can be performed for the two 3D models, that is, for the first vertex and the second vertex with the same vertex number, the position offset data of each second vertex in the projection model relative to the corresponding first vertex in the target model is calculated. Therefore, more specifically, the model position offset data is the position offset data of each second vertex in the projection model relative to the corresponding first vertex in the target model calculated through the second rendering application.
[0048] Exemplarily, the vertices in the 3D model are sorted in ascending order of vertex number. Assume that the target model and the projection model respectively include N first vertices and N second vertices. The set of all first vertices in the target model can be The set of all second vertices in the projection model can be Then, the model position offset data is It should be noted that the position data of the above first vertices and second vertices are all three-dimensional data. The position offset data of each second vertex in the projection model relative to the corresponding first vertex in the target model in the model position offset data is also three-dimensional data.
[0049] In the embodiment of the present application, after the first rendering application loads the target model and the model position offset data, the first rendering application determines the position data of each second vertex in the projection model according to the position data of each first vertex in the target model and the model position offset data.
[0050] Next, according to whether the first rendering application and the second rendering application use the same coordinate system (that is, whether the directions of the X-axis, Y-axis, and Z-axis of the coordinate systems used by the first rendering application and the second rendering application are the same), how to specifically determine the position data of each second vertex in the projection model will be described.
[0051] It should be emphasized that the directions of the same coordinate system on the X-axis, Y-axis, and Z-axis are all the same, while the directions of different coordinate systems are inconsistent on at least one of the coordinate axes. For example, the left-handed coordinate system and the right-handed coordinate system. Figure 2 FIG. Figure 2 is a schematic diagram of the left-handed coordinate system and the right-handed coordinate system provided in one embodiment of the present application. As Figure 2 shown, in the left-handed coordinate system, the direction of the X-axis points to the right, the direction of the Y-axis points upward, and the direction of the Z-axis points into the screen, while in the right-handed coordinate system, the direction of the X-axis points to the right, the direction of the Y-axis points upward, and the direction of the Z-axis points out of the screen. Therefore, the directions of the left-handed coordinate system and the right-handed coordinate system on the Z-axis are inconsistent. That is to say, if the first rendering application uses one of the left-handed coordinate system and the right-handed coordinate system, and the second rendering application uses the other, it means that using the first rendering application and the second rendering application for the same 3D model results in positive and negative values of its numerical value on the Z-axis. For example, for the same 3D model 1, the Z-axis coordinate value of vertex 1 in the 3D model 1 in the first rendering application is positive, and the Z-axis coordinate value of vertex 1 in the 3D model 1 in the second rendering application is negative.
[0052] In the case where the first rendering application and the second rendering application use the same coordinate system, for example, both the first rendering application and the second rendering application use the left-handed coordinate system or both use the right-handed coordinate system. In this way, the directions of the coordinate systems used by the first rendering application and the second rendering application on the X-axis, Y-axis, and Z-axis are all the same. Therefore, for the target model and the model position offset data, the values on the X-axis, Y-axis, and Z-axis in the first rendering application and the second rendering application are the same, and there is no positive or negative difference on any coordinate axis. Through the first rendering application, for each first vertex in the target model, the sum of the position data of the first vertex in the target model and the position offset data corresponding to the first vertex is determined as the position data of the second vertex corresponding to the first vertex.
[0053] Exemplarily, the target model and the projection model respectively include N first vertices and N second vertices. The set of all first vertices in the target model can be The model position offset data is Taking the second vertex P 1 2 as an example, the calculation method of the position data of the second vertex P 1 2 is: P 1 2 = P 1 1 + Pd 1 .
[0054] When the first rendering application and the second rendering application use different coordinate systems, for example, the second rendering application and the first rendering application use the first three-dimensional coordinate system and the second three-dimensional coordinate system respectively, and the directions of the first coordinate axes in the first three-dimensional coordinate system and the second three-dimensional coordinate system are opposite. Since the directions of the first coordinate axes in the first three-dimensional coordinate system and the second three-dimensional coordinate system are opposite, this results in that when the same three-dimensional model application is loaded and used in rendering applications with different coordinate systems, the coordinate values of the three-dimensional model data on the first coordinate axis in the two rendering applications are opposite, that is, one is positive and the other is negative. Then, before determining the position data of each second vertex in the projection model, steps S201 - S202 need to be performed: S201. Take the negative of the position data of each first vertex in the target model on the first coordinate axis to obtain the updated position data of each first vertex. S202. Take the negative of the position offset of each position offset data in the model position offset data on the first coordinate axis to obtain the updated model position offset data. Further, through the first rendering application, based on the updated target model and the model position offset data, for each first vertex in the target model, the sum of the position data of the first vertex in the target model and the corresponding position offset data is determined as the position data of the second vertex corresponding to the first vertex.
[0055] Exemplarily, when the first rendering application is the Unreal Engine, it uses a left-handed coordinate system, and when the second rendering application is Maya, it uses a right-handed coordinate system. Therefore, for the same three-dimensional model, using the first rendering application and the second rendering application results in positive and negative values on the Z-axis. If in the second rendering application, the set of all first vertices in the target model is The model position offset data is Then, when using the above target model and model position offset data in the first rendering application, it is necessary to take the negative of the values of the position data of each first vertex in the target model and the model position offset data on the Z-axis, so as to successfully load the updated target model and model position offset data in the first rendering application. Therefore, the set of all first vertices in the target model loaded by the first rendering application is The model position offset data is Taking the second vertex P 1 2 as an example, the calculation method of the position data of the second vertex P 1 2 is:
[0058]
[0059] In the embodiments of the present application, after obtaining the position data of each second vertex in the projection model through the first rendering application, the first rendering application performs projection rendering according to the position data of each second vertex in the projection model, that is, generates a target projection for the target model, and the shape of the target projection is the same as the shape of the projection of the projection model. Exemplarily, when the first rendering application is the Unreal Engine, the Shadow Pass Switch node can be used to separate the calculation of the first vertices of the target model and the calculation of the shadow shape, and input the position data of each second vertex of the projection model obtained by restoring the calculation into the shadow interface, so that shadow rendering can be performed based on the position data of each second vertex of the projection model without changing the actual shape of the target model. Therefore, the present application can generate a target projection for the target model that has the same projection shape as the projection model, and can achieve a custom projection effect for the target model.
[0060] Next, in combination with Figure 2 , an exemplary description will be given of generating a custom projection effect for the target model using the model projection rendering method provided by the present application. Figure 2 FIG. is a schematic diagram of the effect of the projection generated for the target model provided by one embodiment of the present application.
[0061] As Figure 2 shown, the model projection rendering method provided by the present application is used to correct the projection or shadow of the brow ridge bulge of the game character around the eyes. As Figure 2 shown, the shadows generated by the brow ridge bulge around the eyes before and after correction. Compared with the shadow generated by the brow ridge bulge around the eyes before correction, the shadow generated by the brow ridge bulge around the eyes after correction makes the face of the game character more beautiful.
[0062] Compared with the prior art, the present application calculates the position offset data of each second vertex in the projection model relative to the corresponding first vertex in the target model through the second rendering application. In the first rendering application, the target model and the model position offset data are directly used, and here only the position data of each second vertex in the projection model is restored and calculated (without rendering the projection model), and shadow rendering is performed only based on the position data of each second vertex in the projection model to generate a projection for the target model. This process only needs to restore and calculate the position data of each second vertex in the projection model through the target model and the model position offset data, and then perform shadow rendering based on the position data of each second vertex in the projection model to generate a projection for the target model, without the need to bind complex bone binding relationships between the target model and the projection model. Therefore, the complexity and implementation difficulty of implementing a custom projection shape are greatly reduced, and a custom projection is generated for the target model in an efficient and easy-to-implement manner. At the same time, in only the first rendering application, only the target model is rendered, without rendering the projection model, and the final obtained file package is also smaller.
[0063] Based on the above embodiments, the rendering method of model projection provided in the embodiments of the present application will be further described below.
[0064] An optional implementation manner is that the three-dimensional space where the target model is located includes world position offset data, and the world position offset data is used to control the position offset of the models in the scene. The rendering method of model projection provided in the embodiments of the present application further includes steps A1 - A3:
[0065] A1. Through the first rendering application, perform position offset on the target model according to the world position offset data.
[0066] A2. Determine the position data of each second vertex in the projection model according to the position data of each first vertex in the target model and the model position offset data, including:
[0067] A3. Determine the position data of each second vertex in the projection model according to the position data of each first vertex in the target model after position offset and the model position offset data.
[0068] Next, steps A1 - A3 will be described in detail.
[0069] In 3D model rendering, world position offset (World Position Offset) generally refers to the change in the position of an object or its part in the world coordinate system relative to its original position. This effect can be used to achieve various visual effects, such as terrain deformation, animation, wave effects, etc. The reasons for bringing about world position offset include but are not limited to physical simulation, environmental factors, etc. For example only, the embodiments of the present application do not make any limitations in this regard. Among them, when applying a physics engine, virtual objects in the three-dimensional space may move due to factors such as gravity, collision, wind force, etc., and these physical interactions will cause the position of the virtual objects in the world space to change. Environmental factors such as natural phenomena like wind, water flow, and earthquake can also affect the position of virtual objects in the three-dimensional space.
[0070] In an embodiment of the present application, when there is a world position offset in the three-dimensional space where the target model is located, through the first rendering application, the target model is positionally offset according to the world position offset data, that is, all the first vertices in the target model are synchronously positionally offset according to the world position offset data, that is, the world position offset data is added to the position data of each first vertex, and thus the target model after the world position offset can be obtained. In order to synchronously perform a world position offset on the projection model, therefore, according to the position data of each first vertex in the target model after the position offset and the model position offset data, the position data of each second vertex in the projection model is determined. Specifically, for each second vertex, the sum of the position offset data corresponding to the second vertex in the model position offset data and the position data of the corresponding first vertex in the target model after the position offset is determined as the position data of the second vertex after the world position offset.
[0071] In the embodiment of the present application, the model position offset data between the target model and the projection model is loaded through the first rendering application. In this way, when the target model undergoes any deformation (such as a world position offset), only the position offset data needs to be added to the deformed target model to obtain the position data of each second vertex in the projection model after the synchronous deformation. Then, based on the position data of each second vertex in the projection model after the deformation, shadow rendering is performed to generate a projection that is synchronously deformed with the deformed target model, thereby driving the projection shape to change synchronously. The present application does not require complex bone binding operations, simplifying the implementation steps.
[0072] An optional implementation manner, before loading the target model and the model position offset data through the first rendering application, the rendering method of the model projection provided by the embodiment of the present application further includes steps B1 - B2:
[0073] B1. Load the target model through the second rendering application and deform the target model to obtain a projection model.
[0074] B2. Through the second rendering application, determine the model position offset data according to the position data of each first vertex in the target model and the position data of each second vertex in the projection model. The model position offset data is the position offset data of each second vertex in the projection model relative to the corresponding first vertex in the target model.
[0075] Next, steps B1 - B2 will be described in detail.
[0076] In the embodiments of the present application, through the second rendering application, the target model is loaded and deformed to obtain a projection model. In this way, the projection model obtained by deforming on the basis of the target model can more easily and quickly obtain a projection model different from the target model, and the projection shape of the projection model is a custom projection shape expected by the creator for the target model. Exemplarily, for the nasal bone model in the human face, assuming that the existing nasal bone model is small and narrow, which results in a small and narrow projection shape of the nasal bone model. In order to obtain a larger and wider projection shape, the existing nasal bone model can be deformed by increasing height and width. In this way, it is easier and faster to obtain a higher and wider nasal bone model, that is, the projection model. Then, based on this projection model for projection rendering, a larger and wider projection for the original nasal bone can be generated.
[0077] In the embodiments of the present application, through the second rendering application, according to the position data of each first vertex in the target model and the position data of each second vertex in the projection model, the model position offset data is determined. The model position offset data is the position offset data of each second vertex in the projection model relative to the corresponding first vertex in the target model. Specifically, for each second vertex in the projection model, the difference between the position data of the second vertex (such as the second vertex 1) in the projection model and the position data of the corresponding first vertex (such as the first vertex 1) in the target model is determined as the position offset between the second vertex 1 in the projection model and the first vertex 1 in the target model.
[0078] An optional implementation manner is that the model projection rendering method provided in the embodiments of the present application further includes step C1: C1. Through the second rendering application, the model position offset data is stored in the UV coordinate set, and the UV coordinate set is used to store the position offsets in any two dimensions or one dimension in the position offset data.
[0079] Then, on the basis of step C1, the specific implementation manner of "loading the model position offset data through the first rendering application" in the foregoing step S10 includes C2: C2. Through the first rendering application, the UV coordinate set is loaded to read the model position offset data from the UV coordinate set.
[0080] Next, steps C1 - C2 will be described in detail.
[0081] As described above, the UV coordinate set is a two-dimensional data set {(uv 1 .u, uv 1 .v), (uv 2 .u, uv 2 .v),...,(uv N .u, uv N.v)}. Therefore, a set of UV coordinates is used to store the position offset data in any two dimensions or one dimension. Therefore, if the projection model has a position offset only in any two coordinate dimensions or one coordinate dimension compared to the target model, only one set of UV coordinates is required. For example, if the projection model has a position offset in any X-axis coordinate dimension and Y-axis coordinate dimension and no position offset in the Z-axis compared to the target model, then a new set of UV coordinates is created for the target model, namely Taking the first vertex with vertex number i and the second vertex with vertex number i as an example, the position offset data of the second vertex with vertex number i relative to the first vertex with vertex number i in the X-axis coordinate dimension and Y-axis coordinate dimension are respectively stored in and where i ∈ [1, N].
[0082] If the projection model has a position offset in all three coordinate dimensions compared to the target model, then two sets of UV coordinates are required. For example, if the projection model has a position offset in any X-axis coordinate dimension, Y-axis coordinate dimension, and Z-axis coordinate dimension compared to the target model, then two new sets of UV coordinates, namely UV2 and UV3, are created for the target model, where Taking the first vertex with vertex number i and the second vertex with vertex number i as an example, the position offset data of the second vertex with vertex number i relative to the first vertex with vertex number i in the X-axis coordinate dimension, Y-axis coordinate dimension, and Z-axis coordinate dimension are respectively stored in in UV3 where the values in in UV3 are all zero.
[0084] In the embodiment of the present application, on the basis of step C1, through the first rendering application, the UV coordinate set of the target model is loaded to read the model position offset data from the UV coordinate set.
[0085] Exemplarily, one set of UV coordinates such as UV1 is read, and it is prompted that the U coordinate and V coordinate in the UV coordinate set UV1 are respectively used to represent the position offset in the X-axis coordinate dimension and Y-axis coordinate dimension, and there is no position offset in the Z-axis coordinate dimension of the projection model compared to the target model. Then, assuming UV1 = Taking the first vertex with vertex number i and the second vertex with vertex number i as an example, the position offset data of the second vertex with vertex number i relative to the first vertex with vertex number i in the X-axis coordinate dimension and Y-axis coordinate dimension are respectively stored in and Then, the position offset data of the second vertex with vertex number i obtained through the second rendering application relative to the first vertex with vertex number i is
[0086] Exemplarily, a UV coordinate set such as UV2 and UV3 is read, and it is prompted that the U coordinate and V coordinate in the UV coordinate set UV2 are respectively used to represent the position offsets in the X-axis coordinate dimension and Y-axis coordinate dimension, and it is prompted that the U coordinate in the UV coordinate set UV3 is used to represent the position offset in the Z-axis coordinate dimension. Then, assuming Taking the first vertex with vertex number i and the second vertex with vertex number i as examples above, the position offset data of the second vertex with vertex number i relative to the first vertex with vertex number i in the X-axis coordinate dimension, Y-axis coordinate dimension, and Z-axis coordinate dimension are respectively stored in in UV3 Then, the position offset data of the second vertex with vertex number i obtained through the second rendering application relative to the first vertex with vertex number i is
[0087] An optional implementation manner, the rendering method for model projection provided by the embodiments of the present application further includes step D1:
[0088] D1. Through the second rendering application, display a graphical user interface, which includes a target model loading control, a projection model loading control, a position offset calculation control, and a calculation progress display control. Among them, the target model loading control and the projection model loading control are respectively used to load the target model and the projection model, and the calculation progress display control is used to display the progress of calculating the position offset data of each second vertex in the projection model relative to the corresponding first vertex in the target model, for example, it can be a calculation progress bar.
[0089] In the embodiment of the present application, in the second rendering application, a graphical user interface, namely a visual model position offset data calculation interface, is displayed by running a script. In this graphical user interface, there are a target model loading control, a projection model loading control, a position offset calculation control, and a calculation progress display control. In this way, when the user opens this visual model position offset data calculation interface, the target model can be loaded through the target model loading control, and the projection model can be loaded through the projection model loading control. In the second rendering application, after successfully loading the target model and the projection model, the user triggers the position offset calculation control, that is, triggers the calculation of the position offset data of each second vertex in the projection model relative to the corresponding first vertex in the target model. During the calculation process, the calculation progress display control displays the progress of calculating the position offset data of each second vertex in the projection model relative to the corresponding first vertex in the target model. By providing this visual model position offset data calculation interface, it provides great convenience for the user to calculate the model position offset data through the second rendering application.
[0090] An optional implementation manner, the model projection rendering method provided by the embodiment of the present application further includes step D2:
[0091] D2. Create a UV coordinate set for the target model through the second rendering application, and store the position offset data in the UV coordinate set.
[0092] In the embodiment of the present application, in the second rendering application, in response to the calculation instruction of the model position offset data, a UV coordinate set is created for the target model, and during the process of calculating the position offset data of each second vertex in the projection model relative to the corresponding first vertex in the target model, the calculated position offset data of the second vertex relative to the corresponding first vertex in the target model is stored in the UV coordinate set.
[0093] Exemplarily, taking the second rendering application as Maya, by running a Maya script, a graphical user interface is displayed and a progress bar is initialized, which will show the calculation progress of the model position offset data. Subsequently, the user selects and loads the target model by triggering the target model loading control, and selects and loads the projection model by triggering the projection model loading control. Set or create a UV coordinate set as "offset1" to ensure that the calculated position offset data of the second vertex relative to the corresponding first vertex in the target model is stored on the UV coordinate set. Traverse the vertices of each first vertex in the target model and each second vertex in the projection model, and calculate the position offset data of each second vertex in the projection model relative to the corresponding first vertex in the target model. The calculated position offset data is applied to the UV coordinates of the "offset1" UV set of the target model, thus completing the storage of the vertex position offset. Update the calculation progress bar so that the user can understand the calculation progress. Finally, reset the calculation progress bar so that it can start over for the next calculation. The UI text can be updated by update_ui(): to display the names of the selected target model and projection model. The user interface of the tool can be created by create_ui(): including buttons, progress bars, and text labels. Set a script task to update the UI when the selection in the Maya scene changes. A button named "Transfer offset to UV", i.e., the position offset calculation control, is provided in the graphical user interface, and the offset calculation and storage of the position offset data can be performed by triggering the edit_uv_sets() function.
[0094] Next, the rendering device for model projection provided in the present application will be described. The rendering device for model projection described below can be correspondingly referred to the model projection rendering method described above.
[0095] Figure 4 It is a schematic structural diagram of a rendering device for model projection provided in one embodiment of the present application. As Figure 4 shown, the rendering device 400 for model projection includes: an acquisition module 401, a determination module 402, and a processing module 403.
[0096] The acquisition module is configured to load a target model and model position offset data through a first rendering application. The target model includes a first number of first vertices, and the projection model includes the first number of second vertices. The first vertices and the second vertices correspond one by one, and the vertex numbers of the first vertices are the same as the vertex numbers of the corresponding second vertices. The model position offset data is the position offset data of each second vertex in the projection model relative to the corresponding first vertex in the target model calculated through a second rendering application;
[0097] A determination module, configured to determine, through the first rendering application, position data of each of the second vertices in the projection model according to position data of each of the first vertices in the target model and the model position offset data;
[0098] A processing module, configured to perform shadow rendering through the first rendering application according to the position data of each of the second vertices, and generate a target projection for the target model, where a shape of the target projection is the same as a shape of a projection of the projection model.
[0099] An optional implementation manner, where the second rendering application and the first rendering application respectively use a first three-dimensional coordinate system and a second three-dimensional coordinate system, and a direction of a first coordinate axis in the first three-dimensional coordinate system and the second three-dimensional coordinate system is opposite; the determination module is further configured to:
[0100] Perform a negative processing on position data of each of the first vertices in the target model on the first coordinate axis to obtain updated position data of each of the first vertices;
[0101] Perform a negative processing on a position offset of each of the position offset data in the model position offset data on the first coordinate axis to obtain updated model position offset data.
[0102] An optional implementation manner, where a world position offset data is included in a three-dimensional space where the target model is located, and the world position offset data is used to control a position offset of a model in the scene; the determination module is further configured to:
[0103] Perform a position offset on the target model through the first rendering application according to the world position offset data;
[0104] Determine, according to position data of each of the first vertices in the target model after the position offset and the model position offset data, position data of each of the second vertices in the projection model.
[0105] An optional implementation manner, where the processing module is further configured to:
[0106] Load the target model through the second rendering application and perform a deformation on the target model to obtain the projection model;
[0107] Determine, through the second rendering application, model position offset data according to position data of each of the first vertices in the target model and position data of each of the second vertices in the projection model.
[0108] An optional implementation manner, where the processing module is further configured to:
[0109] Through the second rendering application, store the model position offset data into a UV coordinate set, where the UV coordinate set is used to store the position offsets in any two dimensions or one dimension in the position offset data;
[0110] The loading of the model position offset data through the first rendering application includes:
[0111] Through the first rendering application, load the UV coordinate set to read the model position offset data from the UV coordinate set.
[0112] An optional implementation, the device includes a display module, and the display module is specifically used for:
[0113] Through the second rendering application, display a graphical user interface, where the graphical user interface includes a target model loading control, a projection model loading control, a position offset calculation control, and a calculation progress display control; among them, the target model loading control and the projection model loading control are respectively used to load the target model and the projection model, and the calculation progress display control is used to display the progress of calculating the position offset data of each second vertex in the projection model relative to the corresponding first vertex in the target model.
[0114] An optional implementation, the processing module is further used for:
[0115] Through the second rendering application, create a UV coordinate set for the target model and store the position offset data into the UV coordinate set.
[0116] The rendering device for model projection provided in this embodiment can be used to execute the technical solutions of the method embodiment for rendering model projection above. Its implementation principle and technical effects are similar, and will not be elaborated here in this embodiment.
[0117] Figure 5 It is a schematic hardware structure diagram of an electronic device provided in one embodiment of the present application. As Figure 5 shown, the electronic device 500 in this embodiment includes: a processor 501 and a memory 502; where
[0118] The memory 502 is used to store computer execution instructions;
[0119] The processor 501 is used to execute the computer execution instructions stored in the memory to implement each step executed by the method for rendering model projection in the above embodiment. Specifically, reference can be made to the relevant descriptions in the foregoing method embodiment.
[0120] Optionally, the memory 502 can be either independent or integrated with the processor 501.
[0121] When the memory 502 is independently provided, the electronic device further includes a bus 505 for connecting the memory 502 and the processor 501.
[0122] One embodiment of the present application further provides a computer-readable storage medium storing computer-executable instructions, and when the processor executes the computer-executable instructions, the technical solution corresponding to the rendering method of model projection in any of the above embodiments executed by the above electronic device is implemented.
[0123] One embodiment of the present application further provides a computer program product, which includes: a computer program stored in a readable storage medium. At least one processor of the electronic device can read the computer program from the readable storage medium, and the at least one processor executes the computer program to enable the electronic device to execute the technical solution corresponding to the rendering method of model projection in any of the above embodiments.
[0124] Although the present application is disclosed above with preferred embodiments, it is not used to limit the present application. Any person skilled in the art can make possible changes and modifications without departing from the spirit and scope of the present application. Therefore, the protection scope of the present application should be subject to the scope defined by the claims of the present application.
[0125] In several embodiments provided by the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the modules is only a logical function division. In actual implementation, there may be other division methods. For example, multiple modules can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection to each other can be through some interfaces, and the indirect coupling or communication connection of the device or module can be in an electrical, mechanical or other form.
[0126] The above-mentioned integrated modules implemented in the form of software function modules can be stored in a computer-readable storage medium. The above-mentioned software function modules are stored in a storage medium, including several instructions to enable an electronic device (which can be a personal computer, a server, or a network device, etc.) or a processor (English: processor) to execute some steps of the methods described in various embodiments of the present application.
[0127] It should be understood that the above-mentioned processor may be a Central Processing Unit (CPU), or it may also be other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), etc. The general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the method disclosed in combination with the invention can be directly embodied as being executed and completed by a hardware processor, or by a combination of hardware and software modules in the processor.
[0128] The memory may include high-speed RAM memory, and may also include non-volatile storage NVM, such as at least one disk memory, and may also be a USB flash drive, a mobile hard disk, a read-only memory, a magnetic disk, or an optical disc, etc.
[0129] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of convenience in representation, the bus in the attached drawings of this application is not limited to only one bus or one type of bus.
[0130] The above-mentioned storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic memory, flash memory, a magnetic disk, or an optical disc. The storage medium can be any available medium that can be accessed by a general-purpose or special-purpose computer.
[0131] Those of ordinary skill in the art can understand that all or part of the steps of implementing the above method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps including the above method embodiments; and the aforementioned storage medium includes: ROM, RAM, magnetic disks, or optical discs and other media that can store program codes.
[0132] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements on some or all of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A rendering method for model projection, characterized in that: The method comprises: Loading a target model and model position offset data through a first rendering application, wherein the target model includes a first number of first vertices, the projection model includes the first number of second vertices, the first vertices correspond to the second vertices one-to-one, the vertex sequence numbers of the first vertices are the same as the vertex sequence numbers of the corresponding second vertices, and the model position offset data is the position offset data of each of the second vertices in the projection model relative to the corresponding first vertex in the target model, calculated through the second rendering application; Determining, by the first rendering application, the position data of each of the second vertices in the projection model according to the position data of each of the first vertices in the target model and the model position offset data; Shadow rendering is performed according to the position data of each of the second vertices through the first rendering application to generate a target projection for the target model, and the shape of the target projection is the same as the shape of the projection of the projection model.
2. The method according to claim 1, characterized in that The second rendering application and the first rendering application use a first three-dimensional coordinate system and a second three-dimensional coordinate system respectively, and first coordinate axes in the first three-dimensional coordinate system and the second three-dimensional coordinate system are in opposite directions; Before determining the position data of each second vertex in the projection model, the method further includes: Performing a negative processing on the position data of each of the first vertices in the target model on the first coordinate axis to obtain updated position data of each of the first vertices; The position offset of each position offset data in the model position offset data on the first coordinate axis is negatively processed to obtain updated model position offset data.
3. The method according to claim 1, characterized in that The three-dimensional space where the target model is located includes world position offset data, and the world position offset data is used to control the position offset of the model in the scene; the method also includes: By means of the first rendering application, performing a position offset on the target model according to the world position offset data; The determining, according to the position data of each first vertex in the target model and the model position offset data, the position data of each second vertex in the projection model comprises: The position data of each second vertex in the projection model is determined according to the position data of each first vertex in the target model after position shift and the model position shift data.
4. The method according to claim 1, characterized in that: Before the target model and the model position offset data are loaded by the first rendering application, the method further includes: By means of the second rendering application, the target model is loaded and the target model is deformed to obtain the projection model; Model position offset data is determined by the second rendering application according to the position data of each of the first vertices in the target model and the position data of each of the second vertices in the projection model.
5. The method according to claim 4, characterized in that The method further comprises: storing, by the second rendering application, the model position offset data in a UV coordinate set, wherein the UV coordinate set is used to store the position offset in any two dimensions or one dimension of the position offset data; The step of loading the model position offset data by the first rendering application includes: The UV coordinate set is loaded by the first rendering application to read the model position offset data from the UV coordinate set.
6. The method according to claim 1, characterized in that The method further comprises: A graphical user interface is displayed through the second rendering application, wherein the graphical user interface includes a target model loading control, a projection model loading control, a position offset calculation control, and a calculation progress display control; wherein the target model loading control and the projection model loading control are used to load the target model and the projection model, respectively, and the calculation progress display control is used to display the progress of calculating the position offset data of each second vertex in the projection model relative to the corresponding first vertex in the target model.
7. The method according to claim 6, characterized in that The method further comprises: A UV coordinate set is created for the target model through the second rendering application, and the position offset data is stored in the UV coordinate set.
8. A rendering device for model projection, characterized in that: The device comprises: an acquisition module, configured to load a target model and model position offset data through a first rendering application, wherein the target model includes a first number of first vertices, the projection model includes the first number of second vertices, the first vertices correspond to the second vertices one-to-one, the vertex sequence numbers of the first vertices are the same as the vertex sequence numbers of the corresponding second vertices, and the model position offset data is the position offset data of each of the second vertices in the projection model relative to the corresponding first vertex in the target model, obtained by calculating through the second rendering application; a determination module, configured to determine, by the first rendering application, the position data of each of the second vertices in the projection model according to the position data of each of the first vertices in the target model and the model position offset data; A processing module is used to perform shadow rendering according to the position data of each of the second vertices through the first rendering application, and generate a target projection for the target model, wherein the shape of the target projection is the same as the shape of the projection of the projection model.
9. An electronic device, characterized in that: The electronic device comprises: Processor; and The memory is used to store a data processing program. After the electronic device is powered on and the program is run by the processor, the rendering method for model projection according to any one of claims 1 to 7 is executed.
10. A computer-readable storage medium, characterized in that: A data processing program is stored, and the program is run by a processor to execute the rendering method for model projection as described in any one of claims 1 to 7.