Voxel model mapping method and voxel model mapping apparatus

By calculating the similarity between the world space coordinates and normal vectors of the voxel model pixel positions, UV coordinate values ​​are generated, solving the problems of material pattern stretching and repetition, and achieving high-quality voxel rendering effects and resource saving.

CN115841567BActive Publication Date: 2026-07-28WELLINK TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
WELLINK TECH CO LTD
Filing Date
2022-12-15
Publication Date
2026-07-28

AI Technical Summary

Technical Problem

The voxel model texture has problems with material pattern stretching and repetition, resulting in poor image quality. At the same time, the complex algorithm consumes too many rendering engine resources, limiting its application in real-time rendering scenarios.

Method used

By calculating the projected UV coordinates of the pixel's world space coordinates in the X, Y, and Z axes, and combining the similarity between the vertex normal vector and each axis, the UV coordinate values ​​are determined and generated, avoiding material pattern repetition and reducing computational load.

Benefits of technology

It improves the realism and texture of images, reduces the resource consumption of the rendering engine, is suitable for fast rendering of large scenes, and achieves high-quality image output.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115841567B_ABST
    Figure CN115841567B_ABST
Patent Text Reader

Abstract

A kind of voxel model mapping method and the voxel model mapping device based on the method, comprising: step S103: obtaining the projection UV coordinate value of the world space coordinate of pixel position on voxel model in X axis, Y axis, Z axis;Step S105: obtain the similarity of the vertex normal vector of pixel position in world space with X axis, Y axis, Z axis;Step S107: according to the projection UV coordinate value and the similarity, judge, obtain the output UV coordinate value;Step S109: repeat above-mentioned step S103-S107 to all pixel positions on voxel model.The voxel model mapping device includes: UV coordinate value acquisition module, similarity acquisition module, judging module, pixel position traversal module.The method and device of the present application, by introducing the similarity between the normal vector of pixel position and each projection axis, the actual coordinate of pixel position is considered, adjustable parameter is set simultaneously to facilitate adaptation different application scenarios, with smaller engine's computing amount, higher image output quality is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a voxel model mapping method and a voxel model mapping apparatus. Background Technology

[0002] With the development of hardware technology, 3D modeling and 3D rendering are widely used in industrial design, medical diagnosis, games, and other fields. The main techniques for 3D modeling include voxel modeling and polygon modeling. Polygon modeling divides the surface of an object into polygons for modeling. The disadvantage of this method is that it only produces an empty shape, which differs greatly from the real object. The advantage of voxel modeling is that voxels are composed of small three-dimensional volume units, possessing a certain thickness and volume, thus better reflecting realistic three-dimensional structures and properties. The disadvantage of voxel modeling is that it consumes more engine memory during rendering, especially as the particle size increases, resulting in higher memory usage and higher computational demands on the rendering engine.

[0003] In voxel modeling, after voxelizing an object, 3D object modeling data is obtained. Material data can then be used to map textures onto the surface of voxel units, resulting in 3D voxel unit texture data. Texture mapping is the process of mapping the coordinates of the pixels to be mapped onto the voxel unit to obtain UV coordinates. The rendering engine uses this information for voxel rendering.

[0004] In computer graphics, the above-mentioned texturing is a technique that uses images, functions, or other data sources to change the appearance of an object's surface. By applying a possible optical model as a projection function to points in space, a set of parametric space coordinates is obtained. Then, one or more mapping functions are used to transform these parametric space coordinates to UV space. The more complex the optical model, the better the effect, but the higher the resource consumption of the engine.

[0005] In related technologies, Unreal Engine's material system typically uses a separate rendering shader to project a texture image into 3D space along one direction, forming a decal material. The main principle is to transform the 3D position into a 2D UV space, and then extract the color of the corresponding point on the texture image based on the UV space position. However, it only has one projection axis; the material pattern will be stretched along other axes, easily leading to image distortion, such as... Figure 9 As shown.

[0006] In another related technique, in a voxel rendering scene, a voxel model is composed of multiple cubes of the same size and material. Because each cube uses the same material, the material of the entire large model is not tiled, but rather composed of multiple repeating patterns. This results in poor voxel model rendering, especially as the viewing distance increases, leading to image distortion and poor image quality.

[0007] In another related technology, voxel rendering uses complex models such as neural network models, which can achieve good results. However, this method has a complex calculation process, especially when the voxel particles are smaller and the rendering scene is more complex. It places too high demands on the computing power of the rendering engine, thus limiting its wider application. It is generally used in medicine and industrial design, but it is difficult to promote its use in scenarios such as live video streaming and online games that require real-time large-scale rendering.

