CN113034661B - MatCap map generation method and device - Google Patents

MatCap map generation method and device Download PDF

Info

Publication number
CN113034661B
CN113034661B CN202110316070.8A CN202110316070A CN113034661B CN 113034661 B CN113034661 B CN 113034661B CN 202110316070 A CN202110316070 A CN 202110316070A CN 113034661 B CN113034661 B CN 113034661B
Authority
CN
China
Prior art keywords
map
matcap
baking
preset model
normal
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110316070.8A
Other languages
Chinese (zh)
Other versions
CN113034661A (en
Inventor
况超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN202110316070.8A priority Critical patent/CN113034661B/en
Publication of CN113034661A publication Critical patent/CN113034661A/en
Application granted granted Critical
Publication of CN113034661B publication Critical patent/CN113034661B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/10Geometric effects
    • G06T15/20Perspective computation
    • G06T15/205Image-based rendering
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/50Controlling the output signals based on the game progress
    • A63F13/52Controlling the output signals based on the game progress involving aspects of the displayed game scene
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/04Texture mapping
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/50Lighting effects
    • G06T15/55Radiosity

Landscapes

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

Abstract

The embodiment of the invention provides a method and a device for generating MatCap mapping, which aim at low-mode baking normal mapping of a preset model; converting the normal map into a replacement map, and generating a first MatCap map according to the replacement map and a MatCap material ball; giving the MatCap material balls to a low model of the preset model, and baking to obtain a second MatCap map; and synthesizing the first MatCap map and the second MatCap map to obtain a target MatCap map. The MatCap map is obtained by converting the normal map into the replacement map and then baking, so that the low die for baking has the details of the high die after the replacement map is applied, the MatCap map is convenient to bake, and the problems of high baking time cost and insufficient stereoscopic impression of objects caused by directly baking the replacement map are avoided.

Description

MatCap map generation method and device
Technical Field
The invention relates to the technical field of computer graphics, in particular to a MatCap map generation method and a MatCap map generation device.
Background
At present, a MatCap material rendering scheme is used in game engine rendering. If the MatCap effect is to be displayed on the map, a manual processing scheme is generally used: the effect screenshot presented by the high mode is directly mapped onto the map by the low mode, but the scheme needs to map a plurality of angles, the joints are needed to be trimmed after the mapping is completed, the time and the labor are wasted, the effect of only one mapping angle can be guaranteed, obvious direction shadows exist, the display of the angles is not satisfied, and the manufacturing efficiency is low.
The other is realized by replacing the mapping scheme: the replacement detail is extruded on a plane matched with the low-mode UV, matCap material display is given to the plane model with the replacement detail to bake MatCap material to be mapped, however, the scheme has the advantages that the low-mode needs to bake a replacement mapping, the realization is relatively troublesome in a game flow, because the low-mode and the high-mode are two completely different objects, the replacement mapping is inconvenient to bake, for example, the low-mode replacement mapping is difficult to realize in ZBrush, the replacement mapping effect is not good when other software is used for baking, the baking time cost is high, and the three-dimensional effect presented by the objects is insufficient.
Disclosure of Invention
In view of the foregoing, embodiments of the present invention are provided to provide a method for generating a MatCap map and a corresponding apparatus for generating a MatCap map, which overcome or at least partially solve the foregoing problems.
In a first aspect, an embodiment of the present invention discloses a method for generating a MatCap map, including:
low-mode baking normal mapping for a preset model;
converting the normal map into a replacement map, and generating a first MatCap map according to the replacement map and a MatCap material ball;
giving the MatCap material balls to a low model of the preset model, and baking to obtain a second MatCap map;
and synthesizing the first MatCap map and the second MatCap map to obtain a target MatCap map.
Optionally, the normal map corresponds to a high modulus of the preset model.
Optionally, the generating a first MatCap map according to the replacement map and the MatCap material ball includes:
creating a square patch model;
the replacement map and the MatCap material ball are endowed to the square surface patch model;
and baking the square patch model to obtain a first MatCap map.
Optionally, the step of endowing the MatCap material balls with a low modulus of the preset model, and baking to obtain a second MatCap map includes:
determining a color map corresponding to the MatCap material ball;
and according to the color map, the MatCap material balls are endowed to a low mode of the preset model, and a second MatCap map is obtained through baking.
Optionally, the determining a color map corresponding to the MatCap material ball includes:
acquiring a material image corresponding to the MatCap material ball;
mapping the world normal of the preset model from-1 to between 0 and 1 of the texture map to obtain a mapping result;
and taking the mapping result as texture map coordinates to sample the texture image, and obtaining a color map corresponding to the MatCap material ball.
Optionally, the step of assigning the MatCap material balls to a low mode of the preset model according to the color map, and baking to obtain a second MatCap map includes:
attaching the normal map and the color map to a material ball to obtain a MatCap material ball with a normal map effect;
and giving the MatCap material balls with the normal mapping effect to a low mode of the preset model, and baking to obtain a second MatCap mapping.
Optionally, the step of endowing the MatCap material balls with a low modulus of the preset model, and baking to obtain a second MatCap map includes:
and giving the MatCap material balls to a low mode of the preset model, and baking by an Aronld renderer to obtain a second MatCap map.
Optionally, the synthesizing the first MatCap map and the second MatCap map to obtain a target MatCap map includes:
converting the second MatCap map into a gray map, and performing color inversion processing on the gray map;
and taking the image subjected to the inversion treatment as a mask of the first MatCap map, and synthesizing the first MatCap map and the second MatCap map after adding the mask to obtain a target MatCap map.
Optionally, the method further comprises:
and rendering the preset model according to the target MatCap map so as to display the preset model with MatCap material effect in the game scene.
In a second aspect, an embodiment of the present invention further discloses a device for generating a MatCap map, including:
the normal line mapping baking module is used for baking the normal line mapping aiming at a low mode of a preset model;
the first map generation module is used for converting the normal map into a replacement map and generating a first MatCap map according to the replacement map and the MatCap material ball;
the second map generation module is used for endowing the MatCap material balls with a low model of the preset model and baking to obtain a second MatCap map;
and the map synthesizing module is used for synthesizing the first MatCap map and the second MatCap map to obtain the target MatCap map.
In a third aspect, an embodiment of the present invention further discloses an electronic device, including:
a processor, a storage medium, and a bus, the storage medium storing machine-readable instructions executable by the processor, the processor and the storage medium communicating over the bus when the electronic device is running, the processor executing the machine-readable instructions to perform a method according to any one of the embodiments of the present invention.
In a fourth aspect, embodiments of the present invention also disclose a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs a method according to any of the embodiments of the present invention.
The embodiment of the invention has the following advantages:
in the implementation of the invention, the normal map is converted into the replacement map by baking the normal map aiming at the low mode of the preset model, a first MatCap map is generated according to the replacement map and MatCap material balls, the MatCap material balls are endowed to the low mode of the preset model, a second MatCap map is obtained by baking, and the first MatCap map and the second MatCap map are synthesized to obtain the target MatCap map. The normal map is converted into the replacement map and then baked to obtain the MatCap map, so that a low die for baking has high-modulus details, the MatCap map is convenient to bake, the problems of high baking time cost and insufficient stereoscopic impression of an object caused by directly baking the replacement map are avoided, and the MatCap map can be baked under the global illumination of the MatCap material balls by endowing the MatCap material balls with the low-modulus baking of a preset model to obtain the second MatCap map, so that the MatCap map can be correctly displayed in multiple angles, obvious directional shadows are avoided, the corresponding MatCap map is manufactured without manually processing each angle, and the MatCap map manufacturing efficiency is improved.
Drawings
FIG. 1 is a flow chart of steps of an embodiment of a MatCap map generation method of the present invention;
FIG. 2 is a schematic illustration of a normal map of the present invention;
FIG. 3A is a schematic diagram of a low-modulus without normal mapping of the present invention;
FIG. 3B is a schematic diagram of a low modulus with normal mapping of the present invention;
FIG. 4 is a schematic illustration of a displacement map converted using the normal map shown in FIG. 2, in accordance with the present invention;
FIG. 5 is a schematic view of a MatCap ball according to the present invention;
FIG. 6 is a schematic illustration of a first MatCap map of the present invention generated using the MatCap material ball of FIG. 5;
FIG. 7 is a schematic diagram of the present invention for rendering a pre-set model using the first MatCap map of FIG. 6;
FIG. 8 is a schematic illustration of a second MatCap map baked from the MatCap pellet of FIG. 5 in accordance with the present invention;
FIG. 9 is a schematic diagram of the present invention for rendering a pre-set model using the second MatCap map of FIG. 8;
FIG. 10 is a schematic illustration of a target MatCap map synthesized from FIGS. 6 and 8 in accordance with the present invention;
FIG. 11 is a block diagram illustrating an embodiment of a MatCap map generating apparatus according to the present invention;
FIG. 12 is a block diagram of an electronic device of the present invention;
fig. 13 is a block diagram of a storage medium of the present invention.
Detailed Description
In order that the above-recited objects, features and advantages of the present invention will become more readily apparent, a more particular description of the invention will be rendered by reference to the appended drawings and appended detailed description.
Referring to fig. 1, a step flow diagram of an embodiment of a method for generating a MatCap map according to the present invention is shown, where the method specifically may include the following steps:
step 101, low-mode baking normal mapping aiming at a preset model;
the preset model may be a preset three-dimensional model, and the preset model needs to achieve a MatCap material effect in a game scene.
In order to avoid directly adopting low-mode baking to replace mapping, in the embodiment of the invention, a low-mode baking normal line mapping of a preset model is given, wherein the normal line mapping corresponds to a high mode of the preset model, and the low-mode baking normal line mapping of the high mode of the preset model can enable the low mode to prepare details of the high mode, so that MatCap material balls are easy to bake to the mapping.
In a specific implementation, since some applications have a normal baking function, the normal map may be baked by these applications against a low-mode of a preset model, for example, by knald, ZBrush, maya, and other applications, which is not limited in this embodiment of the present invention. Fig. 2 shows a schematic diagram of a normal map, fig. 3A is a schematic diagram of a low mode without a normal map, fig. 3B is a schematic diagram of a low mode with a normal map, and as can be seen in comparison with fig. 3A and 3B, the low mode with a normal map can show more details of the mode, and the performance is better.
Step 102, converting the normal map into a replacement map, and generating a first MatCap map according to the replacement map and MatCap material balls;
in embodiments of the present invention, the normal map may be converted to a displacement map to extrude the displacement details of the model. Specifically, the normal map can be converted into the replacement map through knald software, and the conversion parameters are set during conversion, so that the replacement map obtained through conversion meets the condition of realizing high-mode replacement details, and after conversion is completed, the conversion result is exported into the replacement map in a 16-bit Tiff format. Fig. 4 shows a schematic representation of a displacement map converted from the normal map shown in fig. 2.
After the conversion to obtain the replacement map, a first MatCap map may be generated according to the replacement map and a MatCap Material ball, where the MatCap (Material Capture) Material ball may be a Material preset to add some display effects to the model.
Step 103, endowing the MatCap material balls with a low model of the preset model, and baking to obtain a second MatCap map;
in the embodiment of the invention, the MatCap material balls can be endowed to the low mode of the preset model to realize the effect of MatCap material rendering, and then the low mode of the preset model with the MatCap material effect is baked to obtain the second MatCap map.
Specifically, a normal map can be attached to a low mode through Maya software, then a MatCap material ball is attached to the low mode, global illumination is added to the environment of the low mode, and a second MatCap map is obtained through baking in the Maya software by using an Aronld renderer.
And 104, synthesizing the first MatCap map and the second MatCap map to obtain a target MatCap map.
In the embodiment of the invention, the first MatCap map and the second MatCap map can be synthesized to obtain the finally required first MatCap map and second MatCap map. Specifically, the second MatCap map is made into a mask of the first MatCap map through Adobe Photoshop software, so that some unnecessary images in the second MatCap map are hidden through the mask, then the mask image is processed in an opposite phase, the first MatCap map and the image processed in the opposite phase are respectively imported into the Adobe Photoshop software as different layers, and then 2 layers are synthesized to obtain the target MatCap map.
In a preferred embodiment of the present invention, the step 102 may comprise the sub-steps of:
creating a square patch model; the replacement map and the MatCap material ball are endowed to the square surface patch model; and baking the square patch model to obtain a first MatCap map.
In the embodiment of the invention, a square patch model is firstly created, the square patch model is used for baking a first MatCap map with details of MatCap material balls and replacement maps, the replacement maps and the MatCap material balls are endowed to the created square patch model, and then the square patch model is baked to obtain the first MatCap map.
As one example, a first Matcap map is obtained by baking Matcap material spheres and displacement maps in ZBrush software. Specifically, a square patch model is first created in ZBrush software, then UV is expanded maximally and filled into UV quadrants, canvas size is set to 4096 x 4096, matCap material balls are selected, the model is selected to be displayed maximally to the view, a replacement map in step 102 is imported, a replacement intensity value is set, at this time, the square patch model in the view shows replaced high-modulus details, and the image is exported to finish ZBrush baking of MatCap material balls to the map. Fig. 5 shows a schematic diagram of a MatCap material ball, fig. 6 shows a schematic diagram of a first MatCap map generated by using the MatCap material ball in fig. 5, and fig. 7 shows a schematic diagram of a preset model rendered by using the first MatCap map in fig. 6.
In a preferred embodiment of the present invention, said step 103 may comprise the sub-steps of:
determining a color map corresponding to the MatCap material ball; and according to the color map, the MatCap material balls are endowed to a low mode of the preset model, and a second MatCap map is obtained through baking.
Specifically, the low modulus of the MatCap material ball to be endowed to the preset model can be determined by Maya software. Because the Maya software does not have MatCap material balls, the MatCap material balls can be endowed to the low mode of the preset model in the Maya software by creating MatCap material balls at material nodes in the Maya software. In specific implementation, a color map corresponding to the MatCap material ball is determined, the MatCap material ball is endowed with a low mode of a preset model according to the color map, global illumination is added to the environment of the low mode of the preset model, and the MatCap map is obtained by baking in Maya software by using an Aronld renderer. Fig. 8 is a schematic diagram showing a second MatCap map obtained by baking the MatCap material balls in fig. 5, and fig. 9 is a schematic diagram showing a preset model rendered by using the second MatCap map in fig. 8, wherein the model rendered according to the second MatCap map has obvious shadow effect.
In a preferred embodiment of the present invention, the determining the color map of the material ball corresponding to the MatCap material includes:
acquiring a material image corresponding to the MatCap material ball; mapping the world normal of the preset model from-1 to between 0 and 1 of the texture map to obtain a mapping result; and taking the mapping result as texture map coordinates to sample the texture image, and obtaining a color map corresponding to the MatCap material ball.
In the embodiment of the invention, the material image corresponding to the MatCap material ball can be acquired first, for example, the material image corresponding to the Matcap material ball can be acquired from ZBrush software, namely, the material image is acquired by screenshot the Matcap material ball in the Zbrush software. Further, texture map coordinates sampled from the texture image may be determined, so as to sample a color map corresponding to MatCap materials from the texture image according to the texture map coordinates.
Specifically, some set texture nodes are provided in Maya software, including a sampleInfo information sampling tool node, a multiplexing division tool node, a plusMinuseaverage addition and subtraction average node, an aiImage image node, and the like, and color maps corresponding to MatCap texture balls can be determined through the texture nodes.
In a specific implementation, after the sampleInfo node in Maya is used to link the multiple division node, a parameter is set to multiply 0.5 in a multiplication-division attribute of the multiple division node, then the multiple division node is used to link the plusMinuserage node, and a parameter is set to add 0.5 in an addition-subtraction average attribute of the plusMinuserage node, through the linking of the texture nodes, the world normal of each patch in the preset model can be mapped from original-1 to 0 to 1 of the texture map in the fragment shader, and a mapping result is obtained, so that the mapping result is used as a texture map coordinate. And finally, using a PLusMinuserage node to link an aiImage node, importing a material image corresponding to the MatCap material ball into the image attribute of the aiImage node, attaching the material image to uv of the ailmage node of the Matcap map, and thus, sampling from the material image according to the texture map coordinates to obtain a color map corresponding to the Matcap material ball.
In a preferred embodiment of the present invention, the step of assigning the MatCap material balls to the low mode of the preset model according to the color map, and baking to obtain a second MatCap map includes:
attaching the normal map and the color map to a material ball to obtain a MatCap material ball with a normal map effect; and giving the MatCap material balls with the normal mapping effect to a low mode of the preset model, and baking to obtain a second MatCap mapping.
In the embodiment of the invention, the MatCap material ball with the normal mapping effect can be obtained by mapping the normal line into the material ball and pasting the color image corresponding to the MatCap material ball onto the material ball with the normal line mapping effect, then the MatCap material ball with the normal line mapping effect is endowed with the low model of the preset model, and the second MatCap mapping is obtained by baking. The material ball used for attaching the normal map may be a preset material ball, for example, an aistandard surface material ball in Maya software, and the MatCap material ball with the normal map effect may be created in Maya software by attaching the color map corresponding to the MatCap material ball to the material ball attached with the normal map.
Specifically, maya software may further include an aifelt node and an aistandard surface ball node, the aiImage node is used to link to the aifelt node, then the aistandard surface node to which the aifelt node is linked is used to import a normal map into the aistandard surface node, so that the normal map can be attached to the aistandard surface ball, and a color map corresponding to the MatCap ball can be attached to the aistandard surface ball attached with the normal map, so that the MatCap ball with the normal map effect is obtained.
In a preferred embodiment of the present invention, the step of assigning the MatCap material balls to the low mode of the preset model and baking to obtain a second MatCap map includes:
and giving the MatCap material balls to a low model of the preset model, and baking by a renderer to obtain a second MatCap map.
In the embodiment of the invention, the MatCap material balls can be endowed with the low mode of the preset model, and the low mode of the preset model is baked by a renderer to obtain the second MatCap map.
As an example, baking may be performed by an arondd renderer, the functions of the arondd renderer are integrated in Maya software, and the arondd renderer may be used to bake a second MatCap map. Specifically, due to the use of the airstandard surface material ball of Maya software, during baking, airkydomedight light needs to be created to perform global illumination, and the second MatCap map is obtained by baking under the global illumination. Due to the addition of global illumination, the display effect of each angle in the obtained second MatCap map is correct, and the corresponding MatCap map does not need to be manufactured from a plurality of angles, so that the manufacturing efficiency is improved. A schematic of a second MatCap map of the present invention is shown in fig. 7.
In a preferred embodiment of the present invention, the synthesizing the first MatCap map and the second MatCap map to obtain the target MatCap map includes:
converting the second MatCap map into a gray map, and performing color inversion processing on the gray map; and taking the image subjected to the inversion treatment as a mask of the first MatCap map, and synthesizing the first MatCap map and the second MatCap map after adding the mask to obtain a target MatCap map.
In the embodiment of the invention, the second MatCap map is manufactured as one mask of the first MatCap map, and then the first MatCap map and the second MatCap map are synthesized, so that the performance effect of the MatCap map can be improved. Specifically, the second MatCap map may be converted into a gray map, then the gray map is subjected to color inversion processing, the image after the inversion processing is used as a mask to be added into the first MatCap map, and the first MatCap map and the second MatCap map after the mask addition are synthesized to obtain the target MatCap map.
The masking plate is used for hiding some unwanted image information, whether the color mapping is shaded or not can be controlled by synthesizing the first MatCap mapping and the second MatCap mapping, because the second Matcap mapping obtained by baking in Maya has obvious black shadows, and the first Matcap mapping obtained by baking in ZBrush can be used for covering the black shadows, so that the expression effect of the MatCap mapping is improved. Fig. 10 shows a schematic diagram of a target MatCap map synthesized from fig. 6 and 8.
In a preferred embodiment of the present invention, the method may further comprise the steps of:
and rendering the preset model according to the target MatCap map so as to display the preset model with MatCap material effect in the game scene.
Specifically, when the preset model is required to be displayed in the game scene during game operation, the preset model can be rendered according to the target MatCap map so as to display the preset model with MatCap material effect in the game scene.
In the implementation of the invention, the normal map is converted into the replacement map by baking the normal map aiming at the low mode of the preset model, a first MatCap map is generated according to the replacement map and MatCap material balls, the MatCap material balls are endowed to the low mode of the preset model, a second MatCap map is obtained by baking, and the first MatCap map and the second MatCap map are synthesized to obtain the target MatCap map. The normal map is converted into the replacement map and then baked to obtain the MatCap map, so that a low die for baking has high-modulus details, the MatCap map is convenient to bake, the problems of high baking time cost and insufficient stereoscopic impression of an object caused by directly baking the replacement map are avoided, and the MatCap map can be baked under the global illumination of the MatCap material balls by endowing the MatCap material balls with the low-modulus baking of a preset model to obtain the second MatCap map, so that the MatCap map can be correctly displayed in multiple angles, obvious directional shadows are avoided, the corresponding MatCap map is manufactured without manually processing each angle, and the MatCap map manufacturing efficiency is improved.
It should be noted that, for simplicity of description, the method embodiments are shown as a series of acts, but it should be understood by those skilled in the art that the embodiments are not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred embodiments, and that the acts are not necessarily required by the embodiments of the invention.
Referring to fig. 11, a structural block diagram of an embodiment of a MatCap map generating apparatus according to the present invention may specifically include the following modules:
a normal map baking module 1101 for baking a normal map for a low mode of a preset model;
the first map generating module 1102 is configured to convert the normal map into a replacement map, and generate a first MatCap map according to the replacement map and a MatCap material ball;
a second map generation module 1103, configured to assign the MatCap material balls to a low mode of the preset model, and bake to obtain a second MatCap map;
and a map synthesis module 1104, configured to synthesize the first MatCap map and the second MatCap map to obtain a target MatCap map.
In a preferred embodiment of the invention, the normal map corresponds to the high modulus of the preset model.
In a preferred embodiment of the present invention, the first map generating module 1102 includes:
the dough piece model creation sub-module is used for creating a square dough piece model;
a material giving sub-module for giving the replacement map and the MatCap material ball to the square patch model;
and the baking submodule is used for baking the square dough piece model to obtain a first MatCap map.
In a preferred embodiment of the present invention, the second map generating module 1103 includes:
the color map determining submodule is used for determining a color map corresponding to the MatCap material ball;
and the second map generation sub-module is used for endowing the MatCap material balls with the low modulus of the preset model according to the color map, and baking to obtain a second MatCap map.
In a preferred embodiment of the present invention, the color map determining sub-module includes:
the material image acquisition unit is used for acquiring a material image corresponding to the MatCap material ball;
the coordinate mapping unit is used for mapping the world normal of the preset model from-1 to between 0 and 1 of the texture map to obtain a mapping result;
and the image sampling unit is used for sampling the mapping result from the material image as texture map coordinates to obtain a color map corresponding to the MatCap material sphere.
In a preferred embodiment of the present invention, the second map generation sub-module includes:
the material ball generating unit is used for pasting the normal map and the color map into the material ball to obtain a MatCap material ball with a normal map effect;
and the second map generation unit is used for endowing the MatCap material ball with the normal map effect to a low mode of the preset model, and baking to obtain a second MatCap map.
In a preferred embodiment of the present invention, the second map generating module 1103 includes:
the second map generation module is used for endowing the MatCap material balls to a low mode of the preset model, and baking the MatCap material balls through a renderer to obtain a second MatCap map.
In a preferred embodiment of the present invention, the map composition module 1104 includes:
the inverting processing sub-module is used for converting the second MatCap map into a gray map and performing color inverting processing on the gray map;
and the image synthesis submodule is used for taking the image subjected to the inversion processing as a mask of the first MatCap map, and synthesizing the first MatCap map and the second MatCap map after the mask is added to obtain a target MatCap map.
In a preferred embodiment of the invention, the device further comprises:
and the MatCap map rendering module is used for rendering the preset model according to the target MatCap map so as to display the preset model with MatCap material effect in the game scene.
For the device embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference is made to the description of the method embodiments for relevant points.
The embodiment of the invention also provides an electronic device, as shown in fig. 12, including:
a processor 1201, a storage medium 1202 and a bus 1203, the storage medium 1202 storing machine readable instructions executable by the processor 1201, the processor 1201 and the storage medium 1202 communicating over the bus 1203 when the electronic device is running, the processor 901 executing the machine readable instructions to perform a method according to any of the embodiments of the present invention. The specific implementation manner and technical effects are partially similar to those of the method embodiment, and are not repeated here.
The embodiment of the present invention further provides a computer readable storage medium, as shown in fig. 13, where a computer program 1301 is stored, where the computer program 1301 when executed by a processor performs a method according to any of the embodiments of the present invention. The specific implementation manner and technical effects are partially similar to those of the method embodiment, and are not repeated here.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described by differences from other embodiments, and identical and similar parts between the embodiments are all enough to be referred to each other.
It will be apparent to those skilled in the art that embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, embodiments of the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the invention may take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
Embodiments of the present invention are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiment and all such alterations and modifications as fall within the scope of the embodiments of the invention.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or terminal device comprising the element.
The above description of the method and the device for generating MatCap map provided by the invention is detailed, and specific examples are applied to illustrate the principle and the implementation of the invention, and the above description of the examples is only used for helping to understand the method and the core idea of the invention; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present invention, the present description should not be construed as limiting the present invention in view of the above.

Claims (12)

1. The MatCap map generation method is characterized by comprising the following steps:
low-mode baking normal mapping for a preset model;
converting the normal map into a replacement map, and generating a first MatCap map according to the replacement map and a preset MatCap material ball; the normal map corresponds to a high mode of a preset model, the converted replacement map has the condition of high mode replacement details, and the MatCap material balls are used for adding display effects;
giving the MatCap material balls to a low model of the preset model, and baking to obtain a second MatCap map; the second MatCap map is provided with global illumination added for a low-mode environment;
synthesizing the first MatCap map and the second MatCap map to obtain a target MatCap map; the target MatCap map is used for rendering the preset model.
2. The method of claim 1, wherein the normal map corresponds to a high modulus of the preset model.
3. The method of claim 1, wherein generating a first MatCap map from the replacement map and MatCap material balls comprises:
creating a square patch model;
the replacement map and the MatCap material ball are endowed to the square surface patch model;
and baking the square patch model to obtain a first MatCap map.
4. The method of claim 1, wherein the assigning the MatCap material balls to the low mode of the predetermined model and baking to obtain a second MatCap map comprises:
determining a color map corresponding to the MatCap material ball;
and according to the color map, the MatCap material balls are endowed to a low mode of the preset model, and a second MatCap map is obtained through baking.
5. The method of claim 4, wherein the determining a color map corresponding to the MatCap material sphere comprises:
acquiring a material image corresponding to the MatCap material ball;
mapping the world normal of the preset model from-1 to between 0 and 1 of the texture map to obtain a mapping result;
and taking the mapping result as texture map coordinates to sample the texture image, and obtaining a color map corresponding to the MatCap material ball.
6. The method according to claim 4 or 5, wherein the assigning the MatCap material balls to the low mode of the preset model according to the color map, and baking to obtain a second MatCap map, includes:
attaching the normal map and the color map to a material ball to obtain a MatCap material ball with a normal map effect;
and giving the MatCap material balls with the normal mapping effect to a low mode of the preset model, and baking to obtain a second MatCap mapping.
7. The method of claim 1, wherein the assigning the MatCap material balls to the low mode of the predetermined model and baking to obtain a second MatCap map comprises:
and giving the MatCap material balls to a low model of the preset model, and baking by a renderer to obtain a second MatCap map.
8. The method of claim 1, wherein the synthesizing the first MatCap map and the second MatCap map to obtain a target MatCap map comprises:
converting the second MatCap map into a gray map, and performing color inversion processing on the gray map;
and taking the image subjected to the inversion treatment as a mask of the first MatCap map, and synthesizing the first MatCap map and the second MatCap map after adding the mask to obtain a target MatCap map.
9. The method according to claim 1 or 8, characterized in that the method further comprises:
and rendering the preset model according to the target MatCap map so as to display the preset model with MatCap material effect in the game scene.
10. The device for generating the MatCap map is characterized by comprising the following components:
the normal line mapping baking module is used for baking the normal line mapping aiming at a low mode of a preset model;
the first map generation module is used for converting the normal map into a replacement map and generating a first MatCap map according to the replacement map and a preset MatCap material ball; the normal map corresponds to a high mode of a preset model, the converted replacement map has the condition of high mode replacement details, and the MatCap material balls are used for adding display effects;
the second map generation module is used for endowing the MatCap material balls with a low model of the preset model and baking to obtain a second MatCap map; the second MatCap map is provided with global illumination added for a low-mode environment;
the map synthesis module is used for synthesizing the first MatCap map and the second MatCap map to obtain a target MatCap map; the target MatCap map is used for rendering the preset model.
11. An electronic device, comprising:
a processor, a storage medium, and a bus, the storage medium storing machine-readable instructions executable by the processor, the processor in communication with the storage medium via the bus when the electronic device is running, the processor executing the machine-readable instructions to perform the MatCap map generation method of any one of claims 1-9.
12. A computer readable storage medium, characterized in that the storage medium has stored thereon a computer program which, when executed by a processor, performs a method of MatCap map generation according to any of claims 1-9.
CN202110316070.8A 2021-03-24 2021-03-24 MatCap map generation method and device Active CN113034661B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110316070.8A CN113034661B (en) 2021-03-24 2021-03-24 MatCap map generation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110316070.8A CN113034661B (en) 2021-03-24 2021-03-24 MatCap map generation method and device

Publications (2)

Publication Number Publication Date
CN113034661A CN113034661A (en) 2021-06-25
CN113034661B true CN113034661B (en) 2023-05-23

Family

ID=76473672

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110316070.8A Active CN113034661B (en) 2021-03-24 2021-03-24 MatCap map generation method and device

Country Status (1)

Country Link
CN (1) CN113034661B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113808246B (en) * 2021-09-13 2024-05-10 深圳须弥云图空间科技有限公司 Method and device for generating map, computer equipment and computer readable storage medium
CN114119848B (en) * 2021-12-05 2024-05-14 北京字跳网络技术有限公司 Model rendering method and device, computer equipment and storage medium

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9153209B2 (en) * 2012-08-06 2015-10-06 Nvidia Corporation Method and system for generating a displacement map from a normal map
CN104574488A (en) * 2014-12-08 2015-04-29 北京理工大学 Method for optimizing three-dimensional model for mobile augmented reality browser
CN109427088B (en) * 2017-08-18 2023-02-03 腾讯科技(深圳)有限公司 Rendering method for simulating illumination and terminal
CN107622520A (en) * 2017-09-29 2018-01-23 上海开圣影视文化传媒股份有限公司 The method for accelerating to render
CN108090946A (en) * 2017-12-14 2018-05-29 苏州蜗牛数字科技股份有限公司 A kind of construction method and device of material ball
CN108564646B (en) * 2018-03-28 2021-02-26 腾讯科技(深圳)有限公司 Object rendering method and device, storage medium and electronic device
CN109523619A (en) * 2018-11-12 2019-03-26 厦门启尚科技有限公司 A method of 3D texturing is generated by the picture of multi-angle polishing
CN111563951B (en) * 2020-05-12 2024-02-23 网易(杭州)网络有限公司 Map generation method, device, electronic equipment and storage medium
CN112037311B (en) * 2020-09-08 2024-02-20 腾讯科技(深圳)有限公司 Animation generation method, animation playing method and related devices

Also Published As

Publication number Publication date
CN113034661A (en) 2021-06-25

Similar Documents

Publication Publication Date Title
CN109427088B (en) Rendering method for simulating illumination and terminal
CN107680042B (en) Rendering method, device, engine and storage medium combining texture and convolution network
CN113034661B (en) MatCap map generation method and device
JP2018081672A (en) New view composition using deep-layer convolutional neural network
US20030034977A1 (en) Method and apparatus for varying focus in a scene
CN111047506B (en) Environmental map generation and hole filling
CN112053424B (en) Rendering method and device of 3D model
TW201610915A (en) Image processing method for transforming 2D image into 3D model
US11276150B2 (en) Environment map generation and hole filling
CN111144491B (en) Image processing method, device and electronic system
WO2020077913A1 (en) Image processing method and device, and hardware device
CN111508058A (en) Method and device for three-dimensional reconstruction of image, storage medium and electronic equipment
CN111429553B (en) Animation preview method, device, computer equipment and storage medium
CN114640885B (en) Video frame inserting method, training device and electronic equipment
CN117078849A (en) Normal map generation method and device
CN110378948A (en) 3D model reconstruction method, device and electronic equipment
CN115487495A (en) Data rendering method and device
KR101098830B1 (en) Surface texture mapping apparatus and its method
JP2023153534A (en) Image processing apparatus, image processing method, and program
CN114332356A (en) Virtual and real picture combining method and device
CN111726566B (en) Realization method for correcting splicing anti-shake in real time
CN109729285B (en) Fuse grid special effect generation method and device, electronic equipment and storage medium
CN116704140B (en) Human body three-dimensional reconstruction method, system, computer and storage medium
CN113936084B (en) Generation method of target elements in virtual sky and related equipment
CN116778053B (en) Target engine-based map generation method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant