Design drawing model material replacement method and device
By merging material maps with lighting, diffuse, and reflective layers in the design drawing, a model image after material replacement is generated, solving the problems of high computational load and high resource consumption in existing technologies for model material replacement, and achieving efficient material replacement.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- GUANGDONG SANWEIJIA INFORMATION TECH CO LTD
- Filing Date
- 2022-10-12
- Publication Date
- 2026-06-23
AI Technical Summary
Existing technologies involve a large amount of computation and high resource consumption when changing model materials in design drawings, resulting in a long processing time.
By receiving material selection instructions, the target model is determined from the various models in the design drawing, and the corresponding target material texture is obtained from the material texture map of the target model. This texture map is then merged with the lighting map, diffuse map, and reflection and refraction map of the design drawing to generate a model image with the changed material, thus avoiding the need to re-perform lighting, diffuse reflection, and reflection and refraction calculations.
It reduces the computational load when changing model materials, lowers resource consumption, and improves the accuracy and efficiency of material changes.
Smart Images

Figure CN115511934B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, specifically to a method and apparatus for changing the model material of a design drawing. Background Technology
[0002] With the development of the software industry, the creation of drawings is often controlled by software, including the generation of design drawings. A common issue in design drawings is the need to change the materials of the model, such as replacing plain tiles with patterned tiles. In related technologies, when the model's material needs to be changed, the model and its associated materials are typically obtained. Then, lighting, diffuse reflection calculations, and other methods are used to render the model after the material change, resulting in an image of the model with the changed material. However, this method requires a large amount of computation on the GPU, leading to significant computational overhead and high resource consumption when changing the material of a model in the design drawing. Summary of the Invention
[0003] This application aims to address at least one of the technical problems existing in the related art. To this end, this application proposes a method for changing the model material in a design drawing, which can reduce the computational load when changing the material of the model in the design drawing and reduce the resources required for changing the model material.
[0004] This application also proposes a device for changing the model material of a design drawing.
[0005] This application also proposes an electronic device.
[0006] This application also proposes a computer-readable storage medium.
[0007] The method for changing the model material of the design drawing according to the first aspect of this application includes:
[0008] Based on the received material selection instructions, determine the target model from the various models in the design drawing;
[0009] From each material texture map of the target model, obtain the target material texture map corresponding to the material selection command;
[0010] The target material texture is merged with the lighting map, diffuse map, and reflection and refraction map of the design drawing to obtain the model image of the target model in the design drawing;
[0011] The design drawing is an image obtained through rendering;
[0012] The light map, the diffuse reflection map, and the reflection and refraction map are the layers obtained after the design drawing is rendered.
[0013] After receiving a material selection instruction, the target model is determined from each model in the design drawing. Based on the material selection instruction, the corresponding target material texture is determined from each material texture map of the target model. The target material texture is then merged with the lighting map, diffuse map, and reflection and refraction map of the design drawing to obtain the model image of the target model in the design drawing. Thus, after generating the design drawing with only one rendering, when changing the material of any model in the design drawing, the layers of the design drawing and the material texture of the model can be directly merged to obtain the model image of the model with the changed material. There is no need to re-perform lighting, diffuse, and reflection and refraction calculations when changing the model's material, thereby reducing the amount of calculation required when changing the model's material in the design drawing and reducing the resources required when changing the model's material.
[0014] According to one embodiment of this application, obtaining the target material texture map corresponding to the material selection instruction from each material texture map of the target model includes:
[0015] The color area corresponding to the target model in the object map of the design drawing is determined to be a replaceable area, and the material textures of the target model are loaded.
[0016] From each of the aforementioned material texture maps, obtain the target material texture map corresponding to the material selection instruction;
[0017] The object diagram records color regions that correspond one-to-one with each of the models in the design diagram.
[0018] According to one embodiment of this application, after determining that the color area corresponding to the target model in the object drawing of the design drawing is a replaceable area, the method further includes:
[0019] Hide the model in each specified area of the design drawing;
[0020] Wherein, the designated area is a non-replaceable area in the object diagram corresponding to the color area.
[0021] According to one embodiment of this application, it also includes:
[0022] The color area corresponding to the target model in the object image of the design drawing is determined to be a non-replaceable area, and the current image of the target model in the design drawing is determined as the model image of the target model in the design drawing.
[0023] According to one embodiment of this application, the target material texture is merged with the lighting map, diffuse reflection map, and reflection and refraction map of the design drawing to obtain a model image of the target model in the design drawing, including:
[0024] Based on the target area where the target model is located in the design drawing, the light color, diffuse color, and reflective color of the target area are obtained from the light diagram, the diffuse reflection diagram, and the reflective refraction diagram.
[0025] The target model is colored based on the light color, diffuse color, reflective color, and target material texture to obtain the model image of the target model in the design drawing.
[0026] According to one embodiment of this application, the target model is colored based on the light color, diffuse color, reflected and refracted color, and target material texture to obtain a model image of the target model in the design drawing, including:
[0027] Multiply the light color by the diffuse color to obtain the first color value;
[0028] The first color value is superimposed with the reflected and refracted color to obtain the second color value;
[0029] The target model is colored according to the second color value and the target material texture to obtain the model image of the target model in the design drawing.
[0030] According to one embodiment of this application, the model includes a customized model and a finished product model;
[0031] The customized model includes walls, floors, ceilings, bricks, and cabinets;
[0032] The finished product models include sofas, tables, and decorations.
[0033] The model material changing device according to the design drawings of the second aspect embodiment of this application includes:
[0034] The target model determination module is used to determine the target model from the various models in the design drawing based on the received material selection instructions.
[0035] The material texture acquisition module is used to acquire the target material texture corresponding to the material selection instruction from each material texture of the target model;
[0036] The model material replacement module is used to merge the target material texture with the lighting map, diffuse map and reflection and refraction map of the design drawing to obtain the model image of the target model in the design drawing;
[0037] The design drawing is an image obtained through rendering;
[0038] The light map, the diffuse reflection map, and the reflection and refraction map are the layers obtained after the design drawing is rendered.
[0039] An electronic device according to a third aspect of this application includes a processor and a memory storing a computer program, wherein the processor executes the computer program to implement the model material replacement method of the design drawing described in any of the above embodiments.
[0040] A computer-readable storage medium according to a fourth aspect of this application stores a computer program thereon, which, when executed by a processor, implements the model material replacement method for the design drawing described in any of the above embodiments.
[0041] A computer program product according to a fifth aspect of this application includes: when the computer program is executed by a processor, it implements a method for changing the model material of a design drawing as described in any of the above embodiments.
[0042] The above-described one or more technical solutions in the embodiments of this application have at least one of the following technical effects:
[0043] After receiving a material selection instruction, the target model is determined from each model in the design drawing. Based on the material selection instruction, the corresponding target material texture is determined from each material texture map of the target model. The target material texture is then merged with the lighting map, diffuse map, and reflection and refraction map of the design drawing to obtain the model image of the target model in the design drawing. Thus, after generating the design drawing with only one rendering, when changing the material of any model in the design drawing, the layers of the design drawing and the material texture of the model can be directly merged to obtain the model image of the model with the changed material. There is no need to re-perform lighting, diffuse, and reflection and refraction calculations when changing the model's material, thereby reducing the amount of calculation required when changing the model's material in the design drawing and reducing the resources required when changing the model's material.
[0044] Furthermore, by matching the target model with the object map of the design drawing, the color area of the target model in the object map is determined. When the color area of the target model in the object map is a replaceable area, the material textures of the target model are loaded. From each material texture, the target material texture corresponding to the material selection command is obtained. Thus, by determining that the color area of the target model in the object map is a replaceable area, the corresponding material texture is loaded for target material texture selection. This allows users to avoid accidental material changes by setting the model's color, thereby improving the accuracy of material changes.
[0045] Furthermore, by determining that the target model's corresponding color area in the object graph of the design drawing is a replaceable area, and then hiding the model whose corresponding color area in the object graph is a non-replaceable area, it is possible to avoid loading the model whose corresponding color area in the object graph is a non-replaceable area when performing subsequent material replacement operations, thereby reducing the amount of resources consumed by the GPU. Attached Figure Description
[0046] To more clearly illustrate the technical solutions in this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0047] Figure 1 This is a flowchart illustrating the method for changing the model material of the design drawing provided in this application embodiment;
[0048] Figure 2 This is a schematic diagram of the user interface when selecting materials in an embodiment of this application;
[0049] Figure 3 This is an embodiment of the present application. Figure 1 This is a detailed flowchart illustrating the process of obtaining the target material texture in the method of changing the model material in the design drawing;
[0050] Figure 4 This is an embodiment of the present application. Figure 1 A detailed flowchart illustrating the process of obtaining model images in the method of changing model materials in the design drawings;
[0051] Figure 5 This is a schematic diagram of the structure of the model material changing device provided in the embodiment of this application;
[0052] Figure 6 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0053] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings of the embodiments. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0054] The following will provide a detailed description and explanation of the model material replacement method and apparatus for the design drawings provided in this application through several specific embodiments.
[0055] In one embodiment, a method for changing the model material in a design drawing is provided. This method is applied to a terminal device to change the model material in the design drawing. The terminal device can be a desktop terminal or a mobile terminal; a mobile terminal can be a laptop computer, mobile phone, smartwatch, or other portable terminal.
[0056] like Figure 1 As shown in the figure, the method for changing the model material of a design drawing provided in this embodiment includes:
[0057] Step 101: Based on the received material selection instructions, determine the target model from the various models in the design drawing;
[0058] Step 102: Obtain the target material texture corresponding to the material selection instruction from each material texture of the target model;
[0059] Step 103: Merge the material texture with the lighting map, diffuse map and reflection and refraction map of the design drawing to obtain the model image of the target model in the design drawing;
[0060] The design drawing is an image obtained through rendering;
[0061] The light map, the diffuse reflection map, and the reflection and refraction map are the layers obtained after the design drawing is rendered.
[0062] After receiving a material selection instruction, the target model is determined from each model in the design drawing. Based on the material selection instruction, the corresponding target material texture is determined from each material texture map of the target model. The target material texture is then merged with the lighting map, diffuse map, and reflection and refraction map of the design drawing to obtain the model image of the target model in the design drawing. Thus, after generating the design drawing with only one rendering, when changing the material of any model in the design drawing, the layers of the design drawing and the material texture of the model can be directly merged to obtain the model image of the model with the changed material. There is no need to re-perform lighting, diffuse, and reflection and refraction calculations when changing the model's material, thereby reducing the amount of calculation required when changing the model's material in the design drawing and reducing the resources required when changing the model's material.
[0063] In one embodiment, the design drawing is an image obtained after offline rendering, which loads the geometric data of each model, i.e., the image of the model. Each model can be divided into custom models and finished models. Custom models can include walls, floors, ceilings, floor tiles, tile joints, and cabinets, etc., while finished models can include sofas, tables, ornaments, and paintings, etc.
[0064] After obtaining the design drawing through offline rendering, the various layers can be extracted from the design drawing, including a light map that records the brightness of the object illuminated by light; a diffuse reflection map that records the diffuse reflection results; and a reflection and refraction map that records shadows and reflections and refractions. The extracted layers are then saved.
[0065] After obtaining the design drawing, upon receiving a material selection instruction from the user, the model specified by the material selection instruction in the design drawing is identified as the target model. The material selection instruction includes a selection operation, which can be a click operation. For example, when a user clicks on a specific floor tile in the design drawing, that clicked tile is identified as the target model.
[0066] In one embodiment, the terminal device may store material textures for any model. These material textures can be loaded onto the terminal device's display interface. After determining a target model, the terminal device can select the corresponding material textures for that target model and load them onto the terminal device's display interface.
[0067] Considering that the number of texture maps may be large, in one embodiment, the terminal device can pre-record the ID of each model. After determining the target model, the terminal device can send the ID of the target model to the server to receive the texture maps of the target model fed back by the server based on the ID. There is no need to store the texture maps of all models locally, thereby reducing the storage pressure on the terminal device.
[0068] After obtaining the material textures of the target model, these textures can be loaded onto the user interface of the terminal device for the user to select. For example, such as... Figure 2 As shown, the arrows indicate user clicks. When a user clicks on a floor tile, the tile's ID is sent to the server, which then retrieves the tile's texture maps and displays them in the texture display area on the left side of the user interface.
[0069] After obtaining the material textures of the target model, the selected material texture is selected according to the material selection command, such as clicking on any material texture. The clicked material texture is then used as the target material texture corresponding to the material selection command.
[0070] To avoid incorrect material selection when changing the model's material, leading to accidental material changes, in one embodiment, such as... Figure 3 As shown, from each material texture map of the target model, the target material texture map corresponding to the material selection command is obtained, including:
[0071] Step 201: Determine that the color area corresponding to the target model in the object map of the design drawing is a replaceable area, and load each of the material textures of the target model;
[0072] Step 202: Obtain the target material texture corresponding to the material selection instruction from each of the material texture maps;
[0073] The object diagram records color regions that correspond one-to-one with each of the models in the design diagram.
[0074] Considering that not all models require material replacement, in one embodiment, after generating the design drawing, an object map including the color regions of each model can be generated based on pre-defined colors for each model. For example, if all finished models are pre-defined as black, the floor as light blue, the walls as red, and the bricks as green, then after generating the design drawing, all finished models in the design drawing are replaced with black, the floor with light blue, the walls with red, and the bricks with green. This results in an object map including black finished models, light blue floors, red walls, and green bricks. Simultaneously, whether the materials of different color regions can be replaced can be pre-defined. For example, the black color region can be set as non-replaceable, while the light blue color region can be set as replaceable. Thus, when the user-selected model belongs to the light blue color region in the object map, the material of that model can be replaced. The color regions corresponding to each model and whether the materials of each color region can be replaced can be set according to actual conditions.
[0075] When the target model is obtained, based on its position in the design drawing, it is matched against various color regions in the object drawing to determine its specific color region. If the target model's color region is replaceable, such as a light blue region, it indicates that the target model's material can be replaced. In this case, the material textures of the target model are loaded and displayed as shown in the image. Figure 2 The texture display area shown is then used to select any material texture in the texture display area according to the material selection command. The selected material texture in the texture display area is then determined as the target material texture of the target model.
[0076] By matching the target model with the object map of the design drawing, the color area of the target model in the object map is determined. When the color area of the target model in the object map is a replaceable area, the material textures of the target model are loaded. From each material texture, the target material texture corresponding to the material selection command is obtained. By determining that the color area of the target model in the object map is a replaceable area, the corresponding material texture is loaded for target material texture selection. This allows users to avoid accidental material changes by setting the model's color, thus improving the accuracy of material changes.
[0077] To further reduce the amount of GPU resources consumed during material replacement, in one embodiment, after determining that the color area corresponding to the target model in the object graph of the design drawing is a replaceable area, the method further includes:
[0078] Hide the model in each specified area of the design drawing;
[0079] Wherein, the designated area is a non-replaceable area in the object diagram corresponding to the color area.
[0080] For example, the target model is a floor tile, and its corresponding color area in the object graph is red, indicating that it is a replaceable area. In this case, the model whose corresponding color area in the object graph is non-replaceable is obtained from the design drawing. For example, the model located in the black area in the object graph is the finished product model. These finished product models are then hidden in the design drawing, while the area of the finished product model in the design drawing is displayed in black. For example, if the cost model is a sofa and a table, after hiding them, they can be replaced by their colors in the object graph, eliminating the need for sofa and table models.
[0081] By determining that the target model's corresponding color area in the object graph of the design drawing is a replaceable area, the model whose corresponding color area in the object graph is a non-replaceable area is hidden. This eliminates the need to load the model whose corresponding color area in the object graph is a non-replaceable area when performing subsequent material replacement operations, thereby reducing the amount of GPU resources consumed.
[0082] In one embodiment, if it is determined that the color area corresponding to the target model in the object image of the design drawing is a non-replaceable area, the current image of the target model in the design drawing is determined as the model image of the target model in the design drawing.
[0083] For example, if the color region corresponding to the target model in the object image of the design drawing is determined to be a non-replaceable region, such as a black region, then the pixels of the target model are directly collected from the design drawing, and the collected pixels are then used as the model image of the target model in the design drawing. That is, the target model in the non-replaceable region is not modified.
[0084] In one embodiment, after obtaining the target material texture map, the target material texture map can be overlaid with each layer of the design drawing, namely the lighting map, diffuse reflection map and reflection and refraction map of the design drawing, so as to obtain the model image of the target model in the design drawing.
[0085] For example, after obtaining the target material texture, it can be overlaid with a lighting map to obtain a lighting effect map, and simultaneously overlaid with a diffuse reflection map to obtain a diffuse reflection effect map, and overlaid with a reflection and refraction map to obtain a reflection and refraction effect map. Then, the lighting effect map, diffuse reflection effect map, and reflection and refraction effect map are overlaid to obtain the model image of the target model in the design drawing.
[0086] To acquire model images more effectively, in one embodiment, such as Figure 4 As shown, the target material texture is merged with the lighting map, diffuse map, and reflection and refraction map of the design drawing to obtain the model image of the target model in the design drawing, including:
[0087] Step 301: Based on the target area where the target model is located in the design drawing, obtain the light color, diffuse color, and reflective color of the target area from the light diagram, the diffuse reflection diagram, and the reflection and refraction diagram;
[0088] Step 302: Color the target model according to the light color, diffuse color, reflective color, and target material texture to obtain the model image of the target model in the design drawing.
[0089] In one embodiment, after determining the target material texture, the target area where the target model is located in the design drawing is first obtained. For example, let the vertex position of the target model in the design drawing be position, and let the position of the target model in the design drawing be modelMatrix. By converting the vertex position from the model space coordinate system to the world coordinate system, the target area where the target model is located in the design drawing can be obtained as worldPos = modelMatrix * vec4(position, 1.0).
[0090] After determining the target area of the target model, the first area corresponding to the target area in the light map, the second area corresponding to the target area in the diffuse map, and the third area corresponding to the target area in the reflection and refraction map are determined. After determining the first area, the color of the target area is obtained by color sampling of the first area using the textureCube method; the diffuse color of the target area is obtained by color sampling of the second area of the diffuse map using texture2D; and the reflection and refraction color of the target area is obtained by color sampling of the third area of the reflection and refraction map using the textureCube method.
[0091] After obtaining the light color, diffuse color, and reflective color of the target area, the target model can be colored according to the light color, diffuse color, reflective color, and target material texture, thereby obtaining the model image of the target model in the design drawing.
[0092] To further improve the display effect of the model image after material replacement, in one embodiment, the target material texture is colored according to the light color, diffuse color, and reflected refraction color to obtain the model image of the target model in the design drawing, including:
[0093] Multiply the light color by the diffuse color to obtain the first color value;
[0094] The first color value is superimposed with the reflected and refracted color to obtain the second color value;
[0095] The target material texture is colored according to the second color value to obtain the model image of the target model in the design drawing.
[0096] In one embodiment, after obtaining the light color, diffuse color, and reflected / refracted color of the target area, the light color totalLight and the diffuse color diffuse are multiplied to obtain a first color value multiply = diffuse * totalLight. Then, the first color value multiply is added to the reflected / refracted color compositeMp to obtain a second color value multiply' = multiply + compositeMp. After obtaining the second color value multiply', it is assigned to the fragment shader. The target model loaded with the target material texture is then rendered based on the second color value to obtain the model image of the target model in the design drawing.
[0097] The following describes the model material changing device for the design drawing provided in this application. The model material changing device for the design drawing described below and the model material changing method for the design drawing described above can be referred to in correspondence.
[0098] In one embodiment, such as Figure 5 As shown, a model material changing device for a design drawing is provided, including:
[0099] The target model determination module 210 is used to determine the target model from the various models in the design drawing according to the received material selection instructions;
[0100] The material texture acquisition module 220 is used to acquire the target material texture corresponding to the material selection instruction from each material texture of the target model;
[0101] The model material replacement module 230 is used to merge the target material texture with the lighting map, diffuse map and reflection and refraction map of the design drawing to obtain the model image of the target model in the design drawing;
[0102] The design drawing is an image obtained through rendering;
[0103] The light map, the diffuse reflection map, and the reflection and refraction map are the layers obtained after the design drawing is rendered.
[0104] After receiving a material selection instruction, the target model is determined from each model in the design drawing. Based on the material selection instruction, the corresponding target material texture is determined from each material texture map of the target model. The target material texture is then merged with the lighting map, diffuse map, and reflection and refraction map of the design drawing to obtain the model image of the target model in the design drawing. Thus, after generating the design drawing with only one rendering, when changing the material of any model in the design drawing, the layers of the design drawing and the material texture of the model can be directly merged to obtain the model image of the model with the changed material. There is no need to re-perform lighting, diffuse, and reflection and refraction calculations when changing the model's material, thereby reducing the amount of calculation required when changing the model's material in the design drawing and reducing the resources required when changing the model's material.
[0105] In one embodiment, the material texture acquisition module 220 is specifically used for:
[0106] The color area corresponding to the target model in the object map of the design drawing is determined to be a replaceable area, and the material textures of the target model are loaded.
[0107] From each of the aforementioned material texture maps, obtain the target material texture map corresponding to the material selection instruction;
[0108] The object diagram records color regions that correspond one-to-one with each of the models in the design diagram.
[0109] In one embodiment, the material texture acquisition module 220 is further configured to:
[0110] After determining that the color area corresponding to the target model in the object diagram of the design drawing is a replaceable area, the model in each specified area of the design drawing is hidden;
[0111] Wherein, the designated area is a non-replaceable area in the object diagram corresponding to the color area.
[0112] In one embodiment, the material texture acquisition module 220 is further configured to:
[0113] The color area corresponding to the target model in the object image of the design drawing is determined to be a non-replaceable area, and the current image of the target model in the design drawing is determined as the model image of the target model in the design drawing.
[0114] In one embodiment, the model material changing module 230 is specifically used for:
[0115] Based on the target area where the target model is located in the design drawing, the light color, diffuse color, and reflective color of the target area are obtained from the light diagram, the diffuse reflection diagram, and the reflective refraction diagram.
[0116] The target model is colored based on the light color, diffuse color, reflective color, and target material texture to obtain the model image of the target model in the design drawing.
[0117] In one embodiment, the model material changing module 230 is specifically used for:
[0118] Multiply the light color by the diffuse color to obtain the first color value;
[0119] The first color value is superimposed with the reflected and refracted color to obtain the second color value;
[0120] The target model is colored according to the second color value and the target material texture to obtain the model image of the target model in the design drawing.
[0121] In one embodiment, the model includes a customized model and a finished product model;
[0122] The customized model includes walls, floors, ceilings, bricks, and cabinets;
[0123] The finished product models include sofas, tables, and decorations.
[0124] Figure 6 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 6 As shown, the electronic device may include: a processor 810, a communication interface 820, a memory 830, and a communication bus 840, wherein the processor 810, the communication interface 820, and the memory 830 communicate with each other via the communication bus 840. The processor 810 can call a computer program in the memory 830 to execute a method for changing the model material of the design drawing, such as including:
[0125] Based on the received material selection instructions, determine the target model from the various models in the design drawing;
[0126] From each material texture map of the target model, obtain the target material texture map corresponding to the material selection command;
[0127] The target material texture is merged with the lighting map, diffuse map, and reflection and refraction map of the design drawing to obtain the model image of the target model in the design drawing;
[0128] The design drawing is an image obtained through rendering;
[0129] The light map, the diffuse reflection map, and the reflection and refraction map are the layers obtained after the design drawing is rendered.
[0130] Furthermore, the logical instructions in the aforementioned memory 830 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0131] On the other hand, embodiments of this application also provide a storage medium, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the model material replacement method for the design drawings provided in the above embodiments, for example including:
[0132] Based on the received material selection instructions, determine the target model from the various models in the design drawing;
[0133] From each material texture map of the target model, obtain the target material texture map corresponding to the material selection command;
[0134] The target material texture is merged with the lighting map, diffuse map, and reflection and refraction map of the design drawing to obtain the model image of the target model in the design drawing;
[0135] The design drawing is an image obtained through rendering;
[0136] The light map, the diffuse reflection map, and the reflection and refraction map are the layers obtained after the design drawing is rendered.
[0137] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0138] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0139] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A method for changing the model material of a design drawing, characterized in that, include: Based on the received material selection instructions, determine the target model from the various models in the design drawing; From each material texture map of the target model, obtain the target material texture map corresponding to the material selection command; The target material texture is merged with the lighting map, diffuse map, and reflection and refraction map of the design drawing to obtain the model image of the target model in the design drawing; The target material texture is merged with the lighting map, diffuse map, and reflection and refraction map of the design drawing to obtain the model image of the target model in the design drawing, including: Based on the target area where the target model is located in the design drawing, the light color, diffuse color, and reflective color corresponding to the target area are obtained from the light map, diffuse reflection map, and reflective refraction map that are pre-rendered and saved for the design drawing. The target model is colored according to the light color, diffuse color, reflective color, and target material texture to obtain the model image of the target model in the design drawing; The design drawing is an image obtained through a single rendering; the lighting map, the diffuse reflection map, and the reflection and refraction map are layers generated and saved respectively during the process of completing the single rendering to generate the design drawing, corresponding to the lighting effect, diffuse reflection effect, and reflection and refraction effect of each model in the design drawing.
2. The method for changing the model material of the design drawing according to claim 1, characterized in that, From each material texture map of the target model, obtain the target material texture map corresponding to the material selection command, including: The color area corresponding to the target model in the object map of the design drawing is determined to be a replaceable area, and the material textures of the target model are loaded. From each of the aforementioned material texture maps, obtain the target material texture map corresponding to the material selection instruction; The object diagram records color regions that correspond one-to-one with each of the models in the design diagram.
3. The method for changing the model material of the design drawing according to claim 2, characterized in that, After determining that the color area corresponding to the target model in the object drawing of the design drawing is a replaceable area, the method further includes: Hide the model in each specified area of the design drawing; Wherein, the designated area is a non-replaceable area in the object diagram corresponding to the color area.
4. The method for changing the model material of the design drawing according to claim 2, characterized in that, Also includes: The color area corresponding to the target model in the object image of the design drawing is determined to be a non-replaceable area, and the current image of the target model in the design drawing is determined as the model image of the target model in the design drawing.
5. The method for changing the model material of the design drawing according to claim 1, characterized in that, The target model is colored based on the light color, diffuse color, reflected and refracted color, and target material texture to obtain the model image of the target model in the design drawing, including: Multiply the light color by the diffuse color to obtain the first color value; The first color value is superimposed with the reflected and refracted color to obtain the second color value; The target model is colored according to the second color value and the target material texture to obtain the model image of the target model in the design drawing.
6. The method for changing the model material of the design drawing according to claim 1, characterized in that, The models include customized models and finished models; The customized model includes walls, floors, ceilings, bricks, and cabinets; The finished product models include sofas, tables, and decorations.
7. A device for changing the material of a design drawing model, characterized in that, include: The target model determination module is used to determine the target model from the various models in the design drawing based on the received material selection instructions. The material texture acquisition module is used to acquire the target material texture corresponding to the material selection instruction from each material texture of the target model; The model material replacement module is used to merge the target material texture with the lighting map, diffuse map and reflection and refraction map of the design drawing to obtain the model image of the target model in the design drawing; The model material changing module is specifically used for: Based on the target area where the target model is located in the design drawing, the light color, diffuse color, and reflective color corresponding to the target area are obtained from the light map, diffuse reflection map, and reflective refraction map that are pre-rendered and saved for the design drawing. The target model is colored according to the light color, diffuse color, reflective color, and target material texture to obtain the model image of the target model in the design drawing; The design drawing is an image obtained through a single rendering; the lighting map, the diffuse reflection map, and the reflection and refraction map are layers generated and saved respectively during the process of completing the single rendering to generate the design drawing, corresponding to the lighting effect, diffuse reflection effect, and reflection and refraction effect of each model in the design drawing.
8. An electronic device comprising a processor and a memory storing a computer program, characterized in that, When the processor executes the computer program, it implements the model material replacement method of the design drawing as described in any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the model material replacement method of the design drawing as described in any one of claims 1 to 6.