[0008] For example, patent document CN103927395A discloses a method for converting game scenes, characterized by the following steps: deriving raw data of several different scene elements from the game scene; setting the desired side length of a unit voxel, and converting the raw data of the several scene elements into voxel data based on the side length of the unit voxel, wherein the voxel data is represented as voxel modules in the voxel scene; splicing all the voxel modules of the scene elements according to their relative positions in the game scene to obtain a voxel scene; cropping and obtaining a voxel region within the target space of the target object in the voxel scene, and using the voxel region as the input of a neural network in the form of a three-dimensional tensor to obtain the spatial features of the target object.

[0009] The methods used in the aforementioned technologies, due to the large amount of resources required by voxel modeling in the Unreal Engine and the use of complex algorithm models, can result in excessive computation and output stuttering. Summary of the Invention

[0010] The present invention aims to solve the problem of poor output image quality caused by material pattern stretching and repetition during voxel model mapping in related technologies. At the same time, it avoids excessive consumption of engine resources by overly complex algorithms and proposes a voxel model mapping method that can solve the above image quality problems and save rendering engine resources.

[0011] To address the aforementioned limitations, this invention proposes a voxel model mapping method, comprising the following steps:

[0012] Step S103: Obtain the projected UV coordinate values ​​of the world space coordinates of the pixel position on the voxel model in the X-axis, Y-axis, and Z-axis directions;

[0013] Step S105: Calculate the similarity between the vertex normal vector of the pixel position in world space and the X-axis, Y-axis, and Z-axis;

[0014] Step S107: Based on the projected UV coordinate values ​​and the similarity, a judgment is made to obtain the output UV coordinate values;

[0015] Step S109: Repeat steps S103-S107 above for all pixel positions on the voxel model.

[0016] Further: The method for obtaining the projected UV coordinate values ​​of the pixel position's world space coordinates in the X, Y, and Z axes is as follows:

[0017] Step S200: Create parameters: XDistance, YDistance, ZDistance, and set initial values ​​for XDistance, YDistance, and ZDistance;

[0018] Step S201: Calculate the X-axis projection UV coordinate values:

[0019] Multiply the world space coordinates of the pixel position by the XDistance, and take the G channel value as the U coordinate value and the B channel value as the V coordinate value.

[0020] Step S203: Calculate the Y-axis projection UV coordinate values:

[0021] Multiply the world space coordinates of the pixel position by the YDistance, and take the R channel value as the U coordinate value and the B channel value as the V coordinate value;

[0022] Step S205: Calculate the Z-axis projected UV coordinate values:

[0023] Multiply the world space coordinates of the pixel position by the ZDistance, and take the R channel value as the U coordinate value and the G channel value as the V coordinate value.

[0024] Furthermore: The method for obtaining the similarity between the vertex normal vector of a pixel position in world space and the X-axis, Y-axis, and Z-axis is as follows:

[0025] Step S301: Obtain the coordinates of the vertex normal vector of the pixel position in world space, and normalize them to obtain the unit normal vector;

[0026] Step S303: Calculate the dot product between the unit normal vector and the X-axis vector (1, 0, 0), take its absolute value, and obtain the similarity between the vertex normal vector and the X-axis.

[0027] Step S305: Calculate the dot product between the unit normal vector and the Y-axis vector (0, 1, 0), take its absolute value, and obtain the similarity between the vertex normal vector and the Y-axis.

[0028] Step S307: Calculate the dot product between the unit normal vector and the Z-axis vector (0, 0, 1), take its absolute value, and obtain the similarity between the vertex normal vector and the Z-axis.

[0029] Further: The method for obtaining the output UV coordinate values ​​based on the projected UV coordinate values ​​and the similarity is as follows:

[0030] Step S400: Create parameter: similarity threshold, and set an initial value for the similarity threshold;

[0031] Step S401: If the similarity between the vertex normal vector and the Z-axis is greater than or equal to the similarity threshold, take the Z-axis projection UV coordinate value as result one; otherwise, take the default value of the UV coordinate as result one.

[0032] Step S403: If the similarity between the vertex normal vector and the Y-axis is greater than or equal to the similarity threshold, take the Y-axis projection UV coordinate value as result two; otherwise, take result one as result two.

[0033] Step S405: If the similarity between the vertex normal vector and the X-axis is greater than or equal to the similarity threshold, take the X-axis projection UV coordinate value as result three; otherwise, take result two as result three.

[0034] Step S407: Output result three.

[0035] Further: The method for obtaining the output UV coordinate values ​​based on the projected UV coordinate values ​​and the similarity is as follows:

[0036] Step S500: Create parameters: X-axis similarity threshold, Y-axis similarity threshold, Z-axis similarity threshold, and set initial values ​​for the X-axis similarity threshold, the Y-axis similarity threshold, and the Z-axis similarity threshold;

[0037] Step S501: If the similarity between the vertex normal vector and the Z-axis is ≥ the Z-axis similarity threshold, take the Z-axis projection UV coordinate value as result one; otherwise, take the default value of the UV coordinate as result one.

