Method and apparatus for dynamic color generation of models based on Unreal Engine
By obtaining and processing the material and dyeing area information of the 3D model in the Unreal engine, and rendering dynamic color parameters frame by frame, the problem of poor color switching effect of 3D model is solved, achieving a better user experience.
Patent Information
- Application Number
- CN202311214275.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-19
- Publication Date
- 2025-03-04
- Estimated Expiration
- 2043-09-19
AI Technical Summary
The current 3D model has poor color switching effect in the Unreal engine, resulting in a reduced user experience.
By obtaining the material information and dyeing area information of the target model, dynamic color parameters are obtained, and the dyeing area is rendered frame by frame according to these parameters to achieve dynamic color changes.
Improve the dynamic color switching effect of the 3D model and improve the user experience.
Smart Images

Figure CN117173313B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and in particular, to a method, apparatus, computer device, and computer-readable storage medium for generating dynamic color of a model based on an Unreal engine. Background Art
[0002] Unreal Engine is a comprehensive game engine that can be used to achieve real-time interactive experience, such as in game development, virtual reality (VR) and other fields. Unreal Engine can be used to set the appearance attributes and effects associated with 3D models, such as changing the color of a 3D model so that the 3D model switches from one color to another. However, the current 3D model color switching effect is poor, which reduces the user experience.
[0003] It should be noted that the above content is not necessarily prior art, nor is it intended to limit the scope of patent protection of this application. Summary of the invention
[0004] The embodiments of the present application provide a method, apparatus, computer device, and computer-readable storage medium for generating dynamic color of a model based on the Unreal engine to solve or alleviate one or more of the technical problems raised above.
[0005] One aspect of an embodiment of the present application provides a method for generating dynamic color of a model based on an Unreal engine, the method comprising:
[0006] Get the material information of the target model;
[0007] According to the material information, dyeing area information of each material on the target model is obtained, and the same dyeing area corresponds to the same color on each material at the same time;
[0008] Obtaining dynamic color parameters for the dyed area;
[0009] According to the dynamic color parameter, a frame color value corresponding to each frame of the dyeing area in the dynamic process is obtained;
[0010] The dyed area is dynamically rendered according to the frame color value corresponding to each frame to generate a target model with dynamically changing colors.
[0011] Optionally, the target model includes one or more materials, each material includes one or more color partitions; each color partition is provided with an identifier, and the color partitions belonging to the same dyeing area have the same identifier;
[0012] Correspondingly, obtaining the dynamic color parameters for the dyeing area includes:
[0013] According to the identifier of the color partition, obtaining a target color partition corresponding to the dyeing partition from the one or more materials;
[0014] The dynamic color parameter of the dyed area is used to instruct the target color partition to change dynamically.
[0015] Optionally, each material is associated with a dynamic sub-material, and the target color partition includes multiple sub-partitions;
[0016] Correspondingly, obtaining the dynamic color parameters for the dyeing area also includes:
[0017] Determine a plurality of target dynamic sub-materials corresponding one-to-one to the plurality of sub-partitions;
[0018] Corresponding dynamic color parameters are assigned to each target dynamic sub-material; the corresponding dynamic color parameters are one set of parameters in the dynamic color parameters of the dyeing area, which are used to instruct the corresponding sub-area to change dynamically.
[0019] Optionally, it also includes:
[0020] When the target material corresponding to the sub-partition has no dynamic sub-material set, a target dynamic sub-material corresponding to the target material is created.
[0021] Optionally, it also includes:
[0022] The target dynamic sub-material is cached in a preset data structure.
[0023] Optionally, it also includes:
[0024] In the case where the target material corresponding to the sub-partition has been set with a historical dynamic sub-material, the historical dynamic sub-material is set as the target dynamic sub-material.
[0025] Optionally, the dynamic color parameter of the dyeing area includes a first corresponding relationship between a color sequence of the dyeing area and a time period;
[0026] Correspondingly, according to the dynamic color parameter, obtaining the frame color value corresponding to each frame of the dyeing area in the dynamic process includes:
[0027] Set the preset display frame number;
[0028] Setting a second corresponding relationship between the preset display frame number and the time period;
[0029] According to the first corresponding relationship and the second corresponding relationship, a frame color value corresponding to each frame of the dyed area is obtained.
[0030] Optionally, it also includes:
[0031] Get the real-time display frame rate and the number of dynamic color objects rendered in the target model displayed on the same screen;
[0032] The number of dynamic color objects rendered in the target model is adjusted according to the real-time display frame rate so that the display frame number is a preset value.
[0033] Another aspect of an embodiment of the present application provides a device for dynamic color generation of a model based on an Unreal engine, the device comprising:
[0034] The first acquisition module is used to acquire material information of the target model;
[0035] A second acquisition module is used to acquire dyeing area information of each material on the target model according to the material information, wherein the same dyeing area corresponds to the same color on each material at the same time;
[0036] A third acquisition module is used to acquire dynamic color parameters for the dyeing area;
[0037] A fourth acquisition module, used for acquiring a frame color value corresponding to each frame of the dyeing area in a dynamic process according to the dynamic color parameter;
[0038] The rendering module is used to dynamically render the dyed area according to the frame color value corresponding to each frame to generate a target model with dynamically changing colors.
[0039] Another aspect of an embodiment of the present application provides a computer device, including:
[0040] at least one processor; and
[0041] a memory communicatively coupled to the at least one processor;
[0042] Wherein: the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method as described above.
[0043] Another aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the method described above is implemented.
[0044] The above technical solution adopted in the embodiment of the present application may have the following advantages:
[0045] The dyeing area of the target model and the dynamic color parameters of the dyeing area are obtained. According to the dynamic color parameters of the dyeing area, the frame color value corresponding to each frame of the dyeing area during the dynamic change process is determined. Then, according to the frame color value corresponding to each frame, the dyeing area is dynamically rendered frame by frame, so that the color of the target model continues to change dynamically with the number of frames, thereby improving the dynamic color switching effect of the target model and enhancing the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] The accompanying drawings exemplarily illustrate the embodiments and constitute a part of the specification, and together with the text description of the specification, are used to explain the exemplary implementation of the embodiments. The embodiments shown are for illustrative purposes only and do not limit the scope of the claims. In all drawings, the same reference numerals refer to similar but not necessarily identical elements.
[0047] Figure 1 The flowchart of the method for generating dynamic color of a model based on the Unreal engine according to the first embodiment of the present application is schematically shown;
[0048] Figure 2 A diagram schematically showing the relationship between model material and color partitions and dyeing areas in the first embodiment of the present application;
[0049] Figure 3 Schematically shows Figure 1 Flow chart of sub-steps of step S104;
[0050] Figure 4 The effect diagram of the model material and color partitioning and dyeing area in the first embodiment of the present application is schematically shown;
[0051] Figure 5 Schematically shows Figure 1 Flow chart of sub-steps of step S106;
[0052] Figure 6 A graph showing the relationship between the color value corresponding to the dyed area of the model in Example 1 of the present application and the change over time;
[0053] Figure 7 A newly added flow chart of the method for dynamic color generation of a model based on the Unreal engine according to the first embodiment of the present application is schematically shown;
[0054] Figure 8 A diagram schematically shows an application example of a method for generating dynamic color of a model based on the Unreal engine according to the first embodiment of the present application;
[0055] Fig. 9 A block diagram schematically shows a device for generating dynamic color of a model based on the Unreal engine according to the second embodiment of the present application; and
[0056] Fig.10 The hardware architecture diagram of the computer device according to the third embodiment of the present application is schematically shown. DETAILED DESCRIPTION
[0057] In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with 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 intended to limit the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0058] It should be noted that the descriptions involving "first", "second", etc. in the embodiments of the present application are only for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.
[0059] In the description of the present application, it should be understood that the numerical labels before the steps do not indicate the order in which the steps are executed, but are only used to facilitate the description of the present application and to distinguish each step, and therefore should not be understood as a limitation on the present application.
[0060] First, the following terms are explained:
[0061] Unreal Engine: A comprehensive game engine developed by Epic Games for creating interactive 3D and 2D content. Unreal Engine can be applied to game development, virtual reality (VR), augmented reality (AR), film production, architectural visualization and other fields.
[0062] Tint: A specific portion or area on a 3D model or object that can be used to control certain appearance or behavior characteristics of the object or character.
[0063] Material: A virtual material used to control and render the appearance of a target model. Through materials, you can define the visual and physical properties of an object, such as color, texture, gloss, reflection, transparency, etc.
[0064] Secondly, in order to facilitate those skilled in the art to understand the technical solutions provided in the embodiments of the present application, the relevant technologies are described below:
[0065] Unreal Engine can be used to achieve real-time interactive experience, such as in game development, virtual reality (VR) and other fields. Unreal Engine can be used to set the appearance attributes and effects associated with 3D models, such as changing the color of a 3D model so that the 3D model switches from one color to another. However, the current 3D model color switching effect is poor, which reduces the user experience.
[0066] To this end, an embodiment of the present application provides a technical solution for model dynamic color generation based on the Unreal engine. In this technical solution: (1) For the same 3D model, different dynamic color effect parameters can be set to achieve the dynamic effect of the model changing in different time periods and in multiple different colors. (2) Different color transition algorithms can be replaced so that different dynamic color change effects can be achieved in the same time period and color sequence. (3) In the engine or when the game is running, the content of the functional module can be flexibly adjusted according to the actual needs to achieve a smooth 3D model color dynamic change effect. See below for details.
[0067] Embodiment 1
[0068] Figure 1 The flowchart of the method for dynamic color generation of a model based on the Unreal engine according to the first embodiment of the present application is schematically shown.
[0069] like Figure 1 As shown, the method for generating dynamic color of a model based on the Unreal engine may include steps S100 to S108, wherein:
[0070] Step S100, obtaining material information of the target model.
[0071] Step S102, obtaining the dyeing area information of each material on the target model according to the material information, wherein the same dyeing area corresponds to the same color on each material at the same time.
[0072] Step S104, obtaining dynamic color parameters for the dyeing area.
[0073] Step S106, obtaining a frame color value corresponding to each frame of the dyed area in the dynamic process according to the dynamic color parameter.
[0074] Step S108 , dynamically rendering the dyed area according to the frame color value corresponding to each frame to generate a target model with dynamically changing colors.
[0075] The method for generating dynamic colors of a model based on the Unreal engine provided in this embodiment obtains the dyeing area of the target model and the dynamic color parameters of the dyeing area. According to the dynamic color parameters of the dyeing area, the frame color value corresponding to each frame of the dyeing area during the dynamic change process is determined. Then, according to the frame color value corresponding to each frame, the dyeing area is dynamically rendered frame by frame, so that the color of the target model continues to change dynamically with the number of frames, thereby improving the dynamic color switching effect of the target model and enhancing the user experience.
[0076] The following combination Figure 1 , each step in steps S100 to S108 and other optional steps are described in detail.
[0077] Step S100 , get the material information of the target model.
[0078] The target model may be a 3D model generated based on the Unreal engine, which refers to a virtual object or object in a three-dimensional space, and may be a character, scene, object, building, or other object in a game world. In an exemplary application, the target model may be a clothing object such as a top or a skirt, or may be other objects.
[0079] The material information may be setting information of material properties used to render and present the target model. The appearance of the target model may be determined based on the material information, such as visual characteristics such as color, texture, reflection, illumination, transparency, etc. Exemplarily, the material information may include color partition information on a map, color partition mark information on a material, etc.
[0080] Step S102 , according to the material information, the dyeing area information of each material on the target model is obtained, and the same dyeing area corresponds to the same color on each material at the same time.
[0081] A target model may include one or more dyed regions. In an exemplary application, Figure 2 As shown, the target model includes two dyeing areas, namely, dyeing area 1 "orange" and dyeing area 2 "blue".
[0082] Each dyeing area may include one or more color partitions, and the colors of the one or more color partitions are the same. It should be noted that by modifying the color of a dyeing area, the colors of the one or more color partitions corresponding to the dyeing area can be changed at the same time, and the colors of the one or more color partitions are the same.
[0083] Step S104 , obtain dynamic color parameters for the dyeing area.
[0084] Each dyeing area corresponds to a set of dynamic color parameters. When designing the target model, the corresponding dynamic color parameters can be modified in real time in the engine or in-game interface to adjust the specific color value and dynamic change duration of the dyeing area in real time, and preview the dynamic color change effect of the dyeing area.
[0085] In an optional embodiment, the target model includes one or more materials, each material includes one or more color partitions. Each color partition is provided with an identifier, and the color partitions belonging to the same dyeing area have the same identifier.
[0086] Correspondingly, the step 204 may also include:
[0087] According to the identifier of the color partition, a target color partition corresponding to the dyeing partition is obtained from the one or more materials.
[0088] The dynamic color parameter of the dyed area is used to instruct the target color partition to change dynamically.
[0089] The material is a virtual material used to control and render the appearance of the target model. Through the material, the visual attributes of the target model, such as color, lighting, texture, etc., can be defined. And the material can use a map to divide a plurality of different color partitions.
[0090] The identifier is used to identify which dye region each color partition on the material belongs to.
[0091] In the above optional embodiment, based on the identifier of the color partition, the target color partition corresponding to the dyeing area can be quickly obtained from one or more materials in the target model, thereby improving the efficiency of obtaining the target color partition corresponding to the dyeing area, and further improving the efficiency of dynamic color change of the target color partition.
[0092] In an optional embodiment, each material is associated with a dynamic sub-material, and the target color partition includes multiple sub-partitions. Figure 3 As shown, the step 104 further includes:
[0093] Step S300, determining a plurality of target dynamic sub-materials corresponding one-to-one to the plurality of sub-partitions.
[0094] Step S300, assigning corresponding dynamic color parameters to each target dynamic sub-material. The corresponding dynamic color parameters are a group of parameters in the dynamic color parameters of the dyeing area, and are used to instruct the corresponding sub-area to change dynamically.
[0095] The dynamic sub-material is a material instance that is dynamically created and modified at runtime. Dynamic sub-materials allow the properties of materials, such as color, texture, lighting, transparency, etc., to be modified in real time while the game or application is running, thereby achieving dynamic visual effects and interactivity of the target model.
[0096] The target color partition may include multiple sub-partitions, and the multiple sub-partitions have the same identifier and are marked as belonging to the same dyeing area. Figure 4 As shown, the dyeing area 1 includes the following sub-areas: sub-area A2, sub-area B1, and sub-area C2. It should be noted that by modifying the color of the dyeing area, the colors of multiple sub-areas corresponding to the dyeing area can be changed at the same time.
[0097] In an exemplary application, such as Figure 4 As shown, the target model may include three materials, namely material A, material B, and material C. Correspondingly, the target model may include three dynamic sub-materials, specifically: material A is associated with dynamic sub-material A, material B is associated with dynamic sub-material B, and material C is associated with dynamic sub-material C. In addition, the target model includes two dyeing areas, namely dyeing area 1 and dyeing area 2. Among them, dyeing area 1 includes the following sub-partitions: sub-partition A2, sub-partition B1, and sub-partition C2. Dyeing area 2 includes the following sub-partitions: sub-partition A1, sub-partition A3, sub-partition B2, sub-partition C1, and sub-partition C3. According to the association relationship between the material and the dynamic sub-material, the target dynamic sub-material corresponding to each sub-partition can be determined. Specifically: the target dynamic sub-material corresponding to sub-partition A2 is dynamic sub-material A; the target dynamic sub-material corresponding to sub-partition B1 is dynamic sub-material B; the target dynamic sub-material corresponding to partition C2 is dynamic sub-material C. Correspondingly, the correspondence between the sub-partitions in dyeing area 2 and the target dynamic sub-materials is as follows: the target dynamic sub-material corresponding to sub-partition A1 is dynamic sub-material A; the target dynamic sub-material corresponding to sub-partition A3 is dynamic sub-material A; the target dynamic sub-material corresponding to sub-partition B2 is dynamic sub-material B; the target dynamic sub-material corresponding to sub-partition C1 is dynamic sub-material C; the target dynamic sub-material corresponding to sub-partition C3 is dynamic sub-material C.
[0098] In the above optional embodiment, the target dynamic sub-material corresponding to the sub-partition is determined, and then the corresponding dynamic color parameters are assigned to the target dynamic sub-material, so that the color of the corresponding sub-partition can be dynamically changed according to the target dynamic sub-material to which the corresponding dynamic color parameters are assigned, thereby improving the color switching effect of the target model.
[0099] In an optional embodiment, the method further comprises:
[0100] When the target material corresponding to the sub-partition has no dynamic sub-material set, a target dynamic sub-material corresponding to the target material is created.
[0101] In an exemplary application, it is determined whether the target material corresponding to the sub-partition in the target model is the first time to set the dynamic sub-material. If the target material is not set with the corresponding dynamic color effect, that is, the dynamic sub-material is not set, a target dynamic sub-material corresponding to the target material is created and stored in the target material.
[0102] In the above optional embodiment, when the target material corresponding to the sub-partition has not set a dynamic sub-material, a target dynamic sub-material corresponding to the target material is created, so that the real-time dynamic change of the target model color can be realized according to the created target dynamic sub-material, thereby improving the color switching effect of the target model.
[0103] In an optional embodiment, the method may further include: caching the target dynamic sub-material in a preset data structure.
[0104] The data structure may exist in the form of an array or a structure, etc. It should be noted that the data structure may be arranged according to the color partitions in the corresponding material to improve the efficiency of subsequent search for the corresponding material according to the color. In the above optional embodiment, caching the target dynamic sub-material in a preset data structure can improve the efficiency of accessing the target dynamic sub-material when the target model performs dynamic color changes.
[0105] In an optional embodiment, the method may further include:
[0106] In the case where the target material corresponding to the sub-partition has been set with a historical dynamic sub-material, the historical dynamic sub-material is set as the target dynamic sub-material.
[0107] In an exemplary application, it is determined whether the target material corresponding to the sub-partition in the target model is set to a dynamic sub-material for the first time. If the target material has created a historical dynamic sub-material, that is, the target material has been set with a historical dynamic sub-material, the historical dynamic sub-material is set as the target dynamic sub-material.
[0108] In the above optional embodiment, the historical dynamic sub-material is set as the target dynamic sub-material, so that when the color of the sub-partition is modified subsequently, the dynamic sub-material can be directly used without having to create a corresponding dynamic sub-material each time the color of the sub-partition is modified, thereby reducing the occurrence of running jams caused by multiple creation of dynamic sub-materials.
[0109] Step S106 , according to the dynamic color parameter, obtain the frame color value corresponding to each frame of the dyeing area in the dynamic process.
[0110] The frame color value refers to the color attribute value of the dyed area in each frame (a single image frame in a game or animation) during the dynamic change process. The frame color value can be a color vector, and the frame color value can be represented in a variety of ways, such as RGB (red, green, blue), HSV (hue, saturation, brightness), CMYK (cyan, magenta, yellow, and key), etc. For example, when the frame color value is represented by RGB, it can be (R=255, G=0, B=0).
[0111] In an optional embodiment, the dynamic color parameter of the dyeing area includes a first correspondence between a color sequence of the dyeing area and a time period. Figure 5 As shown, step 106 includes:
[0112] Step 500, setting a preset display frame number.
[0113] Step 500: setting a second corresponding relationship between the preset display frame number and the time period.
[0114] Step 500: Obtain a frame color value corresponding to each frame of the dyed area according to the first corresponding relationship and the second corresponding relationship.
[0115] The dynamic color change parameters of the dyeing area may also include: the corresponding color sequence combination of the sub-time period in the time period of the dynamic color change. Exemplarily, the time period of the dynamic color change of the dyeing area is 0-8 seconds, and the color changes from red to yellow. Wherein, the time period may include multiple sub-time periods, and the multiple sub-time periods may correspond to different color changes, specifically: in the sub-time period of 0-2 seconds, the color of the dyeing area changes from red to orange; in the sub-time period of 2-5 seconds, the color of the dyeing area changes from orange to red; in the sub-time period of 5-6 seconds, the color of the dyeing area changes from red to orange, and in the sub-time period of 5-6 seconds, the color of the dyeing area changes from orange to yellow. It should be noted that the color and time corresponding to the sub-time period can be selected according to actual conditions, and are not limited here.
[0116] The color sequence can be used to describe the sequence of color changes of the dyeing area over time. The time period can be the time period of the color change of the dyeing area. It should be noted that the color sequence and time period in the dynamic color change parameter can be designed according to actual needs to achieve the effect of dynamic change of the target model in different time periods and different colors.
[0117] In an exemplary application, such as Figure 4As shown, assuming that the time period of dyeing area 1 is 2 seconds, the frame color value is expressed in RGB (red, green, blue), and the color sequence of the dyeing area is: dynamically changing from orange to blue, that is, the RGB color value of dyeing area 1 changes from orange (237, 125, 49) to blue (91, 155, 213). Correspondingly, the partial corresponding relationship in the first corresponding relationship can be: when dyeing area 1 is at 0 seconds, the RGB color value is orange (237, 125, 49), when dyeing area 1 is at 1 second, the RGB color value is (200, 130, 100), when dyeing area 1 is at 1.5 seconds, the RGB color value is (150, 140, 160), and when dyeing area 1 is at 2 seconds, the RGB color value is blue (91, 155, 213). It should be noted that the first time corresponding relationship can be set according to actual conditions and is not limited here.
[0118] The preset display frame rate is the display frame rate required in the engine or the game. For example, the preset display frame rate may be 30 frames per second or 60 frames per second.
[0119] In an exemplary application, the preset display frame number may be 30 frames per second, and the time period may be 2 seconds. According to the preset display frame number, the time period is associated with the preset display frame number to obtain a second corresponding relationship. A partial corresponding relationship in the second corresponding relationship may be: at 0 seconds, the dyed area is at the 0th frame; at 1 second, the dyed area is at the 30th frame; at 1.5 seconds, the dyed area is at the 45th frame; at 2 seconds, the dyed area is at the 60th frame.
[0120] In an exemplary application, the frame color value corresponding to each frame of the dyeing area in the time period of the color dynamic change process can be obtained according to the color transition algorithm. The color transition algorithm can be selected according to the actual situation such as the color representation method of the dyeing area, the corresponding relationship between the color sequence and the number of frames (such as linear or nonlinear). The color transition algorithm can be: (1) Linear interpolation (Lerp): Create transition colors by linear interpolation between two colors. For example, in the RGB color space, linear interpolation from red to green can be performed on each color channel separately. Linear interpolation between red (255, 0, 0) and green (0, 255, 0) will produce various yellow tones. (2) Bezier Curve: Create complex color transition effects by defining colors on control points. (3) HSL / HSV transition: A color transition algorithm based on the HSL (hue, saturation, brightness) or HSV (hue, saturation, brightness) color model. The HSL / HSV transition algorithm allows transition on the hue wheel, so that the target model achieves a more natural color transition effect. It should be noted that when obtaining the frame color value corresponding to each frame of the dyed area, different color transition algorithms can be selected according to actual conditions, so that the dyed area can achieve different color change effects within the time period and when the color sequence is the same, thereby improving the dynamic color switching effect of the target model and enhancing the user experience.
[0121] In the above optional embodiment, the frame color value corresponding to each frame of the dyeing area is obtained according to the first corresponding relationship and the second corresponding relationship, so that the dyeing area can be rendered frame by frame according to the frame color value corresponding to each frame, thereby improving the dynamic color change effect of the dyeing area.
[0122] Step S108 , dynamically rendering the dyed area according to the frame color value corresponding to each frame to generate a target model with dynamically changing colors.
[0123] In an exemplary application, such as Figure 6 As shown, the frame color value of each frame of the dyeing area 1 can change with the number of frames. The dyeing area 1 includes the following sub-partitions: sub-partition A2, sub-partition B1, and sub-partition C2. The RGB color value of the dyeing area 1 at 0 frames is orange (237, 125, 49), the RGB color value of the dyeing area 1 at 30 frames is blue (91, 155, 213), and the RGB color value of the dyeing area 1 at 60 frames is orange (237, 125, 49). According to Figure 6The frame color value corresponding to each frame shown dynamically renders the dyeing area, so that the color of the dyeing area 1 changes from orange to blue at 0-1s, and then changes from blue to the initial color (orange) within 1-2s. The dyeing area 1 can cycle this dynamic color change process. Correspondingly, the color changes of the sub-areas corresponding to the dyeing area 1, that is, the sub-area A2, the sub-area B1, and the sub-area C2 are the same as those of the dyeing area 1.
[0124] In some embodiments, multiple dynamic color change schemes can be applied to the target model. When previewing the effects of different color schemes, there is no need to switch back and forth multiple times to preview the color of the target model. The corresponding dynamic color change scheme can be directly pulled from the server to automatically perform dynamic color change operations on the target model.
[0125] In an optional embodiment, if Figure 7 As shown, the method also includes:
[0126] Step 700, obtaining the real-time display frame rate and the number of dynamic color objects rendered in the target model displayed on the same screen;
[0127] Step 702: adjusting the number of dynamic color objects rendered in the target model according to the real-time display frame rate so that the display frame number is a preset value.
[0128] The more dynamic color objects are rendered in the target model displayed on the same screen, the lower the frame rate of the game will run. For example, when the number of dynamic color objects rendered is 1, the frame rate of the game can be 60, and when the number of dynamic color objects rendered is 5, the frame rate of the game may be reduced to 30 frames. In order to keep the frame rate stable, the number of dynamic color objects rendered in the target model displayed on the same screen can be adjusted. Exemplarily, the changes in the game running frame rate can be monitored in real time. When the frame rate is reduced, certain effects can be turned off, that is, the number of dynamic color objects rendered in the target model is reduced, so that the frame rate remains stable.
[0129] In the above optional embodiment, the number of dynamic color objects rendered in the target model is adjusted according to the real-time display frame rate so that the display frame number is a preset value, thereby keeping the display frame number stable, so that the frame color value corresponding to each frame of the dyeing area can be obtained according to the stable display frame number, thereby ensuring that the dyeing area can be dynamically rendered frame by frame according to the frame color value corresponding to each frame, thereby achieving the effect that the color of the target model continues to dynamically change with the frame number.
[0130] In order to make this application easier to understand, the following Figure 8 An exemplary application is provided.
[0131] In this exemplary application, the target model includes one or more materials, each material includes one or more color partitions. The target model includes one or more dyeing areas, each dyeing area (same color) includes one or more sub-partitions, and the one or more sub-partitions can be from different materials. Each sub-partition is provided with an identifier, and the sub-partitions belonging to the same dyeing area have the same identifier.
[0132] S11, obtaining material information of the target model;
[0133] S12, obtaining a dyeing area of the target model according to the material information;
[0134] S13, determining whether the target material is set as a target dynamic sub-material, specifically:
[0135] S131, not set, create target dynamic sub-material;
[0136] S132, set, historical dynamic sub-material as target dynamic sub-material;
[0137] S14, obtaining dynamic color parameters for the dyeing area, specifically:
[0138] ① According to the identifier of the color partition, a target color partition corresponding to the dyeing partition is obtained from the material; the target color partition includes multiple sub-partitions.
[0139] ② Determine the target dynamic sub-material corresponding to each sub-partition;
[0140] ③Assign corresponding dynamic color parameters to each target dynamic sub-material.
[0141] S15, according to the dynamic color parameter, obtaining the frame color value corresponding to each frame of the dyeing area in the dynamic process, specifically:
[0142] ①Set the preset display frame number;
[0143] ② Setting the second corresponding relationship between the preset display frame number and the time period;
[0144] ③According to the dynamic color parameters of the dyeing area (the first corresponding relationship) and the second corresponding relationship, the frame color value corresponding to each frame of the dyeing area is obtained.
[0145] S16, dynamically rendering the dyed area according to the frame color value corresponding to each frame.
[0146] Embodiment 2
[0147] Fig. 9The block diagram of the model dynamic color generation device based on the Unreal engine according to the second embodiment of the present application is schematically shown. The model dynamic color generation device based on the Unreal engine can be divided into one or more program modules, and one or more program modules are stored in a storage medium and executed by one or more processors to complete the embodiment of the present application. The program module referred to in the embodiment of the present application refers to a series of computer program instruction segments that can complete specific functions. The following description will specifically introduce the functions of each program module in this embodiment. Fig. 9 As shown, the Unreal engine-based model dynamic color generation device 900 may include: a first acquisition module 910, a second acquisition module 920, a third acquisition module 930, a fourth acquisition module 940, and a rendering module 950, wherein:
[0148] A first acquisition module 910 is used to acquire material information of a target model;
[0149] The second acquisition module 920 is used to acquire the dyeing area information of each material on the target model according to the material information, and the same dyeing area corresponds to the same color on each material at the same time;
[0150] A third acquisition module 930 is used to acquire dynamic color parameters for the dyeing area;
[0151] A fourth acquisition module 940 is used to acquire a frame color value corresponding to each frame of the dyeing area in a dynamic process according to the dynamic color parameter;
[0152] The rendering module 950 is used to dynamically render the dyed area according to the frame color value corresponding to each frame to generate a target model with dynamically changing colors.
[0153] As an optional embodiment, the target model includes one or more materials, each material includes one or more color partitions; each color partition is provided with an identifier, and the color partitions belonging to the same dyeing area have the same identifier;
[0154] Correspondingly, the third acquisition module 930 is further used for:
[0155] According to the identifier of the color partition, obtaining a target color partition corresponding to the dyeing partition from the one or more materials;
[0156] The dynamic color parameter of the dyed area is used to instruct the target color partition to change dynamically.
[0157] As an optional embodiment, each material is associated with a dynamic sub-material, and the target color partition includes a plurality of sub-partitions;
[0158] Correspondingly, the third acquisition module 930 is further used for:
[0159] Determine a plurality of target dynamic sub-materials corresponding one-to-one to the plurality of sub-partitions;
[0160] Corresponding dynamic color parameters are assigned to each target dynamic sub-material; the corresponding dynamic color parameters are one set of parameters in the dynamic color parameters of the dyeing area, which are used to instruct the corresponding sub-area to change dynamically.
[0161] As an optional embodiment, the device further includes a creation module, wherein the creation module is configured to:
[0162] When the target material corresponding to the sub-partition has no dynamic sub-material set, a target dynamic sub-material corresponding to the target material is created.
[0163] As an optional embodiment, the device further includes a cache module, and the cache module is used to:
[0164] The target dynamic sub-material is cached in a preset data structure.
[0165] As an optional embodiment, the device further includes a setting module, wherein the setting module is used to:
[0166] In the case where the target material corresponding to the sub-partition has been set with a historical dynamic sub-material, the historical dynamic sub-material is set as the target dynamic sub-material.
[0167] As an optional embodiment, the dynamic color parameter of the dyeing area includes a first corresponding relationship between a color sequence of the dyeing area and a time period;
[0168] Correspondingly, the fourth acquisition module 940 is further used for:
[0169] Set the preset display frame number;
[0170] Setting a second corresponding relationship between the preset display frame number and the time period;
[0171] According to the first corresponding relationship and the second corresponding relationship, a frame color value corresponding to each frame of the dyed area is obtained.
[0172] As an optional embodiment, the device further includes an adjustment module, wherein the adjustment module is configured to:
[0173] Get the real-time display frame rate and the number of dynamic color objects rendered in the target model displayed on the same screen;
[0174] The number of dynamic color objects rendered in the target model is adjusted according to the real-time display frame rate so that the display frame number is a preset value.
[0175] Embodiment 3
[0176] Fig.10 The schematic diagram of the hardware architecture of a computer device 10000 suitable for implementing the method for dynamic color generation of models based on the Unreal engine according to the third embodiment of the present application is schematically shown. In some embodiments, the computer device 10000 may be a terminal device such as a smart phone, a wearable device, a tablet computer, a personal computer, a vehicle terminal, a game console, a virtual device, a workbench, a digital assistant, a set-top box, a robot, etc. In other embodiments, the computer device 10000 may be a rack server, a blade server, a tower server, or a cabinet server (including an independent server, or a server cluster composed of multiple servers), etc. Fig.10 As shown, the computer device 10000 includes but is not limited to: a memory 10010, a processor 10020, and a network interface 10030 that can communicate with each other through a system bus. Among them:
[0177] The memory 10010 includes at least one type of computer-readable storage medium, and the readable storage medium includes a flash memory, a hard disk, a multimedia card, a card-type memory (such as an SD or DX memory), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory 10010 may be an internal storage module of the computer device 10000, such as a hard disk or a memory of the computer device 10000. In other embodiments, the memory 10010 may also be an external storage device of the computer device 10000, such as a plug-in hard disk equipped on the computer device 10000, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the memory 10010 may also include both the internal storage module of the computer device 10000 and its external storage device. In this embodiment, the memory 10010 is generally used to store the operating system and various application software installed in the computer device 10000, such as the program code of the method for generating dynamic color of the model based on the Unreal engine, etc. In addition, the memory 10010 can also be used to temporarily store various data that have been output or will be output.
[0178] In some embodiments, the processor 10020 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other chips. The processor 10020 is generally used to control the overall operation of the computer device 10000, such as performing control and processing related to data interaction or communication with the computer device 10000. In this embodiment, the processor 10020 is used to run the program code stored in the memory 10010 or process data.
[0179] The network interface 10030 may include a wireless network interface or a wired network interface, and the network interface 10030 is generally used to establish a communication link between the computer device 10000 and other computer devices. For example, the network interface 10030 is used to connect the computer device 10000 to an external terminal through a network, and to establish a data transmission channel and a communication link between the computer device 10000 and the external terminal. The network may be a wireless or wired network such as an intranet, the Internet, the Global System of Mobile communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G network, Bluetooth, Wi-Fi, etc.
[0180] It should be pointed out that Fig.10 Only a computer device having components 10010 - 10030 is shown, but it should be understood that implementation of all of the components shown is not a requirement, and more or fewer components may alternatively be implemented.
[0181] In this embodiment, the method for dynamic color generation of models based on the Unreal engine stored in the memory 10010 can also be divided into one or more program modules and executed by one or more processors (such as processor 10020) to complete the embodiment of the present application.
[0182] Embodiment 4
[0183] An embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, wherein when the computer program is executed by a processor, the steps of the method for dynamic color generation of a model based on the Unreal engine in the embodiment are implemented.
[0184] In the present embodiment, the computer-readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEP ROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the computer-readable storage medium can be an internal storage unit of a computer device, such as a hard disk or memory of the computer device. In other embodiments, the computer-readable storage medium can also be an external storage device of a computer device, such as a plug-in hard disk equipped on the computer device, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the computer-readable storage medium can also include both the internal storage unit of the computer device and its external storage device. In the present embodiment, the computer-readable storage medium is generally used to store the operating system and various application software installed in the computer device, such as the program code of the method for dynamic color generation of the model based on the Unreal engine in the embodiment, etc. In addition, the computer-readable storage medium can also be used to temporarily store various data that have been output or are about to be output.
[0185] Obviously, those skilled in the art should understand that the modules or steps of the above-mentioned embodiments of the present application can be implemented by general-purpose computer devices, they can be concentrated on a single computer device, or distributed on a network composed of multiple computer devices, optionally, they can be implemented by executable program codes of computer devices, so that they can be stored in a storage device and executed by the computer device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. In this way, the embodiments of the present application are not limited to any specific combination of hardware and software.
[0186] It should be noted that the above are only preferred embodiments of the present application, and the patent protection scope of the present application is not limited thereto. Any equivalent structure or equivalent process transformation made using the contents of the specification and drawings of the present application, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A method for generating dynamic color of a model based on Unreal engine, characterized in that: The method comprises: Get the material information of the target model; According to the material information, dyeing area information of each material on the target model is obtained, and the same dyeing area corresponds to the same color on each material at the same time; Obtaining dynamic color parameters for the dyed area; According to the dynamic color parameter, a frame color value corresponding to each frame of the dyeing area in the dynamic process is obtained; Dynamically rendering the dyed area according to the frame color value corresponding to each frame to generate a target model with dynamically changing color; The target model includes one or more materials, each material includes one or more color partitions; each color partition is provided with an identifier, and the color partitions belonging to the same dyeing area have the same identifier; Correspondingly, obtaining the dynamic color parameters for the dyeing area includes: According to the identifier of the color partition, obtaining a target color partition corresponding to the dyed area from the one or more materials; The dynamic color parameter of the dyed area is used to instruct the target color partition to change dynamically.
2. The method according to claim 1, characterized in that: Each material is associated with a dynamic sub-material, and the target color partition includes multiple sub-partitions; Correspondingly, obtaining the dynamic color parameters for the dyeing area also includes: Determine a plurality of target dynamic sub-materials corresponding one-to-one to the plurality of sub-partitions; Corresponding dynamic color parameters are assigned to each target dynamic sub-material; the corresponding dynamic color parameters are one set of parameters in the dynamic color parameters of the dyeing area, which are used to instruct the corresponding sub-area to change dynamically.
3. The method according to claim 2, characterized in that Also includes: When the target material corresponding to the sub-partition has no dynamic sub-material set, a target dynamic sub-material corresponding to the target material is created.
4. The method according to claim 2, characterized in that: Also includes: The target dynamic sub-material is cached in a preset data structure.
5. The method according to claim 2, characterized in that: Also includes: In the case where the target material corresponding to the sub-partition has been set with a historical dynamic sub-material, the historical dynamic sub-material is set as the target dynamic sub-material.
6. The method according to any one of claims 1 to 4, characterized in that: The dynamic color parameter of the dyeing area includes a first corresponding relationship between a color sequence of the dyeing area and a time period; Correspondingly, according to the dynamic color parameter, obtaining the frame color value corresponding to each frame of the dyeing area in the dynamic process includes: Set the preset display frame number; Setting a second corresponding relationship between the preset display frame number and the time period; According to the first corresponding relationship and the second corresponding relationship, a frame color value corresponding to each frame of the dyed area is obtained.
7. The method according to any one of claims 1 to 4, characterized in that: Also includes: Get the real-time display frame rate and the number of dynamic color objects rendered in the target model displayed on the same screen; The number of dynamic color objects rendered in the target model is adjusted according to the real-time display frame rate so that the display frame number is a preset value.
8. A device for generating dynamic color of a model based on Unreal engine, characterized in that: The device comprises: The first acquisition module is used to acquire material information of the target model; A second acquisition module is used to acquire dyeing area information of each material on the target model according to the material information, wherein the same dyeing area corresponds to the same color on each material at the same time; A third acquisition module is used to acquire dynamic color parameters for the dyeing area; A fourth acquisition module, used for acquiring a frame color value corresponding to each frame of the dyeing area in a dynamic process according to the dynamic color parameter; A rendering module, used for dynamically rendering the dyed area according to the frame color value corresponding to each frame, so as to generate a target model with dynamically changing color; The target model includes one or more materials, each material includes one or more color partitions; each color partition is provided with an identifier, and the color partitions belonging to the same dyeing area have the same identifier; Correspondingly, obtaining the dynamic color parameters for the dyeing area includes: According to the identifier of the color partition, obtaining a target color partition corresponding to the dyed area from the one or more materials; The dynamic color parameter of the dyed area is used to instruct the target color partition to change dynamically.
9. A computer device, characterized in that: include: at least one processor; and a memory communicatively connected to the at least one processor; wherein: The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Virtual image generation method and device, electronic equipment and readable storage medium
CN114820905A
A real-time rendering method and device using temporalcoherency
KR1020010047622A