Three-dimensional effect generation method and device, storage medium, equipment and program product
By constructing a three-dimensional coordinate system in two-dimensional space and sculpting a sphere model to generate an irregular three-dimensional model, the problem of two-dimensional patches being unable to rotate at multiple angles is solved, achieving efficient and low-cost generation of three-dimensional visual effects with realistic material characteristics.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUANGZHOU BOGUAN TELECOMM TECH LTD
- Filing Date
- 2025-12-11
- Publication Date
- 2026-05-12
AI Technical Summary
In game scenes, 2D tiles cannot support multi-angle rotation, resulting in poor display effects and making it impossible to view them from any angle.
By constructing a three-dimensional coordinate system in two-dimensional space, an irregular initial three-dimensional model is generated. A three-dimensional model with irregular geometry is generated using sculpting operations on a sphere model, and surface material properties are set to simulate the visual characteristics of real materials.
Significantly reducing labor and time costs, the generated 3D models possess the visual characteristics of realistic materials and can display a strong sense of three-dimensionality from any angle, breaking free from the limitations of traditional 2D panels.
Smart Images

Figure CN122006231A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of game technology, specifically to a method, apparatus, storage medium, device, and program product for generating three-dimensional effects. Background Technology
[0002] When depicting large areas of rocks in game scenes (such as Gobi Desert, rocky beaches, meteorite belts, etc.), due to the limited number of model vertices, two-dimensional facets are usually used to simulate this dense rock effect.
[0003] However, two-dimensional panels cannot support multi-angle rotation and cannot be viewed from any angle, resulting in poor display effects. Summary of the Invention
[0004] This application provides a method, apparatus, storage medium, device, and program product for generating three-dimensional effects. By simulating an irregular initial three-dimensional model in two-dimensional space, the outline can be adjusted manually, greatly reducing labor and time costs. Furthermore, by setting the surface material properties of the model, the target three-dimensional model can have the visual characteristics of real materials, thus overcoming the limitations of traditional 2D patches that can only present a fixed perspective and lack a sense of three-dimensionality.
[0005] On one hand, embodiments of this application provide a method for generating three-dimensional effects, the method comprising: Based on screen texture coordinates, a three-dimensional coordinate system is constructed, and a first sphere model and various second sphere models are constructed in the three-dimensional coordinate system, wherein the first sphere model and the second sphere models at least partially overlap. Using each of the second sphere models, a sculpting process is performed on the first sphere model to obtain an initial three-dimensional model with an irregular geometric shape. Set the surface material properties of the initial 3D model to obtain the target 3D model that simulates 3D visual effects.
[0006] On the other hand, embodiments of this application provide a three-dimensional effect generation apparatus, the apparatus comprising: A construction module is used to construct a three-dimensional coordinate system based on screen texture coordinates, and to construct a first sphere model and various second sphere models in the three-dimensional coordinate system, wherein the first sphere model and the second sphere models at least partially overlap. The sculpting module is used to perform sculpting operations on the first sphere model through each of the second sphere models to obtain an initial three-dimensional model with irregular geometric shapes. The settings module is used to set the surface material properties of the initial 3D model in order to obtain the target 3D model that simulates 3D visual effects.
[0007] On the other hand, embodiments of this application provide a computer-readable storage medium storing a computer program adapted for loading by a processor to execute the method for generating three-dimensional effects as described in any of the above embodiments.
[0008] On the other hand, embodiments of this application provide a computer device, the computer device including a processor and a memory, the memory storing a computer program, the processor executing the three-dimensional effect generation method as described in any of the above embodiments by calling the computer program stored in the memory.
[0009] On the other hand, embodiments of this application provide a computer program product, including computer instructions, which, when executed by a processor, implement the method for generating three-dimensional effects as described in any of the above embodiments.
[0010] The method for generating a 3D effect provided in this application constructs a 3D coordinate system based on screen texture coordinates, and then constructs a first sphere model and several second sphere models within this system. The first and second sphere models at least partially overlap. Using each of the second sphere models, a sculpting operation is performed on the first sphere model to obtain an initial 3D model with irregular geometric shapes. The sculpting operation may include removing the overlapping portions of the first sphere model and the second sphere models at random positions in the 3D coordinate system. Only the number of sculpting operations needs to be set to automatically generate the irregular initial 3D model by removing the overlapping portions of the first and second sphere models, eliminating the need for manual contour adjustments and significantly reducing labor and time costs. Set the surface material properties of the initial 3D model to obtain the target 3D model that simulates the 3D visual effect. For example, the surface material properties can include at least one of the following: roughness information, lighting information, diffuse reflection information, color information, and surface shape information. By setting the surface material properties (such as roughness information (simulating surface bumps), lighting information (including ambient occlusion and edge occlusion), diffuse reflection, reflective information (simulating light reflection), color information (adapting to the base color of the material), and surface shape information (multi-layer noise superimposed micro-texture), the target 3D model can have the visual characteristics of real materials, completely getting rid of the limitations of traditional 2D patches that can only present a fixed perspective and have no sense of three-dimensionality, and the visual effect is close to that of a true 3D model. Attached Figure Description
[0011] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0012] Figure 1 This is a schematic diagram of an example game system provided in an embodiment of this application.
[0013] Figure 2 This is a flowchart illustrating the method for generating three-dimensional effects provided in the embodiments of this application.
[0014] Figure 3 This is a schematic diagram of a first application scenario for the method of generating three-dimensional effects provided in the embodiments of this application.
[0015] Figure 4 This is a schematic diagram of a second application scenario for the method of generating three-dimensional effects provided in the embodiments of this application.
[0016] Figure 5 This is a schematic diagram of the structure of the three-dimensional effect generation device provided in the embodiments of this application.
[0017] Figure 6 A schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0018] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0019] This application provides a method, apparatus, storage medium, device, and program product for generating three-dimensional effects. Specifically, the method for generating three-dimensional effects in this application can be executed by a computer device, which can be a terminal or a server. The terminal can be a smartphone, tablet, laptop, smart TV, wearable smart device, smart vehicle terminal, etc. The terminal can also include a client, which can be a game client, browser client, instant messaging client, or mini-program, etc. The server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms.
[0020] For example, when the method for generating this 3D effect runs on a terminal device, the terminal device may include a display screen and a processor. The display screen is used to present the rock image and receive commands from the player interacting with the rock image. The processor is used to store the effect generation program, run the program, generate the rock effect image, respond to commands, and control the display of the rock effect image on the display screen. When the player interacts with the rock effect image through the display screen, the rock effect image can control the local content of the terminal device in response to the received operation commands. The terminal device can provide the interface to the user in various ways, such as rendering it on the terminal device's display screen or presenting it through holographic projection.
[0021] For example, when the method for generating this 3D effect runs on a server, it can be implemented and executed based on a cloud generation system. A cloud generation system refers to a computing method based on cloud computing. A cloud generation system includes servers and client devices. The application that generates the rock effect and the application that displays the image are separate entities. The storage and execution of the 3D effect generation method are completed on the server. The image display of the rock effect is completed on the client side. The client is mainly used for receiving and sending data and displaying the image. For example, the client can be a display device with data transmission capabilities located close to the user, such as a mobile terminal, television, computer, PDA, personal digital assistant, head-mounted display device, etc. However, the terminal device for data processing is the server in the cloud.
[0022] It should be noted that, in this embodiment, the execution entity of the method for generating 3D effects can be a terminal device or a server. The terminal device can be a local terminal device or a client device in the aforementioned cloud gaming. This embodiment does not limit the type of execution entity.
[0023] For example, in conjunction with the above description, Figure 1 This application illustrates a game system 1000 for implementing a method for generating three-dimensional effects, as provided in an embodiment of this application. The game system 1000 may include at least one terminal 1001, at least one server 1002, at least one database 1003, and a network. The user-held terminal 1001 can connect to different servers via the network. The terminal is any device with computing hardware capable of supporting and executing software applications corresponding to the game.
[0024] In possible application scenarios, different terminals 1001 may be served by different servers 1002. Therefore, in order to distinguish the servers 1002 corresponding to different terminals 1001, the embodiments of this application will use the terms "first" and "second" to describe them. In fact, the servers 1002 corresponding to different terminals 1001 can be the same server 1002. Therefore, without distinguishing between "first" and "second", it can be understood that the terminals 1001 corresponding to virtual characters in the same game scene are served by the same server 1002.
[0025] Furthermore, when system 1000 includes multiple terminals, multiple servers, and multiple networks, different terminals can connect to each other through different networks and servers. The network can be a wireless network or a wired network, such as a wireless local area network (WLAN), local area network (LAN), cellular network, 2G network, 3G network, 4G network, 5G network, etc. Additionally, different terminals can also connect to other terminals or to servers using their own Bluetooth networks or hotspot networks. Furthermore, system 100 can include multiple databases coupled to different servers, and can continuously store information related to the sphere model in the databases as different users access the system online.
[0026] It should be noted that in this embodiment, multiple terminal devices are running the same virtual game. Therefore, data interaction between the multiple terminal devices can be achieved through the virtual game's server. Thus, sending data from terminal device 1 to terminal device 2 can be understood as: terminal device 1 sends data to the server, and the server sends the data to terminal device 2. Receiving data from terminal device 2 can be understood as: terminal device 1 receives data sent by the server, which is the same data sent by terminal device 2 to the server. Alternatively, there may be no server, and terminal device 1 directly sends sphere data to terminal device 2.
[0027] It should be noted that, Figure 1 The game system diagram shown is merely an example. The system 1000 described in this application embodiment is intended to more clearly illustrate the technical solutions of this application embodiment and does not constitute a limitation on the technical solutions provided in this application embodiment. As those skilled in the art will know, with the evolution of game systems and the emergence of new business scenarios, the technical solutions provided in this application embodiment are also applicable to similar technical problems.
[0028] It should be noted that the triggering operations mentioned in the subsequent detailed description of the 3D effect generation method provided in the embodiments of this application can all be regarded as triggering operations performed by the player through a finger or by controlling a medium such as a mouse, keyboard, or stylus. The specific medium used can be determined according to the type of computer device. For example, when the computer device is a touchscreen device such as a mobile phone, tablet, or game console, the player can operate on the touchscreen using any suitable object or accessory such as a finger or stylus. When the terminal device is a non-touchscreen terminal device such as a desktop computer or laptop, the player can operate using external devices such as a mouse or keyboard.
[0029] The technical solution of this application will be described in detail below through specific embodiments. It should be noted that the following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.
[0030] Please see Figures 2 to 5 , Figure 2 This is a flowchart illustrating a method for generating a 3D effect according to an embodiment of this application. It should be noted that the steps shown may be executed in a logical order different from that shown in the flowchart. The method may include the following steps: Step 011: Based on the screen texture coordinates, construct a three-dimensional coordinate system, and construct a first sphere model and various second sphere models in the three-dimensional coordinate system. The first sphere model and the second sphere models should at least partially overlap.
[0031] Among them, screen texture coordinates can be coordinates (UV coordinates) on a texture coordinate system constructed based on a plane of two-dimensional patches. The three-dimensional coordinate system can be a coordinate system constructed with the screen texture coordinate system (UV) as the XY plane and a virtual Z-axis perpendicular to the plane.
[0032] The first sphere model can be a three-dimensional basic shape carrier, and the first sphere distance field function can be a signed distance function (SDF). An SDF is defined as the signed distance from any point in space to the surface of the sphere, where a value < 0 indicates that the point is inside the sphere model, a value = 0 indicates that the point is on the surface of the sphere model, and a value > 0 indicates that the point is outside the sphere model.
[0033] Optionally, the scheme also includes: Step 015: Obtain the first random vector in the three-dimensional coordinate system and normalize the first random vector to obtain the first random direction. The first random vector is determined according to the first random function and the preset seed parameter. Step 016: Determine the position of the second center of the second sphere model based on the first random direction and the radius of the first sphere; Step 017: Construct the second sphere distance field function based on the second sphere center position and the second sphere radius to construct the second sphere model in the three-dimensional coordinate system. The second sphere radius is determined based on the second random function, which is used to output random data based on floating-point numbers.
[0034] The second sphere model can be a random auxiliary shape used to sculpt the first sphere model, and it is also constructed using SDF (second sphere distance field function). The position and radius of the second sphere model are generated by random functions. By removing the overlapping parts of the first and second sphere models, the regular shape of the first sphere model can be broken to generate irregular contours, thereby generating models with different styles.
[0035] Specifically, a first random function can be constructed, which responds to the seed parameters input by the user and outputs a three-dimensional random vector (i.e., the first random vector). After normalizing and mapping the first random vector, the first random direction of the second sphere model relative to the first sphere model is obtained. Then, by multiplying the first random direction by the radius of the first sphere, the offset from the input target point to the first random direction can be obtained. Finally, the position of the target point plus the product of the first random direction and the radius of the first sphere is taken as the center position of the second sphere model (the second sphere center position). Then, by inputting a floating-point number to the second random function and using the output of the second random function as the radius of the second sphere, the second sphere model can be generated.
[0036] Optionally, step 011: Based on screen texture coordinates, construct a three-dimensional coordinate system, and construct a first sphere model and various second sphere models in the three-dimensional coordinate system, wherein the first sphere model and the second sphere models at least partially overlap, including: Step 0111: Based on the screen texture coordinate system and the virtual coordinate axis where the screen texture coordinates are located, construct a three-dimensional coordinate system, with the virtual coordinate axis perpendicular to the screen texture coordinate system; Step 0112: Using the origin of the three-dimensional coordinate system as the first center position of the first sphere model, construct the first sphere distance field function based on the first center position and the first sphere radius to construct the first sphere model in the three-dimensional coordinate system.
[0037] The radius of the first sphere is set by the user (such as an artist, modeling engineer, etc.).
[0038] Specifically, a three-dimensional coordinate system can be constructed first based on the screen texture coordinates. Assuming the center of the sphere is at the origin of the coordinate system and the coordinates of a certain point are p, p and the first sphere radius (float r) input by the artist are used as inputs. The vector magnitude length (length(p)) of point p (the distance from p to the origin of the coordinate system) is calculated. Then, the radius r is subtracted from length(p) to obtain the difference. The point is defined as whether it is on the surface of the sphere by comparing the difference with 0. When the difference is < 0, it indicates that the point is inside the sphere model. When the difference is = 0, it indicates that the point is on the surface of the sphere model. When the difference is > 0, it indicates that the point is outside the sphere model. In this way, a three-dimensional sphere model, namely the first sphere model, can be defined in a two-dimensional plane.
[0039] Step 012: Using each of the second sphere models, perform sculpting operations on the first sphere model to obtain an initial three-dimensional model with irregular geometric shapes.
[0040] The carving process includes removing the portion of the first sphere model that overlaps with the second sphere model at a random position in the three-dimensional coordinate system.
[0041] The irregular geometric shape can be a rock shape, a gravel shape, or something similar in a game scene. For ease of explanation, this embodiment uses an irregular geometric shape corresponding to a rock shape as an example.
[0042] Optionally, step 012: Using each of the second sphere models, perform sculpting operations on the first sphere model to obtain an initial 3D model with irregular geometry, including: Step 0121: Obtain a preset number of second sphere models; Step 0122: Based on the second sphere distance field function and preset smoothing coefficient corresponding to each second sphere model, perform a first preset number of subtraction operations on the first sphere distance field function corresponding to the first sphere model to obtain the third sphere distance field function. The third sphere distance field function corresponds to the initial three-dimensional model with irregular geometric shape, and the preset number and preset number of operations are matched.
[0043] The first preset number of times can be customized by the user based on performance and irregular geometric shape requirements. For example, it can be 8 times, 9 times, 10 times, etc. The preset number and the preset number of times can be matched; for example, the preset number of times and the first preset number of times can be the same.
[0044] Specifically, please refer to Figure 3To avoid excessive overlap between the bottom of the generated target 3D model and the ground during subsequent rendering, which would be visually unappealing, the first sphere model can be offset by 0.2 units along the negative y-axis of the 3D coordinate system when generating or sculpting it. This will slightly shift the bottom of the target 3D model downwards. When generating the initial 3D model, the overlapping portion can be removed using a smooth subtraction Boolean operation (boolSmoothSub function), avoiding harsh sculpted edges caused by direct subtraction and resulting in a more natural concavity in the 3D object. For example, the `boolSmoothSub` function performs an A / B smoothing subtraction operation on the first sphere distance field function (let's say A), the second sphere distance field function (let's say B), and a preset smoothing coefficient (let's say 0.03). This yields a new sphere distance field function after removing the overlapping parts (the SDF corresponding to the new shape of the first sphere model after removing the overlapping parts). The first sphere distance field function is then updated with this new function. By updating the first sphere distance field function a preset number of times, the third sphere distance field function is obtained, thus completing the initial 3D model. It can be understood that with each iteration, the shape corresponding to the first sphere model gains one more random indentation. After a preset number of iterations, the first sphere model transforms from a perfect sphere into an irregular shape with a first preset number of random indentations, initially possessing the rough appearance of a 3D object. Here, 0.03 is the smoothing coefficient; a smaller value results in sharper edges, while a larger value results in softer edges.
[0045] Step 013: Set the surface material properties of the initial 3D model to obtain the target 3D model that simulates the 3D visual effect.
[0046] Among them, the surface material properties include at least one of the following: roughness information, illumination information, diffuse reflection information, color information, and surface shape information.
[0047] Roughness information reflects the unevenness of the rock surface. Lighting information reflects whether the rock surface is occluded. Diffuse reflection information reflects the reflection effect of the rock surface (including diffuse and specular reflection). Color information reflects the RGB colors of the rock surface. Surface shape information can be represented as three-dimensional objects of different materials.
[0048] Optionally, the surface material properties include at least roughness information. Step 013: Set the surface material properties of the initial 3D model to obtain the target 3D model that simulates the 3D visual effect, including: Step 0131: Interpolate the distance field function of the third sphere corresponding to the initial three-dimensional model using a preset noise function to obtain height offset data. The preset noise function is used to generate random height offset data for any spatial point in the three-dimensional coordinate system (so that the originally smooth sphere surface will produce irregular undulations).
[0049] Step 0132: Overlay the height offset data and the distance field function of the third sphere to set the roughness information of the initial 3D model.
[0050] The process involves inputting 3D points on the surface of the initial 3D model into a preset noise function to obtain corresponding noise values. This ensures that the unevenness effect at different locations on the 3D object is not repeated. The noise values are then smoothed through interpolation to avoid abrupt, blocky jumps in the noise, resulting in a more natural transition between unevenness and unevenness. This achieves a physical effect that reflects the roughness of the 3D object's surface without being abrupt. Next, bilinear interpolation is performed on the noise values. For example, based on the interpolation results of the noise values of points at adjacent heights of the 3D point, the height offset data of the current point is obtained. The larger the height offset data, the more convex the surface at the corresponding location; the smaller the value, the more concave it is. This height offset data is then superimposed as a roughness information parameter into the third sphere distance field function of the initial 3D model, thereby creating unevenness on the model surface. In addition, the noise frequency parameter can be set by multiplying the coordinates of three-dimensional points with the preset frequency coefficient to determine the range of roughness influence. The displacement coefficient parameter can be set by multiplying the noise value with the displacement intensity coefficient to determine the convex height of roughness, thereby controlling the degree of unevenness and producing a random, irregular uneven roughness effect on the originally smooth three-dimensional object surface.
[0051] Optionally, the surface material properties include at least surface shape information. Step 013: Set the surface material properties of the initial 3D model to obtain the target 3D model that simulates the 3D visual effect, including: Step 0133: Multiply the current frequency by the position coordinates of the target point on the initial 3D model, and calculate the current noise value of the target point based on the multiplication result. The current frequency corresponds to the position coordinates of the target point. Step 0134: Obtain the current amplitude and multiply it with the current noise value to determine the shape noise value of the target point based on the result of multiplying the current amplitude and the current noise value; Step 0135: Perform a second preset number of iterations to superimpose the shape noise value according to the preset amplitude attenuation coefficient and the preset frequency multiplication coefficient to obtain the accumulated shape noise value. Then, superimpose the accumulated shape noise value and the third sphere distance field function to set the surface shape information of the initial three-dimensional model. The preset amplitude attenuation coefficient is used to control the attenuation rate of each layer of amplitude during each iteration of superposition. The amplitude is used to characterize the concavity and convexity intensity of the noise. The frequency multiplication coefficient is used to control the increase of the frequency of each layer during each iteration of superposition. The frequency is used to characterize the quantity of noise.
[0052] The process involves taking the position coordinates of the target point on the initial 3D model as input, multiplying the current frequency by the position coordinates, inputting the multiplication result into a preset noise function (such as Perlin noise, Simplex noise, etc.), and outputting a noise value. The noise value is then squared, and the result is used as the current noise value. The current amplitude is then multiplied by the current noise value, and the result is used as the shape noise value. The frequency is then updated according to a preset amplitude attenuation coefficient, and the amplitude is updated according to a preset frequency multiplication coefficient. After the update, the shape noise value is calculated again. By calculating a preset number of shape noise values for a second preset number of times and accumulating the shape noise values, the surface shape information can be obtained, achieving the effect of simulating 3D objects of different materials.
[0053] Optionally, the surface material properties include at least diffuse reflection information, which includes diffuse reflection parameters and reflectivity parameters. Step 013: Set the surface material properties of the initial 3D model to obtain the target 3D model simulating the 3D visual effect, including: Step 0136: Obtain the surface normal vector and preset light source direction vector of the target point of the initial 3D model. The target point includes the intersection of the light emitted by the camera and the initial 3D model. Step 0137: Calculate the dot product of the surface normal vector and the preset light source direction vector, and determine the diffuse reflection parameters of the target point through power operation; Step 0138: Calculate the reflection direction parameters based on the preset viewing direction and surface normal vector. The preset viewing direction includes the direction from the target point to the camera in three-dimensional space. Step 0139: Determine the reflection parameters of the target point based on the preset gloss parameters, reflection direction parameters, and preset light source direction vector. The preset gloss parameters are used to characterize the specular size and specular sharpness of the three-dimensional object surface.
[0054] The process can take the surface normal vector vec3n, the light source direction vector vec3l, and the diffuse power parameter (float p, which controls the smoothness of the diffuse light and dark transition) of the 3D object surface as input. The process involves calculating the dot product of the normal n and the light source direction l (the dot product value determines whether diffuse reflection exists), updating values with a dot product value <0 to 0, and then calculating the diffuse power parameter to obtain the diffuse reflection parameter (diffuse reflection intensity value). Next, the specular intensity of different gloss parameters s is normalized, and the reflection direction parameter of the viewing direction vector vec3e with respect to the surface normal vector vec3n (i.e., the path of light reflected towards the camera after hitting the surface) is calculated using the reflect function. Finally, the dot product of the reflection direction and the light source direction vector vec3l is calculated; the magnitude of the dot product value determines the specular intensity, and values with a dot product value <0 are updated to 0. The result is then raised to the power of the gloss parameter s and multiplied by the standardization coefficient nrm to obtain the normalized reflection parameter.
[0055] Optionally, the surface material properties include at least lighting information. Step 013: Set the surface material properties of the initial 3D model to obtain the target 3D model that simulates the 3D visual effect, including: Step 021: Along the direction of the surface normal vector of the target point of the initial 3D model, calculate the sampling distance according to the preset sampling coefficient to determine multiple sampling points and the environment occlusion factor. The environment occlusion factor is determined based on the sampling distance. Step 022: Based on the distance field function of the third sphere corresponding to the initial 3D model, calculate the occlusion distance between each sampling point and the initial 3D model; Step 023: When the shading distance is >0, calculate the environmental shading factor based on the difference between the sampling distance and the shading distance, and determine the environmental shading information based on the product of the number of samplings of the preset illumination and the environmental shading factor. Step 024: When the occlusion distance is less than 0, calculate the edge occlusion factor based on the sum of the sampling distance and the occlusion distance, and determine the edge occlusion information based on the product of the number of samplings of the preset illumination and the edge occlusion factor; Step 025: Integrate ambient occlusion information and edge occlusion information to determine illumination information.
[0056] The process involves sampling four times based on the direction of the surface normal vector of the target point in the initial 3D model. Each time, the ambient occlusion sampling distance (hao) and edge occlusion sampling distance (hc) are calculated based on the standardized sampling coefficient (f). External and internal sampling points are obtained along the positive direction (outside the rock) and the negative direction (inside the rock) of the surface normal vector (n), respectively. The map function is called to calculate the SDF value of the sampling points and combine it with the threshold to obtain dao and dc. The occlusion value after clamping is multiplied by the weight (1.0-f) and accumulated into the ambient occlusion result (rx) and edge occlusion result (ry). Finally, the accumulated result is optimized by the standardized coefficient and intensity coefficient and clamped to the range of [0.0, 1.0], and the ambient occlusion coefficient (rx) and edge occlusion coefficient (ry) are output to form the lighting information for subsequent adjustment of the brightness of the rock color.
[0057] When the shading distance is 0, the calculation can be performed according to the calculation logic in step 023 or the calculation logic in step 024. This application does not impose any restrictions on this.
[0058] Optionally, the surface material properties include at least color information. Step 013: Set the surface material properties of the initial 3D model to obtain the target 3D model that simulates the 3D visual effect, including: Step 026: Based on the type of 3D object to which the initial 3D model belongs, select basic color information for the target points on the initial 3D model; Step 027: Based on the illumination information, diffuse reflection parameters, and reflectance parameters, adjust the brightness and gloss of the basic color information, and determine the adjusted basic color information as the color information.
[0059] Specifically, the basic color information (such as dark gray rock base, reddish sandstone base, etc.) can be selected for the target points on the initial 3D model based on the type of 3D object to which the initial 3D model belongs (e.g., what kind of rock material it is, such as granite, sandstone, etc.). Then, based on the edge occlusion information of the target points, the inverse value of the edge occlusion factor is calculated to adjust the intensity of the lighting effect later, avoiding harsh color transitions in the occluded areas. Based on the surface normal vector and the viewing direction vector of the target points, the edge light parameters are calculated through the Fresnel effect to simulate the soft bright edge of the rock. By acquiring diffuse reflection information, the diffuse reflection information is superimposed on the basic color information to adjust the color brightness and gloss. At the same time, the surface normal vector is perturbed to enhance the color differences corresponding to micro-details. Finally, the height attenuation is adjusted by combining the height of the target points, and the orientation attenuation is adjusted by combining the orientation of the surface normal vector. Finally, the color is mixed with white through the edge light parameters to obtain the final color information of the target points.
[0060] Optionally, the method further includes: Step 018: Offset the coordinates of the target points in each dimension of the initial 3D model to obtain the first offset point, the second offset point, and the third offset point. Then, calculate the offset values of the first offset point, the second offset point, and the third offset point respectively using detail functions. Step 019: Subtract 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, and use the subtraction result as the initial gradient vector; Step 020: Normalize the initial gradient vector to obtain the surface normal vector.
[0061] Specifically, the target points of the initial 3D model include the x-axis, y-axis, and z-axis. By offsetting the x-coordinate, y-coordinate, and z-coordinate by the corresponding offset numbers, the first offset point, the second offset point, and the third offset point are obtained. The map_detailed function (high-precision detail SDF function) is used to calculate the offset values of the first offset point, the second offset point, and the third offset point respectively. The gradient vector of SDF in 3D space is calculated by the central difference method. The SDF values of the original points are subtracted from the SDF values of the offset points on the X, Y, and Z axes respectively to obtain the initial gradient vector. The direction of this vector is the original direction of the surface normal. Finally, the initial gradient vector is normalized to scale the vector length to 1, and the surface normal vector perpendicular to the rock surface is obtained.
[0062] In some implementations, the method further includes: Step 031: Calculate the position of the light ray in space based on the camera's position coordinates in the three-dimensional coordinate system and the screen texture coordinates; Step 032: Calculate the position of the light ray using the distance field function of the third sphere. If the calculation result is greater than the preset light ray threshold, update the position of the light ray according to the preset step size, and recalculate the position of the light ray using the distance field function of the third sphere according to the updated position. Step 033: If the calculation result is less than the preset light threshold, determine the light position point as the target point.
[0063] The light threshold can be 0, 0.09, 0.1, 0.11, etc.
[0064] Specifically, the camera position coordinates in the three-dimensional coordinate system are used as the ray origin (ori), and the unit vector pointing from the camera to the screen texture coordinates is used as the ray direction (dir). First, the product of the ray origin, the ray direction, and the current travel distance of the ray is used as the current ray position. Then, the SDF value of the current ray position is used. If the SDF value is greater than the preset ray threshold (e.g., 0.1), the ray position is updated according to the preset step size and the calculation continues. If the SDF value is less than the preset ray threshold, it means that the current ray position has reached the rock surface, and the ray position point is determined as the target point.
[0065] Step 014: Render and generate a screen image based on the target 3D model.
[0066] Optionally, step 014: Based on the target 3D model, render and generate a screen image, including: Step 0141: Integrate the surface material properties of the target 3D model to obtain four-channel data, which includes three color channels and a mask channel. Step 0142: Render the initial 3D model based on the four-channel data to generate a screen image.
[0067] Among them, the screen image can be a visualized 2D image of the target 3D model (such as a rock model) after being processed by the game engine rendering pipeline, mapped onto a 2D surface, and presented on a display device (such as a game screen or terminal display screen).
[0068] The process involves calling the `getPixel` function to obtain the initial color and mask of a single pixel based on the screen texture coordinates and a random seed. Gamma correction is then used to convert the linear color space to sRGB color space to adapt to the screen's display characteristics and avoid overly dark colors. The surface material properties of the target 3D model, enhanced with saturation (making the rock colors more vibrant and the texture more prominent), are then integrated into four-channel data. The first three channels represent red, green, and blue color information, while the fourth channel is the alpha mask channel data (e.g., 1.0 represents the rock area, and 0.0 represents the background area, used to distinguish the foreground from the background during subsequent rendering). All four-channel data from each pixel is then passed to the game engine's rendering pipeline, where the engine maps the data onto 2D surfaces, ultimately generating a 3D visually appealing rock image that can be displayed on the screen (e.g., a dense group of rocks in a game scene).
[0069] Optionally, the method further includes: Step 034: Calculate the view vector from the camera to the screen based on the camera position in the three-dimensional coordinate system and the center position of the screen; Step 035: Calculate the angle between the view vector and the target coordinate axis in the three-dimensional coordinate system using the game engine, and control the deflection direction of the target three-dimensional model in the three-dimensional coordinate system based on the angle.
[0070] Specifically, please refer to Figure 3 and Figure 4 Based on the camera's position in the 3D coordinate system and the object pivot point (the center reference point of the 2D surface), the Subtract node in the game engine blueprint calculates a vector by subtracting the surface pivot point position from the camera position. This vector is then processed into a unit vector using the Normalize node, representing the view vector from the camera to the surface. This vector directly reflects the camera's spatial orientation relative to the surface (e.g., front, side, or diagonally above). Using the Y-axis (target axis) of the 3D coordinate system as a reference, the AngleBetweenVectors node in the blueprint is called. The normalized view vector and the Y-axis vector are input, and the angle between them (in degrees) is output. This angle accurately reflects the degree of camera deflection relative to the surface (e.g., the angle increases from 0° to 90° when the camera moves from the front to the side). The calculated angle value is then used as an input parameter. Based on this angle, the rotation angle of the 3D rock model in mathematical space is adjusted so that the rock model rotates 90° synchronously. This ensures that the rock shape displayed on the 2D panel perfectly matches the outline and lighting effects of the real 3D rock when viewed from this perspective, avoiding the flatness that is noticeable when viewed from the side.
[0071] Thus, by constructing a three-dimensional coordinate system based on screen texture coordinates, and building a first sphere model and several second sphere models within this system, with the first and second sphere models at least partially overlapping, sculpting operations are performed on the first sphere model using each of the second sphere models to obtain an initial three-dimensional model with irregular geometry. The sculpting operation can include removing the overlapping portions of the first sphere model and the second sphere models at random positions in the three-dimensional coordinate system. By simply setting the number of sculpting operations, the irregular initial three-dimensional model can be automatically generated by removing the overlapping portions of the first and second sphere models, eliminating the need for manual contour adjustments and significantly reducing labor and time costs. The surface material properties of the initial three-dimensional model are then set to obtain a target three-dimensional model that simulates a three-dimensional visual effect, for example... Surface material properties can include at least one of the following: roughness information, lighting information, diffuse reflection information, color information, and surface shape information. By setting surface material properties (such as roughness information (simulating surface bumps), lighting information (including ambient occlusion and edge occlusion), diffuse reflection, reflective information (simulating light reflection), color information (adapting to the material's base color), and surface shape information (multi-layer noise superimposed micro-texture), the target 3D model can possess the visual characteristics of a real material. This completely breaks away from the limitations of traditional 2D patches that can only present a fixed perspective and lack a sense of three-dimensionality. The visual effect is close to that of a true 3D model. Furthermore, the screen image generated based on the target 3D model can be directly connected to the game engine's rendering pipeline without the need for additional engine adaptation modules, thus lowering the technical implementation threshold.
[0072] To facilitate better implementation of the three-dimensional effect generation method of this application embodiment, this application embodiment also provides a three-dimensional effect generation apparatus. Please refer to... Figure 5 , Figure 5 This is a schematic diagram of the structure of a three-dimensional effect generation apparatus provided in an embodiment of this application. The three-dimensional effect generation apparatus 200 can provide a graphical user interface through a terminal device. The graphical user interface includes at least a partial virtual scene and at least one virtual character. The three-dimensional effect generation apparatus 200 may include: Module 201 is used to construct a three-dimensional coordinate system based on screen texture coordinates, and to construct a first sphere model and various second sphere models in the three-dimensional coordinate system, wherein the first sphere model and the second sphere models at least partially overlap. The carving module 202 is used to perform carving operations on the first sphere model through each of the second sphere models to obtain an initial three-dimensional model with irregular geometric shape. The setting module 203 is used to set the surface material properties of the initial 3D model in order to obtain the target 3D model that simulates the 3D visual effect.
[0073] Each unit in the aforementioned three-dimensional effect generation device can be implemented entirely or partially through software, hardware, or a combination thereof. These units can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each unit.
[0074] The 3D effect generation device 200 can be integrated into a terminal or server that has storage and a processor and thus computing power, or the 3D effect generation device 200 can be the terminal or server.
[0075] Optionally, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.
[0076] Figure 6 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. The computer device may be a terminal or a server. Figure 6 As shown, the computer device 300 includes a processor 301 with one or more processing cores, a memory 302 with one or more computer-readable storage media, and a computer program stored in the memory 302 and executable on the processor. The processor 301 is electrically connected to the memory 302. Those skilled in the art will understand that the computer device structure shown in the figures does not constitute a limitation on the computer device, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0077] The processor 301 is the control center of the computer device 300. It connects various parts of the computer device 300 through various interfaces and lines. By running or loading software programs and / or modules stored in the memory 302, and calling data stored in the memory 302, it performs various functions of the computer device 300 and processes data, thereby performing overall processing of the computer device 300.
[0078] In this embodiment, the processor 301 in the computer device 300 loads the instructions corresponding to the processes of one or more computer programs into the memory 302 according to the following steps, and the processor 301 runs the computer programs stored in the memory 302 to realize various functions: Based on screen texture coordinates, a three-dimensional coordinate system is constructed, and a first sphere model and various second sphere models are constructed in the three-dimensional coordinate system, wherein the first sphere model and the second sphere models at least partially overlap. Using each of the second sphere models, a sculpting process is performed on the first sphere model to obtain an initial three-dimensional model with an irregular geometric shape. Set the surface material properties of the initial 3D model to obtain the target 3D model that simulates 3D visual effects; Based on the target 3D model, a screen image is rendered.
[0079] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0080] Optional, such as Figure 6 As shown, the computer device 300 also includes: a display screen 303, a radio frequency circuit 304, an audio circuit 305, an input unit 306, and a power supply 307. The processor 301 is electrically connected to the display screen 303, the radio frequency circuit 304, the audio circuit 305, the input unit 306, and the power supply 307. Those skilled in the art will understand that... Figure 6 The computer device structure shown does not constitute a limitation on the computer device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0081] The display screen 303 can be used to display a graphical user interface (GUI) and receive operation commands generated by the user interacting with the GUI. The display screen 303 may include a display panel and a touch panel. The display panel can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces of the computer device. These graphical user interfaces can be composed of graphics, text, icons, video, and any combination thereof. The touch panel can be used to collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel), generate corresponding operation commands, and execute the corresponding program. Optionally, the touch panel may include a touch detection device and a touch controller. The touch detection device detects the user's touch location and the signal generated by the touch operation, and transmits the signal to the touch controller. The touch controller receives touch information from the touch detection device, converts it into touch point coordinates, sends it to the processor 301, and can receive and execute commands from the processor 301. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it transmits the information to the processor 301 to determine the type of touch event. Subsequently, the processor 301 provides corresponding visual output on the display panel according to the type of touch event. In this embodiment, the touch panel and the display panel can be integrated into the display screen 303 to achieve input and output functions. However, in some embodiments, the touch panel and the display screen 303 can be implemented as two independent components to achieve input and output functions. That is, the display screen 303 can also be used as part of the input unit 306 to achieve input functions.
[0082] The radio frequency circuit 304 can be used to transmit and receive radio frequency signals to establish wireless communication with network devices or other computer devices, and to transmit and receive signals with network devices or other computer devices.
[0083] Audio circuitry 305 can be used to provide an audio interface between a user and a computer device via a speaker and a microphone. Audio circuitry 305 converts received audio data into electrical signals, transmits them to the speaker, and the speaker converts them into sound signals for output. Conversely, the microphone converts collected sound signals into electrical signals, which are then received by audio circuitry 305, converted back into audio data, and output to processor 301 for processing. The audio data is then transmitted via radio frequency circuitry 304 to, for example, another computer device, or output to memory 302 for further processing. Audio circuitry 305 may also include an earphone jack to facilitate communication between peripheral headphones and the computer device.
[0084] The input unit 306 can be used to receive input numbers, characters, or object feature information (such as fingerprints, irises, facial information, etc.), and to generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control.
[0085] Power supply 307 is used to supply power to various components of computer device 300. Optionally, power supply 307 can be logically connected to processor 301 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. Power supply 307 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0086] although Figure 6 As not shown in the diagram, the computer device 300 may also include a camera, sensor, wireless fidelity module, Bluetooth module, etc., which will not be described in detail here.
[0087] This application also provides a computer-readable storage medium for storing a computer program. This computer-readable storage medium can be applied to a computer device, and the computer program causes the computer device to execute the corresponding processes in the method for generating three-dimensional effects according to the embodiments of this application; for the sake of brevity, these will not be elaborated further here.
[0088] This application also provides a computer program product including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the corresponding process in the three-dimensional effect generation method described in the embodiments of this application. For simplicity, further details are omitted here.
[0089] This application also provides a computer program comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the corresponding process in the method for generating three-dimensional effects described in this application. For brevity, further details are omitted here.
[0090] It should be understood that the processor in this application may be an integrated circuit chip with signal processing capabilities. In implementation, the steps of the above method embodiments can be completed by integrated logic circuits in the processor's hardware or by instructions in software form. The processor described above can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules can be located in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method.
[0091] It is understood that the memory in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDR SDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchlink DRAM (SLDRAM), and Direct Rambus RAM (DR RAM). It should be noted that the memory used in the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0092] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0093] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0094] In the embodiments of this application, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0095] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0096] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0097] In addition, the functional units in this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0098] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer or a server) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.
[0099] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for generating a three-dimensional effect, characterized in that, include: Based on screen texture coordinates, a three-dimensional coordinate system is constructed, and a first sphere model and various second sphere models are constructed in the three-dimensional coordinate system, wherein the first sphere model and the second sphere models at least partially overlap. Using each of the second sphere models, a sculpting process is performed on the first sphere model to obtain an initial three-dimensional model with an irregular geometric shape. Set the surface material properties of the initial 3D model to obtain the target 3D model that simulates 3D visual effects.
2. The method for generating three-dimensional effects according to claim 1, characterized in that, The process involves constructing a three-dimensional coordinate system based on screen texture coordinates, and then constructing a first sphere model and various second sphere models within this three-dimensional coordinate system. The first and second sphere models at least partially overlap. Based on the screen texture coordinate system and the virtual coordinate axis where the screen texture coordinates are located, the three-dimensional coordinate system is constructed, and the virtual coordinate axis is perpendicular to the screen texture coordinate system; The origin of the three-dimensional coordinate system is taken as the first center position of the first sphere model. A first sphere distance field function is constructed based on the first center position and the first sphere radius to construct the first sphere model in the three-dimensional coordinate system.
3. The method for generating three-dimensional effects according to claim 2, characterized in that, Also includes: A first random vector is obtained in the three-dimensional coordinate system, and the first random vector is normalized to obtain a first random direction. The first random vector is determined according to a first random function and a preset seed parameter. Based on the first random direction and the radius of the first sphere, determine the position of the second center of the second sphere model; A second sphere distance field function is constructed based on the second sphere center position and the second sphere radius to construct a second sphere model in the three-dimensional coordinate system. The second sphere radius is determined based on a second random function, which is used to output random data based on floating-point numbers.
4. The method for generating a three-dimensional effect according to claim 1 or 3, characterized in that, The step of performing sculpting operations on the first sphere model using each of the second sphere models to obtain an initial three-dimensional model with irregular geometric shapes includes: Obtain a preset number of the second sphere models; Based on the second sphere distance field function corresponding to each second sphere model and the preset smoothing coefficient, the first sphere distance field function corresponding to the first sphere model is subtracted a first preset number of times to obtain the third sphere distance field function. The third sphere distance field function corresponds to the initial three-dimensional model with irregular geometric shape, and the preset number matches the first preset number of times.
5. The method for generating three-dimensional effects according to claim 4, characterized in that, The surface material properties include at least roughness information. Setting the surface material properties of the initial 3D model to obtain the target 3D model simulating the 3D effect includes: The distance field function of the third sphere corresponding to the initial three-dimensional model is interpolated by a preset noise function to obtain height offset data. The preset noise function is used to generate random height offset data for any spatial point in the three-dimensional coordinate system. The height offset data and the distance field function of the third sphere are superimposed to set the roughness information of the initial three-dimensional model.
6. The method for generating three-dimensional effects according to claim 5, characterized in that, The surface material properties include at least surface shape information. Setting the surface material properties of the initial 3D model to obtain the target 3D model simulating the 3D effect includes: Multiply the current frequency by the position coordinates of the target point on the initial 3D model, and calculate the current noise value of the target point based on the multiplication result. The current frequency corresponds to the position coordinates of the target point. Obtain the current amplitude and multiply the current amplitude with the current noise value to determine the shape noise value of the target point based on the result of multiplying the current amplitude with the current noise value; The shape noise value is iteratively superimposed a second preset number of times according to a preset amplitude attenuation coefficient and a preset frequency multiplication coefficient to obtain an accumulated shape noise value. The accumulated shape noise value is then superimposed with the third sphere distance field function to set the surface shape information of the initial three-dimensional model. The preset amplitude attenuation coefficient is used to control the attenuation rate of each layer of amplitude during each iteration of superposition, and the amplitude is used to characterize the concavity and convexity intensity of the noise. The frequency multiplication coefficient is used to control the increase in frequency of each layer during each iteration of superposition, and the frequency is used to characterize the quantity of noise.
7. The method for generating three-dimensional effects according to claim 1, 5, or 6, characterized in that, The surface material properties include at least diffuse reflection information, which includes diffuse reflection parameters and reflectivity parameters. Setting the surface material properties of the initial 3D model to obtain a target 3D model simulating a 3D effect includes: Obtain the surface normal vector and preset light source direction vector of the target point of the initial 3D model. The target point includes the intersection of the light emitted by the camera and the initial 3D model. Calculate the dot product of the surface normal vector and the preset light source direction vector, and determine the diffuse reflection parameters of the target point through power operation; The reflection direction parameters are calculated based on the preset viewing direction and the surface normal vector. The preset viewing direction includes the direction from the target point to the camera in three-dimensional space. Based on the preset glossiness parameter, the reflection direction parameter, and the preset light source direction vector, the reflection parameter of the target point is determined. The preset glossiness parameter is used to characterize the highlight size and highlight sharpness of the three-dimensional object surface.
8. The method for generating three-dimensional effects according to claim 7, characterized in that, The surface material properties include at least lighting information. Setting the surface material properties of the initial 3D model to obtain the target 3D model simulating the 3D effect includes: Along the direction of the surface normal vector of the target point of the initial 3D model, the sampling distance is calculated according to the preset sampling coefficient to determine multiple sampling points and an environmental occlusion factor, wherein the environmental occlusion factor is determined based on the sampling distance; Based on the third sphere distance field function corresponding to the initial 3D model, the occlusion distance between each sampling point and the initial 3D model is calculated. When the shading distance is greater than 0, an environmental shading factor is calculated based on the difference between the sampling distance and the shading distance, and environmental shading information is determined based on the product of the number of samplings of the preset illumination and the environmental shading factor. When the occlusion distance is less than 0, the edge occlusion factor is calculated based on the sum of the sampling distance and the occlusion distance, and the edge occlusion information is determined based on the product of the number of samplings of the preset illumination and the edge occlusion factor. The ambient occlusion information and the edge occlusion information are integrated to determine the illumination information.
9. The method for generating three-dimensional effects according to claim 8, characterized in that, The surface material properties include at least color information. Setting the surface material properties of the initial 3D model to obtain the target 3D model simulating a 3D effect includes: Based on the type of 3D object to which the initial 3D model belongs, select basic color information for the target points on the initial 3D model; Based on the illumination information, the diffuse reflection parameters, and the reflective parameters, the brightness and gloss of the basic color information are adjusted, and the adjusted basic color information is determined as the color information.
10. The method for generating a three-dimensional effect according to any one of claims 7-9, characterized in that, The method further includes: The coordinates of the target points in each dimension of the initial 3D model are offset to obtain the first offset point, the second offset point, and the third offset point. The offset values corresponding to the first offset point, the second offset point, and the third offset point are calculated by detail functions. The offset values corresponding to the first offset point, the second offset point, and the third offset point are subtracted from the original offset value of the target point, and the subtraction result is determined as the initial gradient vector. The initial gradient vector is normalized to obtain the surface normal vector.
11. The method for generating three-dimensional effects according to claim 7, characterized in that, The method further includes: The position of the light in space is calculated based on the camera's position coordinates in the three-dimensional coordinate system and the screen texture coordinates. The position of the light ray is calculated using the third sphere distance field function. If the calculated result is greater than a preset light ray threshold, the position of the light ray is updated according to a preset step size, and the position of the light ray is recalculated using the third sphere distance field function according to the updated position. If the calculated result is less than a preset light threshold, the light position point is determined as the target point.
12. A device for generating three-dimensional effects, characterized in that, The device includes: A construction module is used to construct a three-dimensional coordinate system based on screen texture coordinates, and to construct a first sphere model and various second sphere models in the three-dimensional coordinate system, wherein the first sphere model and the second sphere models at least partially overlap. The sculpting module is used to perform sculpting operations on the first sphere model through each of the second sphere models to obtain an initial three-dimensional model with irregular geometric shapes. The settings module is used to set the surface material properties of the initial 3D model in order to obtain the target 3D model that simulates 3D visual effects.
13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program adapted for loading by a processor to perform the method for generating three-dimensional effects as described in any one of claims 1-11.
14. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing a computer program, and the processor executing the method for generating three-dimensional effects according to any one of claims 1-11 by calling the computer program stored in the memory.
15. A computer program product comprising computer instructions, characterized in that, When the computer instructions are executed by the processor, they implement the method for generating three-dimensional effects as described in any one of claims 1-11.