[0038] Step S503: If the similarity between the vertex normal vector and the Y-axis is ≥ the Y-axis similarity threshold, take the Y-axis projection UV coordinate value as result two; otherwise, take result one as result two.

[0039] Step S505: If the similarity between the vertex normal vector and the X-axis is ≥ the X-axis similarity threshold, take the X-axis projected UV coordinate value as result three; otherwise, take result two as result three.

[0040] Step S507: Output result three.

[0041] A voxel model mapping device, comprising:

[0042] UV coordinate value acquisition module 601: Obtains the projected UV coordinate values ​​of the world space coordinates of the pixel position on the voxel model in the X-axis, Y-axis and Z-axis directions;

[0043] Similarity acquisition module 602: obtains the similarity between the normal vector of the pixel position vertex in the world space and the X-axis, Y-axis, and Z-axis;

[0044] Judgment module 603: Based on the projected UV coordinate values ​​and the similarity, a judgment is made to obtain the output UV coordinate values;

[0045] Pixel position traversal module 604: Traverses all pixel positions on the voxel model to obtain the UV coordinate values ​​corresponding to all pixel positions.

[0046] Furthermore: the method for obtaining the projected UV coordinate values ​​of the world space coordinates of the pixel position on the voxel model in the X-axis, Y-axis, and Z-axis directions is based on steps S200-S205.

[0047] Furthermore, the method for obtaining the similarity between the vertex normal vector of the pixel position in world space and the X-axis, Y-axis, and Z-axis is based on steps S301-S307.

[0048] Further: The method for obtaining the output UV coordinate value based on the projection UV coordinate value and the similarity is based on steps S400-S407.

[0049] Further: The method for obtaining the output UV coordinate value based on the projection UV coordinate value and the similarity is based on steps S500-S507.

[0050] Compared with related technologies, the present invention has the following advantages:

[0051] By introducing the similarity between the vertex normal vectors of pixel locations and each projection axis, the influence of the actual orientation of the surface where each pixel is located on the texture is considered. Furthermore, the distribution of pixel locations in world space is taken into account when generating UV coordinates. This avoids the problem of poor image quality caused by repetitive material patterns in each voxel unit during voxel rendering, which exists in related technologies. Therefore, this method achieves more realistic images with finer textures and higher image output quality during voxel rendering. The method of this invention has low computational cost and low engine resource consumption, can be quickly applied to the rendering of large scenes, and produces good rendering results. Attached Figure Description

[0052] Figure 1 This is a schematic diagram of world space coordinates according to an embodiment of the present invention.

[0053] Figure 2 A flowchart of a voxel model mapping method according to an embodiment of the present invention.

[0054] Figure 3This is a flowchart illustrating the calculation of UV coordinate values ​​for each projection axis according to an embodiment of the present invention.

[0055] Figure 4 This is a flowchart illustrating the process of obtaining the similarity between the normal vector and the projection axis according to an embodiment of the present invention.

[0056] Figure 5 This is a flowchart illustrating how similarity is used to obtain UV coordinate values ​​according to an embodiment of the present invention.

[0057] Figure 6 This is a flowchart illustrating how similarity is used to obtain UV coordinate values ​​according to an embodiment of the present invention.

[0058] Figure 7 This is a schematic diagram of a voxel unit being a cube during texturing according to an embodiment of the present invention.

[0059] Figure 8 This is a schematic diagram illustrating the repeated tiling of voxel unit textures during texturing in related technologies.

[0060] Figure 9 This is a schematic diagram illustrating the stretching distortion of voxel unit textures during texture mapping in related technologies.

[0061] Figure 10 A structural diagram of a voxel model mapping device according to an embodiment of the present invention. Detailed Implementation

[0062] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below. However, it should be understood that the description herein is merely illustrative and not intended to limit the scope of the invention.

[0063] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used herein in the specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. All characterization techniques mentioned herein can be found in relevant descriptions in the prior art, and will not be repeated here.

[0064] To further understand the present invention, the present invention will be described in detail below with reference to the preferred embodiments.

[0065] Example 1

[0066] Figure 1 This is a schematic diagram of world space coordinates according to an embodiment of the present invention. Figure 2 This is a flowchart of a voxel model mapping method according to an embodiment of the present invention. Figure 1 , Figure 2 As shown, a voxel model mapping method includes the following steps:

[0067] Step S103: Obtain the projected UV coordinate values ​​of the world space coordinates of the pixel position on the voxel unit in the X-axis, Y-axis, and Z-axis directions;

[0068] Step S105: Calculate the similarity between the vertex normal vector of the pixel position in world space and the X-axis, Y-axis, and Z-axis;

