Search

CN-122006231-A - Three-dimensional effect generation method, device, storage medium, equipment and program product

CN122006231ACN 122006231 ACN122006231 ACN 122006231ACN-122006231-A

Abstract

The application discloses a method, a device, a storage medium, equipment and a program product for generating a three-dimensional effect, wherein the method comprises the steps of constructing a three-dimensional coordinate system based on screen texture coordinates, constructing a first sphere model and each second sphere model in the three-dimensional coordinate system, and at least partially overlapping the first sphere model and the second sphere model; and setting the surface material properties of the initial three-dimensional model to obtain a target three-dimensional model simulating the three-dimensional visual effect. The multi-dimensional setting of the surface material properties reduces the labor cost and the time cost without manual adjustment, so that the target three-dimensional model has the visual characteristics of real materials, and the limitation that the traditional 2D dough sheet can only present a fixed visual angle and has no stereoscopic impression is thoroughly eliminated.

Inventors

  • XIAO WEIWEI

Assignees

  • 广州博冠信息科技有限公司

Dates

Publication Date
20260512
Application Date
20251211

Claims (15)

  1. 1. A method of generating a three-dimensional effect, comprising: constructing a three-dimensional coordinate system based on screen texture coordinates, and constructing a first sphere model and each second sphere model in the three-dimensional coordinate system, wherein the first sphere model and the second sphere model are at least partially overlapped; Performing engraving processing operation on the first sphere model through each second sphere model to obtain an initial three-dimensional model with irregular geometric shapes; And setting the surface material property of the initial three-dimensional model to obtain a target three-dimensional model simulating the three-dimensional visual effect.
  2. 2. The method for generating a three-dimensional effect according to claim 1, wherein the constructing a three-dimensional coordinate system based on screen texture coordinates, and constructing a first sphere model and each second sphere model in the three-dimensional coordinate system, the first sphere model and the second sphere model being at least partially overlapped, includes: constructing the three-dimensional coordinate system based on a screen texture coordinate system in which the screen texture coordinate is positioned and a virtual coordinate axis, wherein the virtual coordinate axis is perpendicular to the screen texture coordinate system; And constructing a first sphere distance field function according to the first sphere center position and the first sphere radius by taking the origin of the three-dimensional coordinate system as the first sphere center position of the first sphere model so as to construct the first sphere model in the three-dimensional coordinate system.
  3. 3. The method of generating a three-dimensional effect according to claim 2, further comprising: Acquiring a first random vector under the three-dimensional coordinate system, and carrying out normalization processing on the first random vector to obtain a first random direction, wherein the first random vector is determined according to a first random function and a preset seed parameter; determining a second sphere center position of the second sphere model according to the first random direction and the first sphere radius; and constructing a second sphere distance field function according to the second sphere center position and a second sphere radius to construct a second sphere model in the three-dimensional coordinate system, wherein the second sphere radius is determined based on a second random function, and the second random function is used for outputting random data according to floating point numbers.
  4. 4. A method of generating a three-dimensional effect according to claim 1 or 3, wherein said performing an engraving process operation on said first sphere model by each of said second sphere models to obtain an initial three-dimensional model having an irregular geometry, respectively, comprises: Acquiring a preset number of second sphere models; And subtracting the first sphere distance field function corresponding to the first sphere model for a first preset number of times according to the second sphere distance field function corresponding to each second sphere model and a preset smoothing coefficient to obtain a third sphere distance field function, wherein the third sphere distance field function corresponds to the initial three-dimensional model with the irregular geometric shape, and the preset number is matched with the first preset number of times.
  5. 5. The method according to claim 4, wherein the surface texture property at least includes roughness information, and the setting the surface texture property of the initial three-dimensional model to obtain the target three-dimensional model simulating the three-dimensional effect includes: Performing interpolation processing on a third sphere distance field function corresponding to the initial three-dimensional model through a preset noise function to obtain height offset data, wherein the preset noise function is used for generating random height offset data for any space point in a three-dimensional coordinate system; and superposing the height offset data and the third sphere distance field function to set roughness information of the initial three-dimensional model.
  6. 6. The method according to claim 5, wherein the surface texture property at least includes surface shape information, and the setting the surface texture property of the initial three-dimensional model to obtain the target three-dimensional model simulating the three-dimensional effect includes: Multiplying the current frequency with the position coordinates of the target point on the initial three-dimensional model, and calculating the current noise value of the target point according to the multiplication result, wherein the current frequency corresponds to the position coordinates of the target point; Acquiring a current amplitude, and multiplying the current amplitude by the current noise value to determine the shape noise value of the target point according to the multiplication result of the current amplitude and the current noise value; And carrying out iterative superposition on the shape noise wave value for a second preset time according to a preset amplitude attenuation coefficient and a preset frequency multiplication coefficient to obtain an accumulated shape noise wave value, and superposing the accumulated shape noise wave value and the third sphere distance field function to set the surface shape information of the initial three-dimensional model, wherein the preset amplitude attenuation coefficient is used for controlling the attenuation speed of each layer of amplitude during iterative superposition each time, the amplitude is used for representing the concave-convex intensity of noise waves, the frequency multiplication coefficient is used for controlling the increment amplitude of each layer of frequency during iterative superposition each time, and the frequency is used for representing the quantity of noise waves.
  7. 7. The method according to claim 1, 5 or 6, wherein the surface texture property at least includes diffuse reflection information, the diffuse reflection information includes a diffuse reflection parameter and a reflection parameter, and setting the surface texture property of the initial three-dimensional model to obtain a target three-dimensional model simulating the three-dimensional effect includes: Acquiring a surface normal vector and a preset light source direction vector of a target point of the initial three-dimensional model, wherein the target point comprises an intersection point of light rays emitted by a camera and the initial three-dimensional model; Calculating a dot product of the surface normal vector and a preset light source direction vector, and determining diffuse reflection parameters of the target point through power operation; calculating a reflection direction parameter according to a preset sight line direction and the surface normal vector, wherein the preset sight line direction comprises the direction from the target point to the camera in a three-dimensional space; And determining the reflection parameters of the target points according to the preset glossiness parameters, wherein the reflection direction parameters and the preset light source direction vectors, and the preset glossiness parameters are used for representing the high brightness and the high light sharpness of the surfaces of the three-dimensional objects.
  8. 8. The method according to claim 7, wherein the surface texture property at least includes illumination information, and the setting the surface texture property of the initial three-dimensional model to obtain the target three-dimensional model simulating the three-dimensional effect comprises: calculating sampling distances along the direction of the surface normal vector of the target point of the initial three-dimensional model according to preset sampling coefficients to determine a plurality of sampling points and environmental shielding factors, wherein the environmental shielding factors are determined based on the sampling distances; Calculating shielding distances between the sampling points and the initial three-dimensional model based on a third sphere distance field function corresponding to the initial three-dimensional model; Calculating an environmental shielding factor based on a difference between the sampling distance and the shielding distance under the condition that the shielding distance is >0, and determining environmental shielding information based on a product of a sampling number of preset illumination and the environmental shielding factor; Calculating an edge shielding factor based on the sum between the sampling distance and the shielding distance and determining edge shielding information based on the product of the sampling number of preset illumination and the edge shielding factor under the condition that the shielding distance is less than 0; integrating the ambient masking information and the edge masking information to determine the illumination information.
  9. 9. The method according to claim 8, wherein the surface texture property at least includes color information, and the setting the surface texture property of the initial three-dimensional model to obtain the target three-dimensional model simulating the three-dimensional effect includes: Selecting basic color information for a target point on the initial three-dimensional model based on the three-dimensional object type of the initial three-dimensional model; and adjusting the brightness and glossiness of the basic color information based on the illumination information, the diffuse reflection parameter and the reflection parameter, and determining the adjusted basic color information as the color information.
  10. 10. A method of generating a three-dimensional effect according to any of claims 7-9 and also comprising: respectively shifting coordinates of each dimension of a target point of the initial three-dimensional model to obtain a first offset point, a second offset point and a third offset point after shifting, and respectively calculating offset values corresponding to the first offset point, the second offset point and the third offset point through a detail function; subtracting the offset values corresponding to the first offset point, the second offset point and the third offset point from the original offset value of the target point respectively, and determining a subtraction result as an initial gradient vector; And normalizing the initial gradient vector to obtain the surface normal vector.
  11. 11. The method of generating a three-dimensional effect according to claim 7, characterized in that the method further comprises: calculating the light position of the light in the space according to the camera position coordinate of the camera under the three-dimensional coordinate system and the screen texture coordinate; Calculating the light position through a third sphere distance field function, updating the light position according to a preset step length under the condition that the calculation result is larger than a preset light threshold value, and calculating through the third sphere distance field function again according to the updated light position; and under the condition that the calculation result is smaller than a preset light threshold value, determining the light position point as the target point.
  12. 12. A three-dimensional effect generation apparatus, characterized in that the apparatus comprises: The construction module is used for constructing a three-dimensional coordinate system based on screen texture coordinates, and constructing a first sphere model and each second sphere model in the three-dimensional coordinate system, wherein the first sphere model and the second sphere model are at least partially overlapped; The engraving module is used for respectively performing engraving processing operation on the first sphere model through each second sphere model so as to obtain an initial three-dimensional model with irregular geometric shapes; The setting module is used for setting the surface material property of the initial three-dimensional model so as to obtain a target three-dimensional model simulating the three-dimensional visual effect.
  13. 13. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program, which is adapted to be loaded by a processor for performing the method of generating a three-dimensional effect according to any of claims 1-11.
  14. 14. A computer device, characterized in that the computer device comprises a processor and a memory, in which a computer program is stored, the processor being arranged to execute the method of generating a three-dimensional effect according to any of claims 1-11 by invoking the computer program stored in the memory.
  15. 15. A computer program product comprising computer instructions which, when executed by a processor, implement a method of generating a three-dimensional effect as claimed in any one of claims 1 to 11.

Description

Three-dimensional effect generation method, device, storage medium, equipment and program product Technical Field The present application relates to the field of game technologies, and in particular, to a method, an apparatus, a storage medium, a device, and a program product for generating a three-dimensional effect. Background When representing a large range of rocks (e.g., gobi beach, rock beach, star-sky merle strips, etc.) in a game scene, limited by the number of model vertices, two-dimensional facing is typically used to simulate such dense rock effects. However, the two-dimensional dough sheet cannot support multi-angle rotation, and cannot be viewed at any angle, resulting in poor display effect. Disclosure of Invention The embodiment of the application provides a method, a device, a storage medium, equipment and a program product for generating a three-dimensional effect, which are used for simulating an irregular initial three-dimensional model in a two-dimensional space without manually adjusting contours, greatly reducing labor cost and time cost, and enabling a target three-dimensional model to have visual characteristics of real materials through setting surface material properties of the model, so that the limitation that a traditional 2D (two-dimensional) patch can only present a fixed visual angle and has no stereoscopic impression is eliminated. In one aspect, an embodiment of the present application provides a method for generating a three-dimensional effect, where the method includes: constructing a three-dimensional coordinate system based on screen texture coordinates, and constructing a first sphere model and each second sphere model in the three-dimensional coordinate system, wherein the first sphere model and the second sphere model are at least partially overlapped; Performing engraving processing operation on the first sphere model through each second sphere model to obtain an initial three-dimensional model with irregular geometric shapes; And setting the surface material property of the initial three-dimensional model to obtain a target three-dimensional model simulating the three-dimensional visual effect. On the other hand, an embodiment of the present application provides a device for generating a three-dimensional effect, where the device includes: The construction module is used for constructing a three-dimensional coordinate system based on screen texture coordinates, and constructing a first sphere model and each second sphere model in the three-dimensional coordinate system, wherein the first sphere model and the second sphere model are at least partially overlapped; The engraving module is used for respectively performing engraving processing operation on the first sphere model through each second sphere model so as to obtain an initial three-dimensional model with irregular geometric shapes; The setting module is used for setting the surface material property of the initial three-dimensional model so as to obtain a target three-dimensional model simulating the three-dimensional visual effect. In another aspect, embodiments of the present application provide a computer readable storage medium storing a computer program adapted to be loaded by a processor to perform the method for generating a three-dimensional effect according to any of the embodiments above. In another aspect, an embodiment of the present application provides a computer device, where the computer device includes a processor and a memory, where the memory stores a computer program, and the processor is configured to execute the method for generating a three-dimensional effect according to any one of the embodiments above by calling the computer program stored in the memory. In another aspect, embodiments of the present application provide a computer program product comprising computer instructions which, when executed by a processor, implement a method of generating a three-dimensional effect as described in any of the embodiments above. According to the three-dimensional effect generation method provided by the embodiment of the application, the three-dimensional coordinate system is constructed based on the screen texture coordinates, the first sphere model and each second sphere model are constructed in the three-dimensional coordinate system, the first sphere model and each second sphere model are at least partially overlapped, and engraving processing operations are respectively carried out on the first sphere model through each second sphere model so as to obtain an initial three-dimensional model with an irregular geometric shape, wherein the engraving processing operations can comprise the steps of removing the overlapped part of the first sphere model and the second sphere model at random positions in the three-dimensional coordinate system, automatically generating an irregular initial three-dimensional model by removing the overlapped part of the first sphere model and the second sphere mode