Virtual character garment rendering method and device, equipment and storage medium
By setting initial marking points on the virtual character screen, combining SAM and Stable Diffusion models to generate and render clothing, the limitations of clothing diversity and personalized choices in traditional dress-up systems are solved, and efficient and diverse clothing generation is achieved.
Patent Information
- Application Number
- CN202411832074.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-12
- Publication Date
- 2025-03-25
AI Technical Summary
The traditional game character dressing system relies on pre-designed clothing models, limiting the diversity of clothing and the personalized choices of players, and adding new clothing requires additional design time and resources.
By setting the initial marking point on the screen image of the virtual character, determining the target mask area based on the preset SAM model, obtaining the semantic data input by the user to generate the clothing image prompt word, using the Stable Diffusion model to generate the rendered clothing, and filling it into the target mask area.
It realizes the generation of diverse and style-matched virtual character clothing without increasing design time and resources, enhancing the real-time and user experience of clothing generation.
Smart Images

Figure CN119693519A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of virtual rendering technology, and in particular to a method, device, equipment and storage medium for rendering clothing of a virtual character. Background Art
[0002] With the continuous advancement of game engines and graphics rendering technology, modern video games have reached unprecedented heights in visual performance. However, there are still some challenges in the dressing and appearance rendering of game characters. Traditional dressing systems rely on pre-designed and pre-made clothing models. Although this method can ensure a certain level of quality control, it also greatly limits the diversity of character costumes and the personalized choices of players. Each new set of clothing requires additional design time and resource investment, which is a considerable burden for game development that pursues rapid iteration and rich content. Summary of the invention
[0003] The present application provides a method, apparatus, device and storage medium for rendering clothing of a virtual character, which are used to generate clothing of the virtual character in real time and render the virtual character according to the generated clothing.
[0004] In a first aspect, an embodiment of the present application provides a method for rendering clothing of a virtual character, the method comprising: According to the user's selection operation, an initial mark point is set on the screen image of the virtual character; Based on a preset SAM model, according to the initial marking points, a target mask area is determined from the screen image; Acquire semantic data input by a user, and generate clothing image prompt words based on the semantic data; Based on a preset Stable Diffusion model, generating a rendered garment according to the target mask area and the garment image prompt word; The rendered clothing is filled into the target mask area to generate an updated virtual character.
[0005] In a second aspect, an embodiment of the present application provides a clothing rendering device for a virtual character, the device comprising: A marking setting module, used to set an initial marking point on the screen image of the virtual character according to the user's selection operation; A region determination module, used for determining a target mask region from the screen image based on a preset SAM model and the initial marking points; A semantic analysis module, used to obtain semantic data input by a user and generate clothing image prompt words based on the semantic data; A clothing generation module, for generating rendered clothing based on a preset Stable Diffusion model, according to the target mask area and the clothing image prompt words; The clothing rendering module is used to fill the rendered clothing into the target mask area to generate an updated virtual character.
[0006] In a third aspect, an embodiment of the present application provides an electronic device, the electronic device comprising a memory and a processor; The memory is used to store computer programs; The processor is used to execute the computer program and implement the virtual character clothing rendering method as described in any one of the embodiments of the present application when executing the computer program.
[0007] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor enables the processor to implement a method for rendering clothing for a virtual character as described in any one of the embodiments of the present application.
[0008] The embodiment of the present application provides a method of setting an initial mark point on the screen image of a virtual character according to the user's selection operation; determining the target mask area from the screen image based on the initial mark point based on the preset SAM model; obtaining the semantic data input by the user, and generating clothing image prompt words based on the semantic data; generating rendering clothing based on the target mask area and clothing image prompt words based on the preset Stable Diffusion model; filling the rendering clothing into the target mask area to generate an updated virtual character. In the above method, the initial mark point is set on the image through the user's selection operation to achieve accurate positioning of a specific area, determine the target mask area from the initial mark point based on the SAM model, accurately segment the complex image area, obtain the semantic data input by the user and generate clothing image prompt words, better meet the personalized needs of users through natural language processing technology, use the Stable Diffusion model to generate rendering clothing according to the target mask area and clothing image prompt words, and ensure the image quality while improving the diversity and style matching of generated clothing, filling the rendering clothing into the target mask area, and seamlessly combining clothing with virtual characters, which not only enhances the overall visual effect and user experience, but also enhances the real-time and diversity of clothing generation. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying any creative work.
[0010] Figure 1 A schematic flow chart of a first method for rendering clothing of a virtual character provided in an embodiment of the present application; Figure 2 A schematic flow chart of a second method for rendering clothing of a virtual character provided in an embodiment of the present application; Figure 3 A schematic block diagram of a virtual character clothing rendering device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0011] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0012] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.
[0013] It should also be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0014] It should be further understood that the term “and / or” used in the specification and appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0015] See also Figure 1 , Figure 1 FIG. 1 is a schematic flow chart of a first method for rendering clothing of a virtual character provided by an embodiment of the present application. Figure 1 As shown, the specific steps of the virtual character clothing rendering method include: S101-S105.
[0016] S101. According to a user's selection operation, an initial mark point is set on a screen image of a virtual character.
[0017] Exemplarily, the user sets an initial marker point on the screen image where the virtual character is located through the operation interface. This process usually involves the user using a mouse or touch device to click a specific location on the screen image to identify the area they want to edit or change. In this way, the user can clearly indicate the specific location where they want to apply the clothing, thereby improving the accuracy and efficiency of subsequent processing. The setting of the initial marker point not only provides basic data for subsequent image processing, but also enhances the user's sense of participation and control, so that the final generated virtual character is more in line with the user's expectations.
[0018] S102: Based on a preset SAM model and according to initial marking points, a target mask area is determined from the screen image.
[0019] For example, based on the preset SAM (Segment Anything Model) model, the target mask area is automatically identified and determined starting from the initial marker points set by the user. The SAM model can efficiently segment and analyze the image through a deep learning algorithm, accurately identifying the area of interest to the user. By combining the initial marker points with the image content, the SAM model can generate an accurate mask that will be used for subsequent image processing. This process not only improves the degree of automation of image processing, but also ensures the high quality and high fidelity of the generated results, laying a solid foundation for subsequent steps.
[0020] S103: Acquire semantic data input by the user, and generate clothing image prompt words based on the semantic data.
[0021] Exemplarily, based on the semantic data input by the user, these semantic data are usually clothing description prompt words, including: text, voice, image and other multimodal information. These semantic data can be the user's description of clothing style, color, material and other aspects. Through natural language processing technology, these semantic data are converted into clothing image prompt words, which will be used as the basis for generating rendered clothing. The user's input makes the generation process more personalized and customized, ensuring that the generated clothing meets the user's needs and aesthetics. In this process, text analysis algorithms are involved to extract keywords and topics, so as to generate more targeted prompt words, providing a clear direction for subsequent image generation.
[0022] S104, based on a preset Stable Diffusion model, generating rendered clothing according to the target mask area and the clothing image prompt words.
[0023] For example, the preset Stable Diffusion model is used to generate the rendered clothing in combination with the target mask area and the generated clothing image prompt words. In this process, the Stable Diffusion model generates clothing images that meet the user's expectations by understanding the prompt words provided by the user, and ensures that it can adapt to the shape and characteristics of the target mask area, which not only improves the diversity and creativity of the generated clothing, but also ensures the visual consistency and realism of the generated results.
[0024] S105, filling the target mask area with the rendered clothing to generate an updated virtual character.
[0025] Exemplarily, the generated rendered clothing is filled into the previously determined target mask area. This process involves image synthesis technology, which generates an updated virtual character by seamlessly blending the rendered clothing with the original virtual character image. In addition, a variety of image processing techniques may be used, such as edge smoothing, color matching, and light and shadow adjustment, to ensure a natural transition and consistency between clothing and the virtual character. The final generated image not only reflects the user's personalized choice, but also enhances the visual effect and attractiveness of the virtual character, enhancing the user's experience.
[0026] In order to more intuitively introduce the technical solution of the present application, the embodiment of the present application also provides a second method for rendering clothing of a virtual character. Figure 2 , Figure 2 FIG. 1 is a schematic flow chart of a second method for rendering clothing of a virtual character provided in an embodiment of the present application. Figure 2 As shown, the specific steps of the second virtual character clothing rendering method include: S201, input game screen image.
[0027] S202: The user provides an initial marking point.
[0028] S203, the SAM model outputs a pre-selected mask area according to the initial marking points.
[0029] S204, the user confirms whether the pre-selected mask area is the target mask area, if not, execute step S205, if yes, execute step S206.
[0030] S205: Add initial marking points.
[0031] S206: Input clothing image prompt words.
[0032] S207: Generate clothing rendering information according to the prompt word.
[0033] S208, the Stable Diffusion model generates rendered clothing according to the clothing rendering information.
[0034] S209, blending the rendered clothing into the target mask area.
[0035] S210: The user confirms whether the rendered clothing is satisfactory. If not, execute step S211; if so, execute step S212.
[0036] S211, the user modifies the clothing image prompt word.
[0037] S212, complete the change of clothes.
[0038] The embodiment of the present application provides a method of setting an initial mark point on the screen image of a virtual character according to the user's selection operation; determining the target mask area from the screen image based on the initial mark point based on the preset SAM model; obtaining the semantic data input by the user, and generating clothing image prompt words based on the semantic data; generating rendering clothing based on the target mask area and clothing image prompt words based on the preset Stable Diffusion model; filling the rendering clothing into the target mask area to generate an updated virtual character. In the above method, the initial mark point is set on the image through the user's selection operation to achieve accurate positioning of a specific area, determine the target mask area from the initial mark point based on the SAM model, accurately segment the complex image area, obtain the semantic data input by the user and generate clothing image prompt words, better meet the personalized needs of users through natural language processing technology, use the Stable Diffusion model to generate rendering clothing according to the target mask area and clothing image prompt words, and ensure the image quality while improving the diversity and style matching of generated clothing, filling the rendering clothing into the target mask area, and seamlessly combining clothing with virtual characters, which not only enhances the overall visual effect and user experience, but also enhances the real-time and diversity of clothing generation.
[0039] In order to more clearly introduce the technical solution of the present application, the technical solution of the present application will be introduced through specific embodiments below. It should be noted that the specific embodiments are used to expand the technical solution of the present application, but are not intended to limit the present application.
[0040] In some embodiments, the preset SAM model includes: a lightweight mask encoder and an image decoder. Based on the preset SAM model, according to the initial marking points, the target mask area is determined from the screen image, including: inputting the screen image into the preset SAM model; based on the lightweight mask encoder, extracting features of the screen image according to the initial marking points to obtain a mask embedding feature set; inputting the mask embedding feature set into the image decoder to determine the target mask area.
[0041] Exemplarily, the preset SAM model needs to be trained with training images and training mask prompt words, and the preset SAM model includes: a Vit-based image encoder, a lightweight mask encoder and an image decoder. The training image is input into the SAM model, and the first feature set of the training image is extracted through the Vit-based image encoder. The training image is divided into block images, and the block images are converted into uncoded embedded feature sets through the lightweight mask encoder. The preset mask feature set is fused into the embedded feature set through the image decoder. It should be noted that the image decoder is constructed based on the cross attention mechanism, and also has a prompt guidance mechanism. The prompt guidance mechanism is used to generate a mask feature set according to the training mask prompt words. In the training image. Mapping is performed through a linear function to obtain a second feature set of the training image. The training loss is calculated through the first feature set and the second feature set. When the training loss reaches the preset convergence condition, the training is completed to obtain the preset SAM model.
[0042] In the embodiment of the present application, the Stable Diffusion model includes: a CLIP module, a forward diffusion module and a reverse generation module.
[0043] The CLIP module has a trained text encoder (FrozenCLIP encoder) to convert semantic data into image prompt words.
[0044] In some embodiments, semantic data input by a user is obtained, and clothing image prompt words are generated based on the semantic data, including: performing word segmentation encoding processing on the semantic data, using a preset CLIP model text encoder to perform position embedding calculation on a semantic tag sequence to obtain a semantic tag vector; performing multi-layer Transformer encoding on the semantic tag vector, and performing contextual relationship modeling on the semantic content through an attention mechanism of a preset CLIP model to obtain semantic context features; calculating a cosine distance metric based on the semantic context features through a preset CLIP model visual-language pre-trained sample library, and performing cross-modal feature alignment to obtain a visual-language correspondence matrix; performing feature decoupling on the visual-language correspondence matrix to obtain clothing visual features; using a preset CLIP model semantic projection layer to perform semantic mapping transformation on clothing visual features to obtain clothing semantic feature descriptions; using a preset CLIP model text generation head to perform sequence decoding on the clothing semantic feature descriptions, and performing word sequence combination through a greedy search algorithm sequence decoding to obtain clothing image prompt words.
[0045] For example, through word segmentation encoding, position embedding, Transformer encoding and attention mechanism, the system can deeply understand the contextual relationship of semantic content and realize accurate mapping of semantic and visual features through cross-modal feature alignment. Multi-layer feature decoupling and semantic projection transformation further improve the accuracy of semantic expression, and finally generate high-quality clothing image prompt words through greedy search algorithm. This CLIP model-based method not only significantly improves the depth and breadth of semantic understanding, but also enhances the semantic coherence between user input and image generation, providing technical support for personalized virtual character clothing rendering, and realizing more intelligent and accurate semantic-visual conversion.
[0046] In some embodiments, the preset Stable Diffusion model includes: Unet image encoder, noise autoencoder, Unet image decoder and Transformer attention mechanism. The Diffusion model generates rendered clothing according to the target mask area and the clothing image prompt words, including: based on the Unet image encoder, generating pre-selected clothing according to the clothing image prompt words and the target mask area; injecting random Gaussian noise into the pre-selected clothing, constructing a multi-scale noise level mapping through a forward diffusion process, and obtaining an initial latent space noise image; based on the initial latent space noise image, using a noise autoencoder to probabilistically encode the noise distribution to obtain a latent variable distribution; using the Transformer attention mechanism to embed the clothing image prompt words into the latent variable distribution to obtain a conditional latent space representation; based on the Unet image decoder, gradually denoising and reconstructing the conditional latent space representation to obtain a denoised intermediate image; performing cross-modal feature alignment on the denoised intermediate image, using the Unet image decoder to perform interactive attention calculation on the image semantic features and text prompt words to obtain a semantic consistency score; according to the semantic consistency score, the rendered clothing image is reconstructed in detail and texture enhanced through the generative adversarial network of the Unet image decoder to obtain the final rendered clothing image.
[0047] Exemplarily, the forward diffusion module includes: Unet image encoder and noise autoencoder, and the reverse generation model includes: Unet image decoder and Transformer attention mechanism. The Unet image encoder first generates pre-selected clothing based on the clothing image prompt words and the target mask area, and then introduces rich image change possibilities through random Gaussian noise injection and forward diffusion process. The noise autoencoder probabilistically encodes the noise distribution, and the Transformer attention mechanism accurately embeds the clothing image prompt words into the latent variable distribution, realizing the deep fusion of semantic information. The Unet image decoder ensures the clarity and semantic consistency of the image through step-by-step denoising reconstruction and cross-modal feature alignment. Finally, the generative adversarial network reconstructs the details and enhances the texture of the rendered clothing image, which not only improves the visual quality of the image, but also significantly improves the personalization and accuracy of the virtual character clothing rendering, providing an innovative technical solution for intelligent clothing customization.
[0048] In some embodiments, the Transformer attention mechanism is used to embed clothing image prompt words into the latent variable distribution to obtain a conditional latent space representation, including: performing multi-dimensional projection transformation and similarity calculation on the latent variable features through preset parallel attention heads to obtain latent variable attention weights; cross-attention encoding is performed on the clothing image prompt words according to the latent variable attention weights, and a semantic association mapping is constructed through a query-key-value mechanism to obtain conditional attention features; the conditional attention features are hierarchically decoded, and the features are nonlinearly transformed and enhanced through a multi-layer residual connected feedforward neural network to obtain multi-scale conditional features; according to the multi-scale conditional features, the process of decoding the conditional attention features of the latent variable distribution is conditionally guided to obtain a conditional latent space representation.
[0049] For example, the deep fusion of clothing image prompt words and latent variable distribution is realized through the sophisticated Transformer attention mechanism, which becomes a key technology to improve rendering quality. First, through the preset parallel attention head, the latent variable features are multi-dimensionally projected and similarity is calculated to obtain the latent variable attention weight. This step realizes the nonlinear mapping and semantic deconstruction of the feature space. Subsequently, based on the latent variable attention weight, the query-key-value mechanism is used to cross-attention encode the clothing image prompt words, and an accurate semantic association mapping is constructed to effectively capture the deep semantic relationship between the prompt words. Then, through a multi-layer residual connected feedforward neural network, the conditional attention features are nonlinearly transformed and enhanced to generate multi-scale conditional features. This process not only retains the original feature information, but also alleviates the gradient vanishing problem of the deep network through residual connections. Finally, the multi-scale conditional features are used to guide the decoding process of the latent variable distribution to obtain a highly semantically consistent conditional latent space representation.
[0050] Through the above process, multi-dimensional and multi-angle analysis of features is achieved through parallel attention heads, the query-key-value mechanism ensures the precise alignment of semantic information, and the multi-layer residual connection feedforward network enhances the expressiveness of features. Compared with traditional methods, this solution significantly improves the semantic accuracy and visual quality of clothing image rendering while maintaining computational efficiency, providing a more intelligent and flexible technical path for personalized virtual character clothing customization.
[0051] In some embodiments, an initial marking point is set on the screen image of the virtual character according to the user's selection operation, including: performing region segmentation processing on the screen image to obtain candidate marking areas; locating the candidate marking areas according to the user's click coordinates to obtain an initialization marking area; and performing boundary refinement processing on the initialization marking area to obtain an initial marking point.
[0052] For example, the screen image is segmented, and the semantic segmentation algorithm is used to identify the candidate marking area in the image, and the candidate marking area is accurately located according to the user's click coordinates. Through the boundary precision processing, the initialization marking area is carefully optimized, which effectively overcomes the uncertainty and subjectivity of the traditional manual marking method. This method not only greatly improves the accuracy of marking, but also greatly simplifies the user operation process, provides a more intelligent and humanized interaction method for virtual character clothing rendering, and significantly enhances the user experience and the interactive performance of the system.
[0053] In some embodiments, the rendered clothing is filled into the target mask area to generate an updated virtual character, including: performing a size-matching transformation on the rendered clothing, and scaling and rotating the clothing image to obtain a clothing image that conforms to the size of the target mask area; based on the clothing image, smoothing the image edge to obtain a transitionally smooth clothing edge; based on the transitionally smooth clothing edge, superimposing the clothing image on the target mask area; and performing pixel-level fusion on the target mask area and the clothing image to obtain an updated virtual character image.
[0054] For example, by means of size matching transformation and image scaling and rotation adjustment, the clothing image is ensured to accurately match the target mask area, solving the adaptation problem at different sizes and angles. Edge smoothing further optimizes the visual transition effect of the clothing image and eliminates the obvious sense of boundary. Pixel-level fusion technology ensures that the clothing and the virtual character image are seamlessly connected, avoiding the jagged edges and unnatural phenomena common in traditional methods. This method not only significantly improves the realism and aesthetics of the virtual character clothing rendering, but also greatly enhances the accuracy and intelligence of image processing, providing a more smooth and natural technical solution for personalized virtual image customization.
[0055] See also Figure 3 , Figure 33 is a schematic block diagram of a virtual character clothing rendering device provided by an embodiment of the present application, wherein the virtual character clothing rendering device 300 is used to execute the aforementioned virtual character clothing rendering method. The virtual character clothing rendering device 300 can be configured in a server.
[0056] Among them, the server can be an independent server or a server cluster, or it can be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN) and big data and artificial intelligence platforms.
[0057] like Figure 3 As shown, the virtual character clothing rendering device 300 includes: a mark setting module 301, a region determination module 302, a semantic analysis module 303, a clothing generation module 304 and a clothing rendering module 305.
[0058] The mark setting module 301 is used to set an initial mark point on the screen image of the virtual character according to the user's selection operation.
[0059] The region determination module 302 is used to determine the target mask region from the screen image based on the preset SAM model and the initial marking points.
[0060] The semantic analysis module 303 is used to obtain semantic data input by the user and generate clothing image prompt words based on the semantic data.
[0061] The clothing generation module 304 is used to generate rendered clothing based on a preset Stable Diffusion model, according to the target mask area and clothing image prompt words.
[0062] The clothing rendering module 305 is used to fill the rendered clothing into the target mask area to generate an updated virtual character.
[0063] An embodiment of the present application provides an electronic device, which includes a memory and a processor; the memory is used to store a computer program; the processor is used to execute the computer program and implement a method for rendering clothing of a virtual character as described in any one of the embodiments of the present application when executing the computer program.
[0064] An embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the processor implements a method for rendering clothing for a virtual character as described in any one of the embodiments of the present application.
[0065] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A method for rendering clothing of a virtual character, characterized in that: The method comprises: According to the user's selection operation, an initial mark point is set on the screen image of the virtual character; Based on a preset SAM model, according to the initial marking points, a target mask area is determined from the screen image; Acquire semantic data input by a user, and generate clothing image prompt words based on the semantic data; Based on a preset Stable Diffusion model, generating a rendered garment according to the target mask area and the garment image prompt word; The rendered clothing is filled into the target mask area to generate an updated virtual character.
2. The method for rendering clothing of a virtual character according to claim 1, characterized in that: The preset SAM model includes: a lightweight mask encoder and an image decoder. The preset SAM model is based on the initial marking point, and the target mask area is determined from the screen image, including: Inputting the screen image into the preset SAM model; Based on the lightweight mask encoder, extracting features from the screen image according to the initial marking points to obtain a mask embedding feature set; The mask embedding feature set is input into the image decoder to determine the target mask area.
3. The method for rendering clothing of a virtual character according to claim 1, characterized in that: The acquiring of semantic data input by the user and generating clothing image prompt words based on the semantic data includes: Performing word segmentation encoding processing on the semantic data, using a preset CLIP model text encoder to perform position embedding calculation on the semantic tag sequence to obtain a semantic tag vector; Performing multi-layer Transformer encoding on the semantic tag vector, modeling the contextual relationship of the semantic content through the attention mechanism of the preset CLIP model, and obtaining semantic context features; Calculating the cosine distance metric based on the semantic context feature through the preset visual-language pre-trained sample library of the CLIP model, and performing cross-modal feature alignment to obtain a visual-language correspondence matrix; Performing feature decoupling on the vision-language correspondence matrix to obtain clothing visual features; Using the semantic projection layer of the preset CLIP model to perform semantic mapping transformation on the clothing visual features to obtain clothing semantic feature description; The preset CLIP model's text generation head is used to perform sequence decoding on the clothing semantic feature description, and the sequence decoding is combined with word sequences through a greedy search algorithm to obtain the clothing image prompt words.
4. The method for rendering clothing of a virtual character according to claim 1, characterized in that: The preset Stable Diffusion model includes: a Unet image encoder, a noise autoencoder, a Unet image decoder and a Transformer attention mechanism. The preset Stable Diffusion model is used to generate rendered clothing according to the target mask area and the clothing image prompt word, including: Based on the Unet image encoder, generating pre-selected clothing according to the clothing image prompt words and the target mask area; Injecting random Gaussian noise into the pre-selected clothing, constructing a multi-scale noise level mapping through a forward diffusion process, and obtaining an initial latent space noise image; According to the initial latent space noise image, a noise autoencoder is used to probabilistically encode the noise distribution to obtain a latent variable distribution; The clothing image prompt words are embedded into the latent variable distribution using the Transformer attention mechanism to obtain a conditional latent space representation; Based on the Unet image decoder, the conditional latent space representation is gradually denoised and reconstructed to obtain a denoised intermediate image; Performing cross-modal feature alignment on the denoised intermediate image, and using the Unet image decoder to perform interactive attention calculation on the image semantic features and text prompt words to obtain a semantic consistency score; According to the semantic consistency score, the rendered clothing image is reconstructed in detail and enhanced in texture through the generative adversarial network of the Unet image decoder to obtain a final rendered clothing image.
5. The method for rendering clothing of a virtual character according to claim 4, characterized in that: The method of using the Transformer attention mechanism to embed the clothing image prompt word into the latent variable distribution to obtain a conditional latent space representation includes: Perform multi-dimensional projection transformation and similarity calculation on the latent variable features through preset parallel attention heads to obtain latent variable attention weights; According to the latent variable attention weight, the clothing image prompt word is cross-attention encoded, and a semantic association map is constructed through a query-key-value mechanism to obtain a conditional attention feature; The conditional attention features are hierarchically decoded, and the features are nonlinearly transformed and enhanced through a multi-layer residual connected feedforward neural network to obtain multi-scale conditional features; According to the multi-scale conditional features, the process of decoding the conditional attention features is conditionally guided to obtain the conditional latent space representation.
6. The method for rendering clothing of a virtual character according to claim 1, characterized in that: The step of setting an initial mark point on the screen image of the virtual character according to the user's selection operation includes: Performing region segmentation processing on the screen image to obtain candidate marking regions; Positioning the candidate marking area according to the click coordinates of the user to obtain an initialization marking area; The initial marking area is processed to obtain an initial marking point.
7. The method for rendering clothing of a virtual character according to claim 1, characterized in that: The step of filling the rendered clothing into the target mask area to generate an updated virtual character includes: Performing size matching transformation on the rendered clothing, and scaling and rotating the clothing image to obtain a clothing image that meets the size of the target mask area; According to the clothing image, smoothing the image edge to obtain a clothing edge with a smooth transition; Based on the transition-smoothed clothing edge, superimposing the clothing image onto the target mask area; The target mask area and the clothing image are fused at pixel level to obtain an updated virtual character image.
8. A clothing rendering device for a virtual character, characterized in that: The clothing rendering device for the virtual character comprises: A marking setting module, used to set an initial marking point on the screen image of the virtual character according to the user's selection operation; A region determination module, used for determining a target mask region from the screen image based on a preset SAM model and according to the initial marking points; A semantic analysis module, used to obtain semantic data input by a user and generate clothing image prompt words based on the semantic data; A clothing generation module, used for generating rendered clothing based on a preset Stable Diffusion model, according to the target mask area and the clothing image prompt words; The clothing rendering module is used to fill the rendered clothing into the target mask area to generate an updated virtual character.
9. An electronic device, characterized in that: The electronic device comprises a memory and a processor; The memory is used to store computer programs; The processor is used to execute the computer program and implement the virtual character clothing rendering method as described in any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor implements the method for rendering clothing of a virtual character as claimed in any one of claims 1 to 7.
Citation Information
Cited By
Embroidery product virtual rendering method and system based on model collaboration
CN120912709A
Backboard video generation method for real-time interactive digital human and related device
CN121619475A
Garment image generation method based on basic element retrieval and replacement
CN122049119A
A clothing image generation method based on basic element retrieval and replacement
CN122049119B