A visual texture mapping method and system based on three-dimensional engine

By using custom shaders and scripts in the 3D engine, textures are updated in real time, which solves the problem that traditional texture mapping technology cannot change dynamically, realizes the generation and rendering of dynamically scanned mesh textures, and improves the visual experience and rendering efficiency.

CN118334227BActive Publication Date: 2024-09-03YANTAI JIERUI NETWORK TRADING
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410748623.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-12
Publication Date
2024-09-03
Estimated Expiration
2044-06-12

AI Technical Summary

Technical Problem

Traditional texture mapping technology cannot achieve dynamic changes, which limits dynamic visual effects and real-time graphics rendering, affecting the immersive experience.

Method used

Using a visual texture mapping method based on a 3D engine, through custom shaders and scripts, combined with mathematics and geometric animation, the texture is updated in real time, and dynamic scanning mesh textures are generated and applied to achieve real-time rendering and updating of textures.

Benefits of technology

It provides dynamically changing scanning mesh textures to enhance the visual experience. Users can adapt to different scenarios through parameter adjustment to achieve efficient and flexible texture generation and rendering.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118334227B
    Figure CN118334227B
Patent Text Reader

Abstract

The present invention relates to the field of computer graphics technology, and in particular to a visual texture mapping method and system based on a three-dimensional engine. The method includes obtaining a texture generation script and resources based on a three-dimensional engine editor; obtaining user input texture generation parameters based on a user interface; loading a pre-created texture template; generating a new texture based on the user input and the texture template; applying the generated new texture to the material surface of a target three-dimensional model; and updating the texture and shader parameters in real time according to logic when the application is running, and rendering the result to an active scene. The present invention can create a scanned mesh texture with dynamic changes and provide a novel visual effect. Secondly, the user can control the generation and change of the texture by adjusting the parameters to adapt to different application scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer graphics technology, in particular to a three-dimensional engine-based visual texture mapping method and system. Background Art

[0002] With the continuous development of computer graphics technology, as well as the advancement of technology and changes in demand, visual texture mapping can provide applications with richer visual effects to enhance reality and increase the sense of future technology. At this stage, with the continuous development of computers, visualization effects are increasingly being used in various 3D engines, usually using custom shaders to achieve image rendering, to replace the editable program of the fixed rendering pipeline. Among them, VertexShader is mainly responsible for the calculation of the geometric relationship of vertices, and Pixel Shader is mainly responsible for the calculation of the color of the fragment.

[0003] In modern graphics rendering and game development, texture mapping is the basis for achieving complex visual effects. Traditional texture mapping technology usually relies on pre-designed texture patterns, which are static when applied and cannot be changed dynamically. However, in some application scenarios, such as dynamic visual effects in the scene or real-time graphics rendering, textures need to be able to change in real time according to the game state or user input. In the past, navigation and interaction were usually provided by maps, HUDs, or visual clues. Especially for those who seek a highly immersive experience, the HUD display elements and instructions on the screen may make the overall visual interface appear full and lack innovation, the visual effects are bland, the mechanism is limited, affecting the visual effects and the displayed content, and lacking an immersive experience. Summary of the invention

[0004] In order to solve the above-mentioned problems, the present invention provides a visual texture mapping method and system based on a three-dimensional engine. The present invention combines computer graphics and a variety of graphics programming technologies. The solution can create and apply dynamically changing scanned mesh textures in the engine. By using custom shaders and scripts, it can achieve real-time texture updates, rendering pipelines, post-processing effects, mathematics and geometry, animation and dynamic effects to achieve immersive and realistic visual scanned mesh visual effects to enhance the visual experience.

[0005] In a first aspect, the present invention provides a visual texture mapping method based on a three-dimensional engine, which adopts the following technical solution:

[0006] A visual texture mapping method based on a three-dimensional engine, comprising:

[0007] Based on the 3D engine editor, obtain texture generation scripts and resources;

[0008] Obtaining parameters for texture generation input by a user based on a user interface;

[0009] Load pre-created texture templates;

[0010] Generate new textures based on user input and texture templates;

[0011] Apply the generated new texture to the material surface of the target three-dimensional model;

[0012] While the app is running, textures and shader parameters are updated in real time according to the logic, and the results are rendered to the active scene.

[0013] Furthermore, the three-dimensional engine editor is based on obtaining texture generation scripts and resources, including setting up a rendering pipeline, loading texture generation scripts and other related resources, including shaders, materials and texture templates.

