Model rendering method and device and electronic equipment
By determining and rendering the background color and color parameters in realistic animal models and rendering them in combination with maps, the problems of high production cost and low efficiency in the existing technology are solved, and efficient and realistic fur pattern rendering effect is achieved.
Patent Information
- Application Number
- CN202411832564.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-12
- Publication Date
- 2025-05-06
AI Technical Summary
In the prior art, the fur pattern texture maps of realistic animal models need to be manually made, resulting in high production cost and low efficiency, and programmatic random textures may cause the results to deviate from the preset direction and are not realistic enough.
By obtaining the target model and its appearance map, including the background map and the suit map, determine the background and suit parameters within the preset color range, and render it in combination with the map, and control the distribution of the suit effects to achieve the rendering of the background and suit effects.
It reduces production costs, improves production efficiency, ensures the authenticity and diversity of fur patterns, and is suitable for rendering of different animal models.
Smart Images

Figure CN119941966A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a model rendering method, device and electronic equipment. Background Art
[0002] Realistic animal models need to show more realistic fur colors and patterns. Therefore, texture maps showing fur colors and patterns are mostly made manually by staff. In order to ensure that the fur colors and patterns of different animal models are varied, staff are usually required to make multiple texture maps for one type of animal model, which has high production costs and low production efficiency. Summary of the invention
[0003] In view of this, an object of the present invention is to provide a model rendering method, device and electronic device to reduce production costs and improve production efficiency.
[0004] In a first aspect, an embodiment of the present invention provides a model rendering method, the method comprising: obtaining a target model, and an appearance map of the target model; wherein the appearance map comprises: a base color map and a pattern map; determining base color parameters within a preset first color range, and rendering a base color effect for the target model based on the base color parameters and the base color map; determining pattern parameters within a preset second color range, and determining rendering parameters of the pattern map; wherein the rendering parameters are used to: control the distribution of the pattern effect on the target model; the pattern effect comprises a mottled effect and / or a pattern effect; based on the pattern parameters and the rendering parameters, rendering the pattern effect for the target model, and obtaining a target model rendered with the base color effect and the pattern effect.
[0005] In a second aspect, an embodiment of the present invention further provides a model rendering device, which includes: a model and texture acquisition module, used to acquire a target model, and an appearance texture of the target model; wherein the appearance texture includes: a base color texture and a pattern texture; a base color effect rendering module, used to determine base color parameters within a preset first color range, and render a base color effect for the target model based on the base color parameters and the base color texture; a parameter determination module, used to determine pattern parameters within a preset second color range, and determine the rendering parameters of the pattern texture; wherein the rendering parameters are used to: control the distribution of the pattern effect on the target model; the pattern effect includes a mottled color effect and / or a pattern effect; a pattern effect rendering module, used to render the pattern effect for the target model based on the pattern parameters and the rendering parameters, and obtain a target model rendered with a base color effect and a pattern effect.
[0006] In a third aspect, an embodiment of the present invention provides an electronic device, including a processor and a memory, wherein the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the above-mentioned model rendering method.
[0007] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above-mentioned model rendering method.
[0008] The embodiments of the present invention bring the following beneficial effects:
[0009] The above-mentioned model rendering method, device and electronic device obtain a target model and an appearance map of the target model; wherein the appearance map includes: a base color map and a pattern map; the base color parameter is determined within a preset first color range, and the base color effect is rendered for the target model based on the base color parameter and the base color map; the pattern parameter is determined within a preset second color range, and the rendering parameters of the pattern map are determined; wherein the rendering parameters are used to: control the distribution mode of the pattern effect on the target model; the pattern effect includes a mottled effect and / or a pattern effect; based on the pattern parameter and the rendering parameter, the pattern effect is rendered for the target model, and a target model rendered with the base color effect and the pattern effect is obtained. In this method, the base color effect is first rendered for the target model according to the base color parameter and the base color map, and then the pattern effect is rendered for the target model according to the pattern parameter and the rendering parameters of the pattern map, thereby obtaining a target model rendered with the base color effect and the pattern effect. This method reduces the production cost and improves the production efficiency by controlling the base color parameter, the pattern parameter and the rendering parameter to render the base color effect and the pattern effect for the target model.
[0010] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description, claims and drawings.
[0011] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.
[0013] Figure 1 A flowchart of a model rendering method provided by an embodiment of the present invention;
[0014] Figure 2A schematic diagram of a pattern map provided by an embodiment of the present invention;
[0015] Figure 3 A schematic diagram of a target model rendered with a background color effect and a noise color effect provided by an embodiment of the present invention;
[0016] Figure 4 A schematic diagram of a target model rendered with a pattern effect provided by an embodiment of the present invention;
[0017] Figure 5 A schematic diagram of a target model rendered with a background color effect, a mottled color effect, and a pattern effect provided by an embodiment of the present invention;
[0018] Figure 6 A schematic diagram of a model rendering device provided by an embodiment of the present invention;
[0019] Figure 7 A schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0020] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0021] To facilitate understanding, the terms involved in the embodiments of the present invention are first explained.
[0022] UV: Through UV mapping, each point on the two-dimensional texture image can be accurately mapped to the surface of the three-dimensional model object, thereby adding color, details and material effects to the three-dimensional model; U and V represent the horizontal axis and vertical axis of the two-dimensional space respectively, and the value range of U and V are both between 0 and 1.
[0023] Mesh, geometry: Through meshing, the geometry can be divided into multiple units.
[0024] Vertex: A point in three-dimensional space that contains information such as normal direction, texture coordinates, and mesh attributes.
[0025] Materials: Used to control the appearance characteristics of the mesh, such as color, reflection, etc.
[0026] Shader: An editable program that defines how the GPU (graphics processing unit) renders vertex and texture data.
[0027] Texture array: A texture object can store an array, and each element in the array is an image information.
[0028] Currently, Material Instances are used to create static variations of materials, while Dynamic Material Instances allow material properties, such as color, to be changed at runtime. When creating Dynamic Material Instances, care needs to be taken to select the correct node to ensure dynamic changes to the material effect, such as changing the target material color after an object collision.
[0029] Since realistic animal models need to show more realistic fur colors and patterns, texture maps showing fur colors and patterns are mostly manually produced by staff. For different animal models, in order to ensure that the fur colors and patterns are varied, staff are usually required to produce multiple texture maps for one type of animal model, which is costly and inefficient. In addition, when using texture maps to generate the fur colors and patterns of a type of animal model, if only procedural random texture production is relied upon, the result is likely to deviate from the preset direction and not be realistic enough.
[0030] Based on this, a model rendering method, device and electronic device provided by the embodiments of the present invention can be applied to rendering realistic animal models.
[0031] To facilitate understanding of this embodiment, a model rendering method disclosed in an embodiment of the present invention is first introduced in detail. The method can be run on a local terminal device or a server.
[0032] like Figure 1 As shown, the method comprises the following steps:
[0033] Step S102, obtaining a target model and an appearance map of the target model; wherein the appearance map includes: a base color map and a pattern color map;
[0034] The target model is usually a realistic animal model, such as a deer, bird, insect, fish, etc. Each pixel in the base color map usually has the same color value. The color map can be a variegated color map, a mask map, and a pattern map.
[0035] Specifically, a realistic animal model and the appearance map of the animal model can be obtained, for example, a base color map and a pattern map are obtained in a texture array, and the pattern map includes a mottled color map, a pattern map, and a mask map.
[0036] Step S104, determining background color parameters within a preset first color range, and rendering a background color effect for the target model based on the background color parameters and the background color map;
[0037] The above-mentioned first color range usually includes dimensional ranges of multiple color dimensions in the first color space, and the color dimensions in the first color space may be hue dimension, saturation dimension and brightness dimension; through the color ranges of multiple color dimensions, color gamut restrictions may be performed on different target models.
[0038] Specifically, a dimension value is randomly generated within a dimensional range of a color dimension in the first color space to obtain a first dimensional value corresponding to the color dimension; if the dimension value of a pixel in the background color map exceeds the dimensional range of the color dimension, the target dimensional value closest to the dimensional range of the color dimension is used as the first dimensional value. When the preset first color range contains dimensional ranges corresponding to multiple color dimensions, the first dimensional values corresponding to these color dimensions are determined as background color parameters, and the background color parameters are converted to the RGB color space, that is, based on the three basic colors of R (Red), G (Green), and B (Blue), different degrees of superposition are performed to produce rich and wide colors, that is, the three-primary color mode.
[0039] Next, you can create a material for the target model, mount the base color map to the material of the target model, pass the base color parameters converted into the RGB color space into the material, and render the target model through the shader rendering program to obtain the base color effect.
[0040] In the above method, the color gamut of the target model is narrowed by determining the background color parameters, and then the background color effect is rendered on the target model.
[0041] Step S106, determining the pattern parameters within the preset second color range, and determining the rendering parameters of the pattern map; wherein the rendering parameters are used to: control the distribution mode of the pattern effect on the target model; the pattern effect includes a mottled color effect and / or a pattern effect;
[0042] The second color range mentioned above usually has the same color dimension as the first color range. The color parameter may specifically include a mottled color parameter and a pattern parameter.
[0043] Specifically, a dimension value is randomly generated within a dimension range of a color dimension in the first color space to obtain a second dimension value corresponding to the color dimension; if the dimension value of a pixel in the pattern map exceeds the dimension range of the color dimension, the target dimension value closest to the dimension value within the dimension range of the color dimension is used as the second dimension value. When the preset second color range includes dimension ranges corresponding to multiple color dimensions, the second dimension values corresponding to these color dimensions are determined as pattern parameters, and the pattern parameters are converted into the RGB color space.
[0044] Furthermore, rendering parameters are determined for the pattern map, and the rendering parameters can control the distribution of the pattern effect on the target model, such as tiling values and offset values; wherein the pattern effect can be a mottled effect, or a pattern effect, or a mottled effect and a pattern effect. For example, the tiling value of the pattern map in a specified mapping direction is determined, which can control the number of repetitions of the pattern map in the specified mapping direction when rendering the pattern effect; or, the offset value of the pattern map is determined, which can control the offset value of the pattern effect in the pattern map relative to the initial rendering position.
[0045] In the above method, by determining the pattern parameters and the rendering parameters of the pattern map, the color gamut of the target model is narrowed, and the distribution of the pattern effect on the target model is controlled.
[0046] Step S108: Rendering a pattern effect for the target model based on the pattern parameters and the rendering parameters, to obtain a target model rendered with a background color effect and a pattern effect.
[0047] Usually, before the target model is bound to bones, the pattern map used for rendering the pattern effect is pre-mapped to the surface of the target model, for example, the noise map, pattern map and mask map are mapped in the local space of the mesh vertex position of the target model.
[0048] In one implementation, the pattern effect is a noise effect, and the pattern map is a noise map. Here, the target model is rendered according to the noise parameters in the pattern parameters and the rendering parameters corresponding to the noise map. Specifically, the noise map can be mounted to the material of the target model in advance according to the rendering parameters corresponding to the noise map, and the noise parameters converted into the RGB color space are passed into the material. The target model is rendered through the rendering program of the shader to obtain a target model rendered with a base color effect and a noise effect.
[0049] In another implementation, the pattern effect is a pattern effect, and the pattern maps are a pattern map and a mask map. Here, the target model is rendered according to the pattern parameters in the pattern parameters, the rendering parameters corresponding to the pattern map, the pattern map and the mask map; specifically, the mask map can be mounted to the material of the target model in advance, and the pattern map can be mounted to the material of the target model according to the rendering parameters corresponding to the pattern map, and then the pattern parameters converted into the RGB color space are passed into the material, and the target model is rendered through the rendering program of the shader to obtain a target model rendered with background color effect and pattern effect.
[0050] If the mottled color effect and pattern effect in the color effect are rendered for the target model according to the color parameters, the rendering parameters corresponding to the color map, and the color map, a target model with background color effect, mottled color effect and color effect is obtained. The above implementation method is the same and will not be repeated here.
[0051] In the above manner, for different target models, the user can customize the rendering probability and color range of the background color effect, the mottled color effect, and the flower color effect.
[0052] The above-mentioned model rendering method obtains a target model and an appearance map of the target model; wherein the appearance map includes: a base color map and a pattern map; determines base color parameters within a preset first color range, and renders a base color effect for the target model based on the base color parameters and the base color map; determines pattern parameters within a preset second color range, and determines rendering parameters of the pattern map; wherein the rendering parameters are used to: control the distribution of the pattern effect on the target model; the pattern effect includes a mottled color effect and / or a pattern effect; based on the pattern parameters and the rendering parameters, renders the pattern effect for the target model, and obtains a target model rendered with the base color effect and the pattern effect.
[0053] In this method, a background color effect is first rendered for the target model according to the background color parameters and the background color map, and then a pattern effect is rendered for the target model according to the pattern parameters and the rendering parameters of the pattern map, thereby obtaining a target model rendered with background color effects and pattern effects. This method reduces production costs and improves production efficiency by controlling background color parameters, pattern parameters and rendering parameters to render background color effects and pattern effects for the target model.
[0054] The following embodiments provide a specific implementation method for determining rendering parameters of a pattern map.
[0055] In one method, a tiling value of a flower pattern map in a specified mapping direction is determined, and the tiling value is determined as a rendering parameter; wherein the specified mapping direction includes a U direction and / or a V direction; and the tiling value is used to indicate: when rendering a flower pattern effect, the number of times the flower pattern map is repeated in the specified mapping direction.
[0056] The above-mentioned specified mapping direction may specifically be the U direction, or the V direction, or the U direction and the V direction in the two-dimensional texture space.
[0057] Here, the pattern map can be a mottled map, a pattern map, and a mask map; specifically, a target tiling value is randomly generated within a numerical range of a preset table, and the target tiling value is determined as the tiling value of the pattern map in a specified mapping direction as a rendering parameter. For example, a tiling value in the U direction is 2.0, which means that the pattern map is repeated twice in the U direction; a tiling value in the V direction is 3.0, which means that the pattern map is repeated three times in the V direction.
[0058] In one embodiment, the rendering parameters include a tiling value. Specifically, based on the tiling value, the number of repetitions of the pattern texture in a specified texture direction is determined; and according to the number of repetitions and the pattern parameters, the pattern texture is rendered to the target model.
[0059] For example, in the material editor, the tiling value of the tile map in the specified mapping direction is 2, and the tiling value of the UVW map modifier in the same specified mapping direction is 3, then the material and the UVW map are multiplied when tiled, and the resulting tiling value is 6, that is, the pattern map is repeated six times in the specified direction; then, according to the number of repetitions and the pattern parameters, the pattern map is rendered to the target model, and a target model with the pattern map repeated six times in the specified direction is obtained.
[0060] In one method, an offset value of a pattern map is determined, and the offset value is determined as a rendering parameter; wherein the pattern map is preset with an original rendering position of a pattern effect; and the offset value is used to indicate: an offset position relative to the original rendering position.
[0061] The above offset values are usually used to indicate the horizontal offset position and vertical offset position relative to the original rendering position of the pattern effect after the pattern map is moved.
[0062] Here, the pattern map can be a mottled map, a pattern map, and a mask map; specifically, a target offset value is randomly generated within a numerical range of a preset table, and the target offset value is determined as the offset value of the pattern map as a rendering parameter. For example, the offset value of the pattern map is (0.2, 0.6), which means that the horizontal offset value of the moved pattern map relative to the original rendering position is 0.2 units, and the vertical offset value is 0.6 units.
[0063] In one embodiment, the rendering parameters include an offset value. Specifically, based on the offset value, the offset position of the pattern map relative to the original rendering position is determined; and the pattern map is rendered to the target model according to the offset position and the pattern parameters.
[0064] That is to say, by controlling the offset value of the UV coordinate through the offset value, the UV coordinates of the pattern map can be changed, so that the display position of the pattern map is offset. According to the aforementioned embodiment, the offset value is (0.2, 0.6), then the pattern map is offset by 0.2 units in the horizontal direction and 0.6 units in the vertical direction; then the pattern map is rendered to the target model according to the offset position of the pattern map relative to the original rendering position and the pattern parameters, so as to obtain the target model after the pattern map is offset.
[0065] In one embodiment, the color map is a pattern map, and image processing is performed on the designated pattern map, such as using the designated pattern map to produce a four-way continuous texture, that is, using at least one designated pattern map to form a unit, forming a pattern that is repeatedly continuous and extended in all directions; then the final pattern map is generated according to the tiling value and the offset value, such as Figure 2(a), (b), and (c) respectively represent image processing of the specified pattern maps of three different textures, and then the final pattern maps of the three different textures are generated according to the tiling value and the offset value.
[0066] The following embodiments provide a specific implementation method for rendering a flower color effect for a target model.
[0067] In one embodiment, the above-mentioned pattern map includes: a variegated color map; the variegated color effect is used to control the rendering of the variegated color effect on the target model; and the pattern parameters include variegated color parameters.
[0068] Specifically, based on the noise parameters, the rendering parameters corresponding to the noise map, and the noise map, the noise map is tiled and rendered onto the target model.
[0069] For example, the background color effect of the target model rendering is as follows Figure 3 As shown in (a); when rendering a noise effect for a target model, the specified noise map can be firstly subjected to image processing, such as using the specified noise map to create a square continuous texture to obtain a noise map.
[0070] Next, according to the noise parameters determined within the preset second color range, the rendering parameters corresponding to the noise map, and the noise map, the target model is rendered using the rendering program of the shader, and the noise map is tiled and rendered onto the target model. The target model with the noise effect is rendered as shown in FIG. Figure 3 As shown in (b) and (c), Figure 3 The noise effects in (b) and (c) are different.
[0071] In one embodiment, the above-mentioned color map includes: a pattern map and a mask map; wherein the mask map is used to: determine the renderable area of the target model surface where the pattern can be rendered; the pattern map is used to: determine the pattern position and / or pattern brightness within the renderable area; the color parameters include pattern parameters.
[0072] The above mask map can usually determine the renderable area of the renderable pattern on the target model surface and control the density and distribution area of the pattern. The pattern map can be used to determine the pattern position, or the pattern brightness, or the pattern position and pattern brightness within the renderable area of the target model surface.
[0073] Specifically, based on the pattern parameters, rendering parameters corresponding to the pattern map, the pattern map, and the mask map, the pattern effect is rendered on the target model.
[0074] For example, when rendering a pattern effect for a target model, image processing may be performed on a specified pattern map first, such as using the specified pattern map to generate a four-square continuous texture to obtain a pattern map.
[0075] Next, according to the pattern parameters determined within the preset second color range, the rendering parameters corresponding to the pattern map, and the pattern map, the target model is rendered using the rendering program of the shader, and a target model with a pattern position and pattern brightness rendered can be obtained. Here, the pattern parameters are superimposed on the pattern map, and the pattern map is given colors so that the pattern presents different colors; and according to the mask map, the target mask position of the target model is rendered using the rendering program of the shader, so as to determine the renderable area of the target model where the pattern can be rendered, and control the density of the pattern and the size of the distribution area. For example, when the target model is a deer, if the user does not need to render the pattern at the position of the antlers and deer hooves, then the mask map can be rendered at the position of the antlers and deer hooves to obtain the final pattern effect on the target model. The target model rendered with the pattern effect is as follows: Figure 4 As shown in (a) and (b), Figure 4 The pattern effects in (a) and (b) are different.
[0076] The following embodiments provide specific implementation methods for determining background color parameters and pattern color parameters.
[0077] In one embodiment, the first color range includes: a dimensional range of multiple color dimensions in a first color space.
[0078] Specifically, within the dimensional range of the color dimension, determine the first dimensional value corresponding to the color dimension; determine multiple first dimensional values corresponding to the color dimensions as background color parameters; and, within the dimensional range of the color dimension, determine the second dimensional value corresponding to the color dimension; determine multiple second dimensional values corresponding to the color dimensions as pattern parameters.
[0079] For example, a dimension value is randomly generated within a dimension range of a color dimension in the first color space to obtain a first dimension value corresponding to the color dimension; if the dimension value of a pixel in the base color map exceeds the dimension range of the color dimension, the target dimension value closest to the dimension value within the dimension range of the color dimension is used as the first dimension value. For example, if the color dimension is hue, assuming that the dimension range of hue is 0 to 200, then when the hue of a pixel in the base color map is 210, the hue of the pixel is limited to 200. If the preset first color range contains dimension ranges corresponding to multiple color dimensions, the first dimension values corresponding to these color dimensions are all determined as base color parameters.
[0080] Furthermore, within a dimension range of a color dimension in the first color space, a dimension value is randomly generated to obtain a second dimension value corresponding to the color dimension; if the dimension value of a pixel in the base color map exceeds the dimension range of the color dimension, then the target dimension value closest to the dimension value within the dimension range of the color dimension is used as the second dimension value. If the preset second color range includes dimension ranges corresponding to multiple color dimensions, then the second dimension values corresponding to these color dimensions are all determined as the pattern parameters.
[0081] In one approach, the color dimensions in the first color space include: a hue dimension, a saturation dimension, and a lightness dimension.
[0082] Specifically, before rendering the background color effect for the target model, the background color parameters are converted into the RGB color space; and before rendering the flower color effect for the target model, the flower color parameters are converted into the RGB color space.
[0083] That is, the color dimensions in the first color space may be the hue dimension H (Hue), the saturation dimension S (Saturation) and the value dimension V (value), the background color parameter determined in the preset first color range is in the HSV format, and the color parameter determined in the preset second color range is also in the HSV format. Here, the background color parameter is converted from the HSV format to the RGB format color space; and the color parameter is converted from the HSV format to the RGB format color space.
[0084] In one embodiment, a target model with a background color effect, a mottled color effect, and a pattern effect is rendered as follows: Figure 5 As shown, Figure 5 There are fewer noisy areas and fewer pattern areas in (a) and (b). Figure 5 The noisy areas in (c) and (d) are larger and incorporate more pattern areas.
[0085] The above-mentioned embodiments of the present application, when realizing the random colors of realistic animals, ensure that the realistic animals have a certain color tendency by limiting the color gamut; for different animals, the rendering probability of the background color effect, the mottled color effect and the pattern effect can be customized, so that different pattern appearances can be realized for a variety of animals, and cooperated with the breeding and collection system, so that the collection nature of the animals is stronger, which is conducive to the evaluation of the value of animals and greatly improves the richness of animal species.
[0086] For the above method embodiments, see Figure 6 A schematic diagram of a model rendering device is shown; the device comprises:
[0087] The model and texture acquisition module 601 is used to acquire the target model and the appearance texture of the target model; wherein the appearance texture includes: a base color texture and a pattern color texture;
[0088] A background color effect rendering module 602 is used to determine background color parameters within a preset first color range, and render background color effects for a target model based on the background color parameters and the background color map;
[0089] The parameter determination module 603 is used to determine the pattern parameters within the preset second color range, and determine the rendering parameters of the pattern map; wherein the rendering parameters are used to: control the distribution mode of the pattern effect on the target model; the pattern effect includes a mottled color effect and / or a pattern effect;
[0090] The pattern effect rendering module 604 is used to render the pattern effect for the target model based on the pattern parameters and the rendering parameters, so as to obtain the target model rendered with the background color effect and the pattern effect.
[0091] The above-mentioned model rendering device obtains a target model and an appearance map of the target model; wherein the appearance map includes: a base color map and a pattern map; determines base color parameters within a preset first color range, and renders a base color effect for the target model based on the base color parameters and the base color map; determines pattern parameters within a preset second color range, and determines rendering parameters of the pattern map; wherein the rendering parameters are used to: control the distribution of the pattern effect on the target model; the pattern effect includes a mottled color effect and / or a pattern effect; based on the pattern parameters and the rendering parameters, renders the pattern effect for the target model, and obtains a target model rendered with the base color effect and the pattern effect.
[0092] In this method, a background color effect is first rendered for the target model according to the background color parameters and the background color map, and then a pattern effect is rendered for the target model according to the pattern parameters and the rendering parameters of the pattern map, thereby obtaining a target model rendered with background color effects and pattern effects. This method reduces production costs and improves production efficiency by controlling background color parameters, pattern parameters and rendering parameters to render background color effects and pattern effects for the target model.
[0093] The above parameter determination module is also used to determine the tiling value of the flower color map in the specified mapping direction; wherein the specified mapping direction includes the U direction and / or the V direction; the tiling value is used to indicate: when rendering the flower color effect, the number of times the flower color map is repeated in the specified mapping direction.
[0094] The parameter determination module is also used to determine the offset value of the pattern map; wherein the pattern map is preset with the original rendering position of the pattern effect; the offset value is used to indicate: the offset position relative to the original rendering position.
[0095] The above-mentioned pattern map includes: a variegated map; the variegated effect is used to control the rendering of the variegated effect on the target model; the pattern parameters include variegated parameters; the above-mentioned pattern effect rendering module is also used to tile the variegated map onto the target model based on the variegated parameters, the rendering parameters corresponding to the variegated map and the variegated map.
[0096] The above-mentioned pattern map includes: a pattern map and a mask map; wherein the mask map is used to: determine the renderable area on the surface of the target model where the pattern can be rendered; the pattern map is used to: determine the pattern position and / or pattern brightness within the renderable area; the pattern parameters include pattern parameters; the above-mentioned pattern effect rendering module is also used to render the pattern effect on the target model based on the pattern parameters, the rendering parameters corresponding to the pattern map, the pattern map and the mask map.
[0097] The above-mentioned first color range includes: the dimensional range of multiple color dimensions in the first color space; the above-mentioned background color effect rendering module is also used to determine the first dimensional value corresponding to the color dimension within the dimensional range of the color dimension; the first dimensional values corresponding to multiple color dimensions are determined as background color parameters; the above-mentioned parameter determination module is also used to determine the second dimensional value corresponding to the color dimension within the dimensional range of the color dimension; the second dimensional values corresponding to multiple color dimensions are determined as pattern parameters.
[0098] The color dimensions in the above-mentioned first color space include: hue dimension, saturation dimension and lightness dimension; the above-mentioned device also includes a base parameter conversion module for converting the base color parameters into the RGB color space; the above-mentioned device also includes a pattern parameter conversion module for converting the pattern parameters into the RGB color space.
[0099] This embodiment also provides an electronic device, including a processor and a memory, wherein the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the above model rendering method. The electronic device can be a server or a terminal device.
[0100] See also Figure 7 As shown, the electronic device includes a processor 100 and a memory 101. The memory 101 stores computer executable instructions that can be executed by the processor 100. The processor 100 executes the computer executable instructions to implement the above-mentioned model rendering method.
[0101] Further, Figure 7 The electronic device shown further includes a bus 102 and a communication interface 103 , and the processor 100 , the communication interface 103 and the memory 101 are connected via the bus 102 .
[0102] The memory 101 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 103 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 102 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 7 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0103] The processor 100 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 100. The above processor 100 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present invention can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 101, and the processor 100 reads the information in the memory 101 and completes the steps of the method of the above embodiment in combination with its hardware.
[0104] The processor in the electronic device can implement the following operations in the model rendering method by executing computer executable instructions:
[0105] Obtain a target model and an appearance map of the target model; wherein the appearance map includes: a base color map and a pattern map; determine base color parameters within a preset first color range, and render a base color effect for the target model based on the base color parameters and the base color map; determine pattern parameters within a preset second color range, and determine rendering parameters of the pattern map; wherein the rendering parameters are used to: control the distribution of the pattern effect on the target model; the pattern effect includes a mottled color effect and / or a pattern effect; based on the pattern parameters and the rendering parameters, render the pattern effect for the target model to obtain a target model rendered with the base color effect and the pattern effect.
[0106] Determine the tiling value of the flower color map in the specified mapping direction; wherein the specified mapping direction includes the U direction and / or the V direction; the tiling value is used to indicate: when rendering the flower color effect, the number of times the flower color map is repeated in the specified mapping direction.
[0107] Determine the offset value of the pattern map; wherein the pattern map is preset with the original rendering position of the pattern effect; the offset value is used to indicate: the offset position relative to the original rendering position.
[0108] The above-mentioned pattern map includes: a noise map; the noise effect is used to: control the rendering of the noise effect on the target model; the pattern parameters include noise parameters; based on the noise parameters, the rendering parameters corresponding to the noise map and the noise map, the noise map is tiled and rendered onto the target model.
[0109] The above-mentioned pattern map includes: a pattern map and a mask map; wherein the mask map is used to: determine the renderable area on the surface of the target model where the pattern can be rendered; the pattern map is used to: determine the pattern position and / or pattern brightness within the renderable area; the pattern parameters include pattern parameters; based on the pattern parameters, the rendering parameters corresponding to the pattern map, the pattern map and the mask map, the pattern effect is rendered on the target model.
[0110] The above-mentioned first color range includes: the dimensional range of multiple color dimensions in the first color space; within the dimensional range of the color dimension, determining the first dimensional value corresponding to the color dimension; determining the first dimensional values corresponding to the multiple color dimensions as the background color parameter; within the dimensional range of the color dimension, determining the second dimensional value corresponding to the color dimension; determining the second dimensional values corresponding to the multiple color dimensions as the pattern parameter.
[0111] The color dimensions in the first color space include: hue dimension, saturation dimension and brightness dimension; the background color parameters are converted into the RGB color space; and the pattern color parameters are converted into the RGB color space.
[0112] In this method, a background color effect is first rendered for the target model according to the background color parameters and the background color map, and then a pattern effect is rendered for the target model according to the pattern parameters and the rendering parameters of the pattern map, thereby obtaining a target model rendered with background color effects and pattern effects. This method reduces production costs and improves production efficiency by controlling background color parameters, pattern parameters and rendering parameters to render background color effects and pattern effects for the target model.
[0113] This embodiment also provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above-mentioned model rendering method.
[0114] The computer executable instructions stored in the computer readable storage medium can implement the following operations in the model rendering method by executing the computer executable instructions:
[0115] Obtain a target model and an appearance map of the target model; wherein the appearance map includes: a base color map and a pattern map; determine base color parameters within a preset first color range, and render a base color effect for the target model based on the base color parameters and the base color map; determine pattern parameters within a preset second color range, and determine rendering parameters of the pattern map; wherein the rendering parameters are used to: control the distribution of the pattern effect on the target model; the pattern effect includes a mottled color effect and / or a pattern effect; based on the pattern parameters and the rendering parameters, render the pattern effect for the target model to obtain a target model rendered with the base color effect and the pattern effect.
[0116] Determine the tiling value of the flower color map in the specified mapping direction; wherein the specified mapping direction includes the U direction and / or the V direction; the tiling value is used to indicate: when rendering the flower color effect, the number of times the flower color map is repeated in the specified mapping direction.
[0117] Determine the offset value of the pattern map; wherein the pattern map is preset with the original rendering position of the pattern effect; the offset value is used to indicate: the offset position relative to the original rendering position.
[0118] The above-mentioned pattern map includes: a noise map; the noise effect is used to: control the rendering of the noise effect on the target model; the pattern parameters include noise parameters; based on the noise parameters, the rendering parameters corresponding to the noise map and the noise map, the noise map is tiled and rendered onto the target model.
[0119] The above-mentioned pattern map includes: a pattern map and a mask map; wherein the mask map is used to: determine the renderable area on the surface of the target model where the pattern can be rendered; the pattern map is used to: determine the pattern position and / or pattern brightness within the renderable area; the pattern parameters include pattern parameters; based on the pattern parameters, the rendering parameters corresponding to the pattern map, the pattern map and the mask map, the pattern effect is rendered on the target model.
[0120] The above-mentioned first color range includes: the dimensional range of multiple color dimensions in the first color space; within the dimensional range of the color dimension, determining the first dimensional value corresponding to the color dimension; determining the first dimensional values corresponding to the multiple color dimensions as the background color parameter; within the dimensional range of the color dimension, determining the second dimensional value corresponding to the color dimension; determining the second dimensional values corresponding to the multiple color dimensions as the pattern parameter.
[0121] The color dimensions in the first color space include: hue dimension, saturation dimension and brightness dimension; the background color parameters are converted into the RGB color space; and the pattern color parameters are converted into the RGB color space.
[0122] In this method, a background color effect is first rendered for the target model according to the background color parameters and the background color map, and then a pattern effect is rendered for the target model according to the pattern parameters and the rendering parameters of the pattern map, thereby obtaining a target model rendered with background color effects and pattern effects. This method reduces production costs and improves production efficiency by controlling background color parameters, pattern parameters and rendering parameters to render background color effects and pattern effects for the target model.
[0123] The computer program product of the model rendering method, device and electronic device provided in the embodiments of the present invention includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the previous method embodiments. The specific implementation can be found in the method embodiments and will not be repeated here.
[0124] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0125] In addition, in the description of the embodiments of the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, and it can be the internal communication of two components. For those skilled in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0126] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0127] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0128] Finally, it should be noted that the above embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above embodiments, those skilled in the art should understand that any person skilled in the art can still modify the technical solutions recorded in the above embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A model rendering method, characterized in that: The method comprises: Acquire a target model and an appearance map of the target model; wherein the appearance map includes: a base color map and a pattern color map; Determine a background color parameter within a preset first color range, and render a background color effect for the target model based on the background color parameter and the background color map; Determine the pattern parameters within the preset second color range, and determine the rendering parameters of the pattern map; wherein the rendering parameters are used to: control the distribution mode of the pattern effect on the target model; the pattern effect includes a mottled color effect and / or a pattern effect; The pattern effect is rendered for the target model based on the pattern parameter and the rendering parameter to obtain the target model rendered with the base color effect and the pattern effect.
2. The method according to claim 1, characterized in that The step of determining the rendering parameters of the pattern map comprises: Determine a tiling value of the flower pattern map in a specified mapping direction, and determine the tiling value as the rendering parameter; wherein the specified mapping direction includes a U direction and / or a V direction; and the tiling value is used to indicate: when rendering the flower pattern effect, the number of times the flower pattern map is repeated in the specified mapping direction.
3. The method according to claim 1, characterized in that The rendering parameters include a tiling value; the step of rendering the pattern effect for the target model based on the pattern parameters and the rendering parameters includes: Based on the tiling value, determining the number of repetitions of the pattern texture in a specified texture direction; According to the number of repetitions and the pattern parameters, the pattern map is rendered to the target model.
4. The method according to claim 1 or 2, characterized in that: The step of determining the rendering parameters of the pattern map comprises: Determine the offset value of the flower color map, and determine the offset value as the rendering parameter; wherein the flower color map is preset with the original value rendering position of the flower color effect; the offset value is used to indicate: the offset position relative to the original value rendering position.
5. The method according to claim 1, characterized in that The rendering parameters include an offset value; the step of rendering the pattern effect for the target model based on the pattern parameters and the rendering parameters includes: Based on the offset value, determining the offset position of the pattern map relative to the original rendering position; The pattern map is rendered to the target model according to the offset position and the pattern parameters.
6. The method according to claim 1, characterized in that The pattern map includes: a variegated map; the variegated effect is used to: control the rendering of the variegated effect on the target model; the pattern parameters include variegated parameters; The step of rendering a pattern effect for the target model based on the pattern parameters and the rendering parameters includes: based on the variegated parameters, the rendering parameters corresponding to the variegated map, and the variegated map, tiling the variegated map onto the target model.
7. The method according to claim 1, characterized in that The pattern map includes: a pattern map and a mask map; wherein the mask map is used to determine a renderable area of the target model surface where a pattern can be rendered; the pattern map is used to determine a pattern position and / or pattern brightness within the renderable area; the pattern parameters include pattern parameters; The step of rendering the pattern effect for the target model based on the pattern parameter and the rendering parameter includes: A pattern effect is rendered on the target model based on the pattern parameters, rendering parameters corresponding to the pattern map, the pattern map, and the mask map.
8. The method according to claim 1, characterized in that The first color range includes: a dimensional range of multiple color dimensions in a first color space; The step of determining the background color parameter within the preset first color range includes: determining a first dimension value corresponding to the color dimension within the dimension range of the color dimension; determining the first dimension values corresponding to the multiple color dimensions as the background color parameter; The step of determining the pattern parameter within a preset second color range includes: determining a second dimension value corresponding to the color dimension within the dimensional range of the color dimension; and determining the second dimension values corresponding to the multiple color dimensions as the pattern parameter.
9. The method according to claim 1, characterized in that: The color dimensions in the first color space include: hue dimension, saturation dimension and lightness dimension; Before the step of rendering the background color effect for the target model based on the background color parameters and the background color map, the method further comprises: converting the background color parameters into an RGB color space; Before the step of rendering the pattern effect for the target model based on the pattern parameters and the rendering parameters, the method further includes: converting the pattern parameters into an RGB color space.
10. A model rendering device, characterized in that: The device comprises: A model and texture acquisition module, used to acquire a target model and an appearance texture of the target model; wherein the appearance texture includes: a base color texture and a pattern color texture; A background color effect rendering module, used to determine background color parameters within a preset first color range, and render a background color effect for the target model based on the background color parameters and the background color map; A parameter determination module, used to determine the pattern parameters within a preset second color range, and determine the rendering parameters of the pattern map; wherein the rendering parameters are used to: control the distribution mode of the pattern effect on the target model; the pattern effect includes a mottled color effect and / or a pattern effect; The pattern effect rendering module is used to render the pattern effect for the target model based on the pattern parameters and the rendering parameters, so as to obtain the target model rendered with the base color effect and the pattern effect.
11. An electronic device, characterized in that: The invention comprises a processor and a memory, wherein the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the model rendering method according to any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the model rendering method according to any one of claims 1 to 9.