[0069] Step S107: Based on the projected UV coordinate values ​​and the similarity, a judgment is made to obtain the output UV coordinate values;

[0070] Step S109: Repeat steps S103-S107 above for all pixel positions on the voxel model.

[0071] World space coordinates are the coordinates of the image model in the global space. For example... Figure 1 As shown, a pixel position in world space coordinates can be represented as (a, b, c). a is the x-axis coordinate, b is the y-axis coordinate, and c is the z-axis coordinate. The material system is a system for modeling material information during modeling. In the material system, world space position information is represented by the values ​​of the R, G, and B channels. Therefore, the pixel position's RGB coordinates in the material system are also equal to (a, b, c). During the texturing process, the material is applied to the object's surface, and each point on the surface corresponds to a pixel position. The pixel position coordinates are the coordinates of the point on the surface in world space. The process of applying material to points on the object's surface is equivalent to mapping the pixel position's world space coordinates to the UV coordinates in the material system. The normal direction of the point represented by the pixel position indicates the orientation of the surface at that point.

[0072] Projected UV coordinate values:

[0073] In a material system, the projection of UV values ​​onto a given coordinate is defined as follows: Since XYZ values ​​are used as the RGB channel values ​​in the material system, therefore,

[0074] Find the UV coordinate values ​​projected along the X-axis, i.e., take the G channel value as the U coordinate value and the B channel value as the V coordinate value.

[0075] Find the UV coordinate values ​​projected along the Y-axis, i.e., take the R channel value as the U coordinate value and the B channel value as the V coordinate value.

[0076] Find the UV coordinate values ​​projected along the Z-axis, i.e., take the R channel value as the U coordinate value and the G channel value as the V coordinate value.

[0077] The similarity definition is as follows:

[0078] (1) Normalize the vector;

[0079] (2) Find the dot product of the coordinates of the two vectors;

[0080] (3) Find the absolute value of the dot product in step (2) above.

[0081] For example, after normalizing two vectors T1(0) and T2(0), they are T1 = (x1, y1, z1) and T2 = (x2, y2, z2), respectively. The dot product is:

[0082] Dot(T1,T2)=T1·T2=(x1,y1,z1)·(x2,y2,z2)=x1*x2+y1*y2+z1*z2

[0083] The absolute value of Dot(T1, T2) is the similarity between the two vectors, and its value is [0, 1].

[0084] Where x1 and x2 are the X-axis coordinates, y1 and y2 are the Y-axis coordinates, and z1 and z2 are the Z-axis coordinates.

[0085] The purpose of vector normalization in step (1) is to transform the number into a decimal between (-1, 1) and map the vector length to the range of -1 to 1. The purpose of taking the absolute value is to ensure that the above similarity value is between 0 and 1 (including the endpoints 0 and 1), so that it can be easily compared with the threshold.

[0086] The similarity calculation reflects the relationship between the normal direction of the pixel position and each coordinate axis X, Y, Z, and is used for further calculation and output of UV coordinate values.

[0087] The normalization formula for a vector is:

[0088] The normalized vector T1' = (x1', y1', z1') of T1 = (x1, y1, z1) is given by:

[0089]

[0090] In world space, the vertex normal vector of a pixel location is the vector perpendicular to the surface at that pixel's location. When the voxel unit is a cube or cuboid, this normal direction can be easily calculated in the modeled world space using the position of the voxel unit's own object space coordinate axes relative to the world space coordinate axes. For example... Figure 1As shown. Since the relationship between the object space coordinates and world space coordinates of the voxel elements is established during modeling, even if rotation or other operations occur (i.e., a spatial mapping), the coordinate relationship before and after the rotation is known. Therefore, the position of the object space coordinate axes relative to the world space coordinate axes is always known, and the normal vector can also be obtained. For example, in some modeling software, the VertexNormalWS method can be used to obtain this vector, but it is not limited to the above method. Other modeling tools have different functions to obtain this vector, but any method that obtains the coordinates of the normal vector based on the above principle is acceptable.

[0091] Therefore, the method described above for obtaining normal vectors and calculating similarity consumes less computational power in the modeling engine.

[0092] In the above embodiments, the voxel unit is a cube. When the voxel unit is of other shapes, its normal distribution function can also be solved according to its surface differential equation. Thus, the method of the present invention can be used to realize the realistic simulation of different materials, such as surface microstructures that are spherical, cylindrical, conical, etc., but not limited to the above shapes.

[0093] Step 109 involves traversing and calculating the pixels of all surfaces of all voxel units constituting the voxel model. Depending on the needs, only the square pixels exposed on the outer surface can be calculated, for example, when the object is opaque; alternatively, the square pixels of all surfaces of all voxel units can be calculated, for example, when the object is semi-transparent. Calculations can also be performed based on the light source direction for certain orientations. These settings can be arbitrarily configured as needed and are not limited to the above forms. To save computational resources, overlapping faces between multiple cubes can be removed to obtain the target faces that make up the outer surface of the voxel model, thereby optimizing the computational load during rendering, but this optimization is not limited to the forms described above.