[0014] Furthermore, the obtaining of user input parameters for texture generation based on a user interface includes obtaining input parameters for texture generation, inputting grid size, scanning color, scanning speed, interval range, direction and texture fluctuation, and selecting preset parameter values ​​or inputting new values.

[0015] Furthermore, the loading of the pre-created texture template includes creating a texture template in an image editing software, wherein the size is set to a multiple of two, the line style, grid color, and transparency of the grid are defined, the texture template is saved in jpg format, and the texture template is saved for loading.

[0016] Further, the new texture is generated based on user input and texture template, including defining grid layout, determining the number of grid rows and columns, ensuring texture resolution, determining grid line width and spacing, and line color and transparency, creating a new texture object using the Texture2D class in the engine, setting the texture width and height as well as the pixel format and compression method, drawing grid lines, traversing each pixel of the texture, drawing lines according to the grid layout, using loops and arrays to store the starting and ending positions of the lines, as well as color and transparency information, and defining the starting position and moving path of the scan line, updating the position of the scan line, and applying color changes or transparency changes. The mathematical function sine wave is used to calculate the moving path and color changes of the scan line, and dynamically generate a grid texture.

[0017] Furthermore, the application of the generated new texture to the material surface of the target three-dimensional model includes creating a target material in the engine, binding the Texture2D object created during the texture generation process to the texture attribute of the target material, and assigning a reference to the texture object to the _MainTex attribute of the material.

[0018] Furthermore, when the application is running, the texture and shader parameters are updated in real time according to the logic, and the results are rendered to the active scene, including setting the texture and shader parameters of the target material according to the parameters input by the user, and dynamically updating the texture pixel color value at runtime, including the movement of the scanning effect, speed change color adjustment.

[0019] In a second aspect, the present invention provides a visual texture mapping system based on a three-dimensional engine, comprising:

[0020] The system initialization module is configured to obtain texture generation scripts and resources based on the 3D engine editor;

[0021] A user input module is configured to obtain a parameter for generating a user input texture based on a user interface;

[0022] The texture template loading module is configured to load a pre-created texture template;

[0023] A texture generation module, configured to generate a new texture based on user input and a texture template;

[0024] The texture application module is configured to apply the generated new texture to the material surface of the target three-dimensional model;

[0025] The real-time update and rendering module is configured to update the texture and shader parameters in real time according to the logic when the application is running, and render the result to the active scene.

[0026] In a third aspect, the present invention provides a computer-readable storage medium storing a plurality of instructions, wherein the instructions are suitable for being loaded by a processor of a terminal device and executing the described method.

[0027] In a fourth aspect, the present invention provides a terminal device, comprising a processor and a computer-readable storage medium, wherein the processor is used to implement various instructions; and the computer-readable storage medium is used to store multiple instructions, wherein the instructions are suitable for being loaded by the processor and executing the described method.

[0028] In summary, the present invention has the following beneficial technical effects:

[0029] The present invention can create a scanned grid texture with dynamic changes and provide a novel visual effect. Secondly, the user can control the generation and change of the texture by adjusting parameters to adapt to different application scenarios.

[0030] By optimizing algorithms and data structures, the present invention does not describe the optimization algorithms and data structures. Whether it is necessary to supplement the algorithm content, the present invention can efficiently generate and apply textures in the engine. In general, through the combination of custom shaders and scripts, this technology has the characteristics of flexibility, performance optimization and real-time rendering, and is suitable for a variety of application scenarios. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1 It is a schematic diagram of a visual texture mapping method based on a three-dimensional engine according to Embodiment 1 of the present invention.

[0032] Figure 2 It is a schematic diagram of a visual texture mapping system based on a three-dimensional engine according to Embodiment 1 of the present invention. DETAILED DESCRIPTION

[0033] The present invention is further described in detail below in conjunction with the accompanying drawings.

[0034] Example 1

[0035] Reference Figure 1 , a visual texture mapping method based on a three-dimensional engine in this embodiment includes:

[0036] Prepare texture generation scripts and resources based on the 3D engine editor;

[0037] Get the parameters of texture generation input by the user;

[0038] Load pre-created texture templates;

[0039] Generate new textures based on user input and texture templates;

[0040] Apply the generated new texture to the target material;

[0041] When the application is running, the texture and shader parameters are updated in real time according to the logic and rendered to the scene.

[0042] Specifically, the following steps are included:

[0043] S1, specifically, the step of preparing the texture generation script and resources based on the 3D engine editor also includes the steps of setting up the rendering pipeline, loading the texture generation script and other related resources, including shaders, materials and texture templates.

[0044] S2, specifically, the user inputs the parameters for texture generation. After the editor is loaded, the step of displaying the relevant parameter setting interface for texture generation also includes the following steps: inputting the parameters for texture generation, inputting the grid size, scanning color, scanning speed, interval range, direction, texture fluctuation, selecting preset parameter values ​​or entering new values.

[0045] S3, specifically, loading the pre-created texture template, creates a texture template in the image editing software, sets the size to a multiple of two, defines the line style of the grid, the color of the grid, and the degree of transparency, saves the texture template in jpg format, and saves the texture template for loading.

[0046] S4, specifically, generates a new texture based on user input and texture templates, defines the grid layout, determines the number of grid rows and columns, ensures texture resolution, determines the grid line width and spacing, and the color and transparency of the lines, creates a new texture object using the Texture2D class in the engine, sets the texture width and height as well as the pixel format and compression method, draws grid lines, traverses each pixel of the texture, draws lines according to the grid layout, uses loops and arrays to store the starting and ending positions of the lines, as well as color and transparency information, and defines the starting position and movement path of the scan line, updates the position of the scan line, and applies color changes or transparency changes. Use the mathematical function sine wave to calculate the movement path and color changes of the scan line, and dynamically generate a grid texture.

[0047] S5, specifically, applies the generated texture to the target material. In the engine, a target material needs to be created, and the system binds the Texture2D object created during the texture generation process to the texture attribute of the target material. Usually, the reference of the texture object needs to be assigned to the _MainTex attribute of the material. The system sets other attributes of the target material, such as color and opacity, according to the parameters entered by the user, and updates the attributes of the target material to include the new texture information and setting parameters.

[0048] S6, specifically, updates the texture and shader parameters in real time according to the logic when the application is running, renders to the scene, sets the texture and shader parameters of the target material according to the parameters input by the user, and dynamically updates the texture pixel color value at runtime, including the movement of the scanning effect and the speed change color adjustment.

[0049] Example 2

[0050] This embodiment provides a visual texture mapping system based on a three-dimensional engine, such as Figure 2 As shown, including:

[0051] The system initialization module is configured to prepare the texture generation script and resource steps based on the 3D engine editor and further includes the steps of setting up the rendering pipeline, loading the texture generation script and other related resources, including shaders, materials and texture templates.

[0052] The user input module is configured for the user to input the parameters for texture generation. After the editor is loaded, the step of displaying the relevant parameter setting interface for texture generation also includes the following steps: inputting the parameters for texture generation, inputting the grid size, scanning color, scanning speed, interval range, direction, texture fluctuation, selecting preset parameter values ​​or entering new values.

[0053] The texture template loading module is configured to create a texture template in the image editing software, set the size to a multiple of two, define the line style of the grid, the color of the grid, and the transparency level of the transparency, save the texture template in jpg format, and save the texture template for loading.

[0054] The texture generation module is configured to generate new textures based on user input and texture templates, define the grid layout, determine the number of grid rows and columns, ensure texture resolution, determine the grid line width and spacing, and the color and transparency of the lines, create a new texture object using the Texture2D class in the engine, set the texture width and height as well as the pixel format and compression method, draw grid lines, traverse each pixel of the texture, draw lines according to the grid layout, use loops and arrays to store the starting and ending positions of the lines, as well as color and transparency information, and define the starting position and movement path of the scan line, update the position of the scan line, and apply color changes or transparency changes. Use the mathematical function sine wave to calculate the movement path and color changes of the scan line to dynamically generate a grid texture.

[0055] The texture application module is configured to apply the generated texture to the target material. In the engine, a target material needs to be created. The system binds the Texture2D object created during the texture generation process to the texture attribute of the target material. Usually, the reference of the texture object needs to be assigned to the _MainTex attribute of the material. The system sets other attributes of the target material, such as color and opacity, according to the parameters entered by the user, and updates the attributes of the target material to include the new texture information and setting parameters.

[0056] The real-time update and rendering module is configured to update the texture and shader parameters in real time according to the logic when the application is running, render to the scene, set the texture and shader parameters of the target material according to the parameters input by the user, and dynamically update the texture pixel color value at runtime, including the movement of the scanning effect and the speed change color adjustment.