[0094] By introducing the similarity between the vertex normal vectors of pixel locations and each projection axis, the influence of the actual orientation of the surface where each pixel is located on the texture is considered. Furthermore, the distribution of pixel locations in world space is taken into account when generating UV coordinates. This avoids the problem of poor image quality caused by repetitive material patterns in each voxel unit during voxel rendering, which exists in related technologies. Therefore, this method achieves more realistic images with finer textures and higher image output quality during voxel rendering. The method of this invention has low computational cost and low engine resource consumption, can be quickly applied to the rendering of large scenes, and produces good rendering results.

[0095] Example 2

[0096] Based on the method of Example 1, the method for obtaining the projected UV coordinate values ​​of the world space coordinates of the pixel position in the X, Y, and Z axis directions is further as follows:

[0097] Step S200: Create parameters: XDistance, YDistance, ZDistance, and set initial values ​​for XDistance, YDistance, and ZDistance;

[0098] Step S201: Calculate the X-axis projection UV coordinate values:

[0099] Multiply the world space coordinates of the pixel position by the XDistance, and take the G channel value as the U coordinate value and the B channel value as the V coordinate value.

[0100] Step S203: Calculate the Y-axis projection UV coordinate values:

[0101] Multiply the world space coordinates of the pixel position by the YDistance, and take the R channel value as the U coordinate value and the B channel value as the V coordinate value;

[0102] Step S205: Calculate the Z-axis projected UV coordinate values:

[0103] Multiply the world space coordinates of the pixel position by the ZDistance, and take the R channel value as the U coordinate value and the G channel value as the V coordinate value.

[0104] Projecting onto a coordinate axis ignores the corresponding coordinate value of that axis and only considers the coordinate values ​​of the other two axes. In the material system described above, XYZ coordinate values ​​are represented as RGB channel values. Taking projection onto the X-axis as an example, according to the above principle, the Y and Z coordinate values ​​should be used. Since in the material system, the Y coordinate value equals the G channel value, and the Z coordinate value equals the B channel value, the G channel value is used as the U coordinate value, and the B channel value as the V coordinate value; other coordinate values ​​are treated similarly and will not be elaborated further.

[0105] The parameters XDistance, YDistance, and ZDistance are set to floating-point numbers.

[0106] The main function of the above parameters is to address the issue that the coordinate values ​​of pixels in the sky are often very large. If these coordinate values ​​are not properly transformed, only the fractional part of the value will be truncated in UV space, ignoring the integer part. This can lead to pattern repetition and poor texture mapping. Therefore, by setting appropriate XDistance, YDistance, and ZDistance values, the pixel coordinate values ​​are mapped to a reasonable range, thus avoiding the above problems and improving the quality of the output image. Furthermore, these parameters can be adjusted according to specific application scenarios, such as the actual size of the scene, allowing for easy adaptation to various application scenarios.

[0107] For example, when projecting onto the z-axis, assuming the pixel position x-coordinate is 500, setting XDistance=0.001 will yield a U value of 0.5; otherwise, the U value will be 0.

[0108] The above are merely illustrative examples; in practical applications, this invention is not limited to the applications described above. The values ​​of XDistance, YDistance, and ZDistance can be set according to actual modeling needs, material quality, etc., as long as the world space coordinates can be reasonably mapped to the UV coordinates. The values ​​of the parameters XDistance, YDistance, and ZDistance can be adjusted to prevent the pattern from repeating, or these values ​​can be adjusted to make the pattern repeat within an allowed number of times, thereby saving computational power.

[0109] Furthermore: The method for obtaining the similarity between the vertex normal vector of a pixel position in world space and the X-axis, Y-axis, and Z-axis is as follows:

[0110] Step S301: Obtain the coordinates of the vertex normal vector of the pixel position in world space, and normalize them to obtain the unit normal vector;

[0111] Step S303: Calculate the dot product between the unit normal vector and the X-axis vector (1, 0, 0), take its absolute value, and obtain the similarity between the vertex normal vector and the X-axis.

[0112] Step S305: Calculate the dot product between the unit normal vector and the Y-axis vector (0, 1, 0), take its absolute value, and obtain the similarity between the vertex normal vector and the Y-axis.

[0113] Step S307: Calculate the dot product between the unit normal vector and the Z-axis vector (0, 0, 1), take its absolute value, and obtain the similarity between the vertex normal vector and the Z-axis.

[0114] Further: The method for obtaining the output UV coordinate values ​​based on the projected UV coordinate values ​​and the similarity is as follows:

[0115] Step S400: Create parameter: similarity threshold, and set an initial value for the similarity threshold;

[0116] Step S401: If the similarity between the vertex normal vector and the Z-axis is greater than or equal to the similarity threshold, take the Z-axis projection UV coordinate value as result one; otherwise, take the default value of the UV coordinate as result one.

[0117] Step S403: If the similarity between the vertex normal vector and the Y-axis is greater than or equal to the similarity threshold, take the Y-axis projection UV coordinate value as result two; otherwise, take result one as result two.

[0118] Step S405: If the similarity between the vertex normal vector and the X-axis is greater than or equal to the similarity threshold, take the X-axis projection UV coordinate value as result three; otherwise, take result two as result three.

[0119] Step S407: Output result three.

[0120] The default value for the UV coordinates is a preset value.

[0121] By setting appropriate similarity thresholds, the similarity requirements for projection onto each coordinate axis can be quickly and easily adjusted. Furthermore, the above method can also establish independent similarity thresholds for different coordinate axes: X-axis similarity threshold, Y-axis similarity threshold, and Z-axis similarity threshold. Substituting these thresholds into the above steps allows adjustment of the UV coordinate values ​​based on the projection weights of different coordinate axes, thereby adapting to more application scenarios.

[0122] Further: The method for obtaining the output UV coordinate values ​​based on the projected UV coordinate values ​​and the similarity is as follows:

[0123] Step S500: Create parameters: X-axis similarity threshold, Y-axis similarity threshold, Z-axis similarity threshold, and set initial values ​​for the X-axis similarity threshold, the Y-axis similarity threshold, and the Z-axis similarity threshold;

[0124] Step S501: If the similarity between the vertex normal vector and the Z-axis is ≥ the Z-axis similarity threshold, take the Z-axis projection UV coordinate value as result one; otherwise, take the default value of the UV coordinate as result one.

[0125] Step S503: If the similarity between the vertex normal vector and the Y-axis is ≥ the Y-axis similarity threshold, take the Y-axis projection UV coordinate value as result two; otherwise, take result one as result two.

[0126] Step S505: If the similarity between the vertex normal vector and the X-axis is ≥ the X-axis similarity threshold, take the X-axis projected UV coordinate value as result three; otherwise, take result two as result three.

[0127] Step S507: Output result three.

[0128] In addition, the order of the coordinate axes polled in steps S400-S407 or S500-S507 can be adjusted according to the actual application scenario, such as the direction of the light source. For example, the order can be X, Z, Y, Y, X, Z, etc. It is not limited to the above order. Any arrangement or combination of the three coordinate axes is acceptable.

[0129] Compared with related technologies, the present invention has the following advantages:

[0130] By introducing the similarity between the vertex normal vectors of pixel locations and each projection axis, the influence of the actual orientation of the surface where each pixel is located on the texture is considered. Furthermore, the distribution of pixel locations in world space is taken into account when generating UV coordinates. This avoids the problem of poor image quality caused by repetitive material patterns in each voxel unit during voxel rendering, which exists in related technologies. Therefore, this method achieves more realistic images with finer textures and higher image output quality during voxel rendering. The method of this invention has low computational cost and low engine resource consumption, can be quickly applied to the rendering of large scenes, and produces good rendering results.

[0131] The parameter settings can map the pixel coordinates to a reasonable range, thus avoiding the problem of material pattern repetition during the texturing process and further improving the quality of the output image. Moreover, this parameter can be quickly adjusted according to specific application scenarios, allowing for easy adaptation to various applications.

[0132] In different application scenarios, the similarity threshold can be changed to set the similarity requirement for projection onto that coordinate axis, thus adapting to different application scenarios and different effect requirements. When setting the similarity threshold for each coordinate axis, the weight of projection onto each coordinate axis during the texturing process can also be adjusted by simply adjusting the above parameters, thereby achieving a more accurate texturing effect.

[0133] Example 3

[0134] Figure 10 This is a structural diagram of a voxel model mapping device according to an embodiment of the present invention. A voxel model mapping device includes:

[0135] UV coordinate value acquisition module 601: Obtains the projected UV coordinate values ​​of the world space coordinates of the pixel position on the voxel model in the X-axis, Y-axis and Z-axis directions;

[0136] Similarity acquisition module 602: obtains the similarity between the normal vector of the pixel position vertex in the world space and the X-axis, Y-axis, and Z-axis;

[0137] Judgment module 603: Based on the projected UV coordinate values ​​and the similarity, a judgment is made to obtain the output UV coordinate values;

[0138] Pixel position traversal module 604: Traverses all pixel positions on the voxel model to obtain the UV coordinate values ​​corresponding to all pixel positions.

[0139] Furthermore: other specific methods are based on Example 1 or 2.

[0140] The voxel model mapping device of this invention considers the influence of the actual orientation of the surface where each pixel is located on the texture by introducing the similarity between the vertex normal vector of the pixel position and each projection axis. Furthermore, it considers the distribution of pixel positions in world space when generating UV coordinates, thus avoiding the problem of poor image quality caused by the repetition of material patterns in each voxel unit during voxel rendering, which exists in related technologies. This results in more realistic images with finer textures during voxel rendering, achieving higher image output quality. The device requires less computation and consumes fewer engine resources, allowing for rapid application to the rendering of large scenes with excellent rendering results.

[0141] Example 4

[0142] Based on the apparatus of Embodiment 3, the method for obtaining the projected UV coordinate values ​​of the world space coordinates of the pixel position on the voxel model in the X-axis, Y-axis, and Z-axis directions is based on steps S200-S205.

[0143] Furthermore, the method for obtaining the similarity between the vertex normal vector of the pixel position in world space and the X-axis, Y-axis, and Z-axis is based on steps S301-S307.

[0144] Further: The method for obtaining the output UV coordinate value based on the projection UV coordinate value and the similarity is based on steps S400-S407.

[0145] Further: The method for obtaining the output UV coordinate value based on the projection UV coordinate value and the similarity is based on steps S500-S507.

[0146] Furthermore: other specific methods are based on Example 1 or 2.

[0147] Compared with related technologies, the device of the present invention has the following advantages:

[0148] By introducing the similarity between the vertex normal vectors of pixel locations and each projection axis, the influence of the actual orientation of the surface where each pixel is located on the texture is considered. Furthermore, the distribution of pixel locations in world space is taken into account when generating UV coordinates. This avoids the problem of poor image quality caused by repetitive material patterns in each voxel unit during voxel rendering, which exists in related technologies. Therefore, this method achieves more realistic images with finer textures and higher image output quality during voxel rendering. The method of this invention has low computational cost and low engine resource consumption, can be quickly applied to the rendering of large scenes, and produces good rendering results.

[0149] The parameter settings can map the pixel coordinates to a reasonable range, thus avoiding the problem of material pattern repetition during the texturing process and further improving the quality of the output image. Moreover, this parameter can be quickly adjusted according to specific application scenarios, allowing for easy adaptation to various applications.

[0150] In different application scenarios, the similarity threshold can be changed to set the similarity requirement for projection onto that coordinate axis, thus adapting to different application scenarios and different effect requirements. When setting the similarity threshold for each coordinate axis, the weight of projection onto each coordinate axis during the texturing process can also be adjusted by simply adjusting the above parameters, thereby achieving a more accurate texturing effect.

[0151] In the embodiments of the present invention, the voxel model mapping method of the present invention can be used in voxel rendering scenes. It is understood that the voxel mapping method is not limited to the above applications, and can be used in any modeling and rendering scene that can use the inventive concept of the present invention.

[0152] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions or improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A voxel model mapping method, characterized in that: Includes the following steps: Step S103: Obtain the projected UV coordinate values ​​of the world space coordinates of the pixel position on the voxel model in the X-axis, Y-axis, and Z-axis directions; Step S105: Obtain the similarity between the vertex normal vector of the pixel position in world space and the X-axis, Y-axis, and Z-axis; Step S107: Based on the projected UV coordinate values ​​and the similarity, a judgment is made to obtain the output UV coordinate values; Step S109: Repeat steps S103-S107 above for all pixel positions on the voxel model; The method for obtaining the output UV coordinate values ​​based on the projected UV coordinate values ​​and the similarity is as follows: Step S500: Create parameters: X-axis similarity threshold, Y-axis similarity threshold, Z-axis similarity threshold, and set initial values ​​for the X-axis similarity threshold, the Y-axis similarity threshold, and the Z-axis similarity threshold; Step S501: If the similarity between the vertex normal vector and the Z-axis is ≥ the Z-axis similarity threshold, take the Z-axis projection UV coordinate value as result one; otherwise, take the default value of the UV coordinate as result one. Step S503: If the similarity between the vertex normal vector and the Y-axis is ≥ the Y-axis similarity threshold, take the Y-axis projection UV coordinate value as result two; otherwise, take result one as result two. Step S505: If the similarity between the vertex normal vector and the X-axis is ≥ the X-axis similarity threshold, take the X-axis projected UV coordinate value as result three; otherwise, take result two as result three. Step S507: Output result three.