[0057] A computer-readable storage medium stores a plurality of instructions, wherein the instructions are suitable for being loaded and executed by a processor of a terminal device for a visual texture mapping method based on a three-dimensional engine.

[0058] A terminal device includes a processor and a computer-readable storage medium, wherein the processor is used to implement various instructions; the computer-readable storage medium is used to store multiple instructions, wherein the instructions are suitable for being loaded by the processor and executing the visual texture mapping method based on a three-dimensional engine.

[0059] The above are all preferred embodiments of the present invention, and are not intended to limit the protection scope of the present invention. Therefore, any equivalent changes made based on the structure, shape, and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A visual texture mapping method based on a three-dimensional engine, characterized in that include: Based on the 3D engine editor, obtain texture generation scripts and resources; Obtaining parameters for texture generation input by a user based on a user interface; Load pre-created texture templates; Generate new textures based on user input and texture templates; Apply the generated new texture to the material surface of the target three-dimensional model; When the application is running, the texture and shader parameters are updated in real time according to the logic, and the results are rendered to the active scene; The method of generating a new texture based on user input and a texture template includes defining a grid layout, determining the number of grid rows and columns, ensuring texture resolution, determining the line width and spacing of the grid as well as the color and transparency of the lines, creating a new texture object using the Texture2D class in the engine, setting the width and height of the texture as well as the pixel format and compression method, drawing grid lines, traversing each pixel of the texture, drawing lines according to the grid layout, using loops and arrays to store the starting and ending positions of the lines, as well as color and transparency information, defining the starting position and moving path of the scan line, updating the position of the scan line, and applying color changes or transparency changes; using a mathematical function sine wave to calculate the moving path and color changes of the scan line, and dynamically generating a grid texture; The step of applying the generated new texture to the material surface of the target three-dimensional model includes creating a target material in the engine, binding the Texture2D object created in the texture generation process to the texture attribute of the target material, and assigning a reference to the texture object to the _MainTex attribute of the material; When the application is running, the texture and shader parameters are updated in real time according to the logic, and the results are rendered to the active scene, including setting the texture and shader parameters of the target material according to the parameters input by the user, and dynamically updating the texture pixel color value at runtime, including the movement of the scanning effect, speed change color adjustment.

2. A visual texture mapping method based on a three-dimensional engine according to claim 1, characterized in that: The three-dimensional engine editor is based on obtaining texture generation scripts and resources, including setting up a rendering pipeline, loading texture generation scripts and other related resources, including shaders, materials and texture templates.

3. A visual texture mapping method based on a three-dimensional engine according to claim 2, characterized in that: The obtaining of the parameters for generating textures input by the user based on the user interface includes obtaining the parameters for generating textures input, inputting a grid size, a scanning color, a scanning speed, an interval range, a direction and a texture fluctuation, and selecting a preset parameter value or inputting a new value.

4. A visual texture mapping method based on a three-dimensional engine according to claim 3, characterized in that: The loading of the pre-created texture template includes creating a texture template in the image editing software, wherein the size is set to a multiple of two, the line style, grid color, and transparency of the grid are defined, the texture template is saved in jpg format, and the texture template is saved for loading.

5. A visual texture mapping system based on a three-dimensional engine, executing the method according to any one of claims 1 to 4, characterized in that: include: The system initialization module is configured to obtain texture generation scripts and resources based on the 3D engine editor; A user input module is configured to obtain a parameter for generating a user input texture based on a user interface; The texture template loading module is configured to load a pre-created texture template; A texture generation module, configured to generate a new texture based on user input and a texture template; The texture application module is configured to apply the generated new texture to the material surface of the target three-dimensional model; The real-time update and rendering module is configured to update the texture and shader parameters in real time according to the logic when the application is running, and render the result to the active scene.

6. A computer-readable storage medium storing a plurality of instructions, characterized in that: The instructions are suitable for being loaded by a processor of a terminal device and executing the visual texture mapping method based on a three-dimensional engine as claimed in claim 1.

7. A terminal device, comprising a processor and a computer-readable storage medium, wherein the processor is used to implement each instruction; and the computer-readable storage medium is used to store multiple instructions, characterized in that: The instructions are suitable for being loaded by a processor and executing the visual texture mapping method based on a three-dimensional engine as claimed in claim 1.