2. The method as described in claim 1, characterized in that: The method for obtaining the projected UV coordinates of a pixel's world space location in the X, Y, and Z axes is as follows: Step S200: Create parameters: XDistance, YDistance, ZDistance, and set initial values ​​for XDistance, YDistance, and ZDistance; Among them, XDistance, YDistance, and ZDistance are floating-point numbers used to map world space coordinates to UV coordinate values; Step S201: Calculate the X-axis projection UV coordinate values: Multiply the Y-axis world space coordinate of the pixel position by the XDistance to obtain the U coordinate value, and multiply the Z-axis world space coordinate of the pixel position by the XDistance to obtain the V coordinate value. Step S203: Calculate the Y-axis projection UV coordinate values: Multiply the X-axis world space coordinate of the pixel position by YDistance to obtain the U coordinate value, and multiply the Z-axis world space coordinate of the pixel position by YDistance to obtain the V coordinate value. Step S205: Calculate the Z-axis projected UV coordinate values: Multiply the X-axis world space coordinates of the pixel position by the ZDistance to obtain the U coordinate value, and multiply the Y-axis world space coordinates of the pixel position by the ZDistance to obtain the V coordinate value.

3. The method as described in claim 1, characterized in that: The method for obtaining the similarity between the vertex normal vector of a pixel location in world space and the X-axis, Y-axis, and Z-axis is as follows: Step S301: Obtain the coordinates of the vertex normal vector of the pixel position in world space, and normalize them to obtain the unit normal vector; Step S303: Calculate the dot product between the unit normal vector and the X-axis vector (1, 0, 0), take its absolute value, and obtain the similarity between the vertex normal vector and the X-axis. Step S305: Calculate the dot product between the unit normal vector and the Y-axis vector (0, 1, 0), take its absolute value, and obtain the similarity between the vertex normal vector and the Y-axis. Step S307: Calculate the dot product between the unit normal vector and the Z-axis vector (0, 0, 1), take its absolute value, and obtain the similarity between the vertex normal vector and the Z-axis.

4. A voxel model mapping device, characterized in that, include: UV coordinate value acquisition module (601): Obtains the projected UV coordinate values ​​of the world space coordinates of the pixel position on the voxel model in the X-axis, Y-axis and Z-axis directions; Similarity acquisition module (602): obtains the similarity between the vertex normal vector of the pixel position in the world space and the X-axis, Y-axis, and Z-axis; Judgment module (603): makes a judgment based on the projected UV coordinate values ​​and the similarity, and obtains the output UV coordinate values; the judgment module (603) is configured to receive X-axis similarity threshold, Y-axis similarity threshold and Z-axis similarity threshold respectively; If the similarity between the vertex normal vector and the Z-axis is greater than or equal to the Z-axis similarity threshold, the Z-axis projection UV coordinate value is taken as result one; Otherwise, the default UV coordinates will be used as result one; If the similarity between the vertex normal vector and the Y-axis is greater than or equal to the Y-axis similarity threshold, the Y-axis projection UV coordinate value is taken as result two; otherwise, result one is taken as result two. If the similarity between the vertex normal vector and the X-axis is greater than or equal to the X-axis similarity threshold, the X-axis projected UV coordinate value is taken as result three; otherwise, result two is taken as result three. Pixel position traversal module (604): Traverses all pixel positions on the voxel model to obtain the UV coordinate values ​​corresponding to all pixel positions.

5. The apparatus as described in claim 4, characterized in that: The UV coordinate value acquisition module (601) is configured as follows: Create parameters: XDistance, YDistance, ZDistance, and set initial values ​​for XDistance, YDistance, and ZDistance; where XDistance, YDistance, and ZDistance are floating-point numbers used to map world space coordinates to UV coordinate values; Calculate the X-axis projection UV coordinate values: Multiply the Y-axis world space coordinate of the pixel position by the XDistance to obtain the U coordinate value, and multiply the Z-axis world space coordinate of the pixel position by the XDistance to obtain the V coordinate value; Calculate the Y-axis projection UV coordinate values: Multiply the X-axis world space coordinates of the pixel position by YDistance to obtain the U coordinate value, and multiply the Z-axis world space coordinates of the pixel position by YDistance to obtain the V coordinate value; Calculate the Z-axis projection UV coordinate values: Multiply the X-axis world space coordinates of the pixel position by the ZDistance to obtain the U coordinate value, and multiply the Y-axis world space coordinates of the pixel position by the ZDistance to obtain the V coordinate value.

6. The apparatus as claimed in claim 4, characterized in that: The similarity acquisition module (602) is specifically configured to: acquire the coordinates of the vertex normal vector of the pixel position in world space, normalize it to obtain the unit normal vector, calculate the dot product of the unit normal vector and the X-axis vector (1, 0, 0), and take its absolute value to obtain the similarity between the vertex normal vector and the X-axis; calculate the dot product of the unit normal vector and the Y-axis vector (0, 1, 0), and take its absolute value to obtain the similarity between the vertex normal vector and the Y-axis; calculate the dot product of the unit normal vector and the Z-axis vector (0, 0, 1), and take its absolute value to obtain the similarity between the vertex normal vector and the Z-axis.