Special-shaped celestial body generation method and device, electronic equipment and storage medium
By standardizing and expanding the surface of the alien celestial bodies, a model of the alien celestial body's surface is generated, which solves the problems of high cost and resource redundancy in manual modeling in existing technologies, and realizes efficient and automated construction of alien celestial bodies and a smooth gaming experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-01
- Publication Date
- 2026-03-10
AI Technical Summary
Existing technologies for constructing alien celestial bodies suffer from problems such as high manual modeling costs, long iteration cycles, high resource consumption, difficulty in optimization, and complex maintenance. Furthermore, alien celestial body models are prone to issues such as misaligned seams and inconsistent gravity in game engines.
By performing pre-standardization on the basic shape model of the target celestial body, a convex polyhedron model is generated. After pre-expansion processing, the height map of the intermediate geometric model is obtained, vertex coordinate mapping is performed, and a surface model of the irregular celestial body is generated. Combined with spatial division and gravity direction calculation, the irregular celestial body is automatically constructed.
It achieves automated generation of alien celestial bodies, reduces the cost of art asset production, improves the consistency of model generation and visual effects, supports a smooth gaming experience, and reduces development cycle and resource consumption.
Smart Images

Figure CN121639931A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of game development technology, and more specifically, to a method, apparatus, electronic device, and storage medium for generating alien celestial bodies. Background Technology
[0002] In science fiction video games or virtual universe applications, developers often aim to create uniquely shaped, non-spherical celestial environments to enhance visual impact and exploration. These include tetrahedral planets, diamond-shaped celestial bodies, cubic planets, and even cylindrical space stations. These celestial bodies defy the physical law that gravity causes celestial bodies to tend towards a spherical shape, thus satisfying users' desire for an immersive experience in a fantasy world.
[0003] In existing technical solutions, the construction of such alien celestial bodies typically relies on manual modeling and regional design by artists. Specifically, the development team needs to divide the target celestial body into multiple independent terrain regions (for example, dividing a tetrahedron into four triangular faces), create terrain meshes and texture resources for each region, and additionally set game logic parameters such as gravity direction and camera orientation for each region. Finally, the models are assembled into a complete celestial body model by manual splicing, which has high labor costs and a long iteration cycle. Summary of the Invention
[0004] In view of this, the purpose of the present invention is to provide a method, apparatus, electronic device and storage medium for generating alien celestial bodies.
[0005] To achieve the above objectives, the technical solutions adopted in the embodiments of the present invention are as follows: In a first aspect, the present invention provides a method for generating alien celestial bodies, the method comprising: The basic shape model of the target celestial body in the game world is pre-standardized to obtain a convex polyhedron model; The convex polyhedron model is subjected to a pre-defined dilation process to obtain an intermediate geometric model; Obtain the height map of the intermediate geometric model, and perform vertex coordinate mapping on the convex polyhedron model based on the height map of the intermediate geometric model to obtain the surface model of the irregular celestial body; Based on the aforementioned alien celestial body surface model, the target celestial body is rendered in the game world.
[0006] Optionally, the step of performing a pre-defined standardization process on the basic shape model of the target celestial body in the game world to obtain a convex polyhedron model includes: Extract the outermost vertex set of the basic shape model and construct a non-concave three-dimensional convex polyhedron; Calculate the minimum bounding box of the three-dimensional convex polyhedron, and obtain the center coordinates and half-length vector of the three-dimensional convex polyhedron; Based on the center coordinates and the half-length vector, each first vertex of the three-dimensional convex polyhedron is translated and scaled to obtain the convex polyhedron model.
[0007] Optionally, the step of performing a preset dilation process on the convex polyhedron model to obtain a geometric intermediate model includes: A capsule-shaped structure is constructed at the edge of the convex polyhedron model; Each plane of the convex polyhedron model is translated outward by a preset distance along the normal vector direction of the capsule body to obtain the offset plane corresponding to each plane, where the preset distance is the radius of the capsule body; The spatial envelope formed by the capsule body and all the offset planes is used as the intermediate geometric model.
[0008] Optionally, the step of obtaining the height map of the intermediate geometric model includes: The six faces of the outer cube of the aforementioned intermediate geometric model are used as projection planes; For each projection surface, a preset number of second vertices are uniformly sampled on the projection surface, and rays are emitted from each second vertex to the origin of the geometric intermediate model. The intersection of the ray and the geometric intermediate model is detected, and the distance from the intersection to the origin is taken as the height value to obtain the height map corresponding to the projection surface. The height map of the geometric intermediate model includes the height map corresponding to each projection surface.
[0009] Optionally, the height map of the intermediate geometric model includes six height maps corresponding to different projection planes, and the step of mapping vertex coordinates of the convex polyhedron model based on the height map of the intermediate geometric model includes: For each third vertex in the convex polyhedron model, the coordinates of the third vertex are normalized to a unit vector; The projection plane corresponding to the third vertex is determined based on the component with the largest absolute value in the unit vector. Based on the projection plane corresponding to the third vertex, determine the target height map that the third vertex should query; Using the components of the unit vector other than the one with the largest absolute value, the target is located in the height map, and the new coordinates of the third vertex are set according to the height value of the location.
[0010] Optionally, the method further includes: Based on the spatial division rules of the convex polyhedron model, the spatial type of the target object in the game world is determined according to its spatial location. Calculate the local gravity direction vector at the spatial location based on the space type; The vertical orientation of the target object on the target celestial body is determined based on the local gravity direction vector.
[0011] Optionally, the step of determining the spatial type of the spatial location based on the spatial partitioning rules of the convex polyhedron model includes: Determine whether the spatial position lies within any plane of the convex polyhedron model; If the spatial location is located within any plane of the convex polyhedron model, then the spatial type of the spatial location is determined to be planar space. If the spatial position is not located in any plane of the convex polyhedron model, then determine whether the spatial position is located on any edge of the convex polyhedron model; If the spatial location is located on any edge of the convex polyhedron model, then the spatial type of the spatial location is determined to be edge space; If the spatial position is not located on any edge of the convex polyhedron model, then determine whether the spatial position passes through any vertex of the convex polyhedron model; If the spatial location passes through any vertex of the convex polyhedron model, then the spatial type of the spatial location is determined to be vertex space. If the spatial location does not pass through any vertex of the convex polyhedron model, then the spatial type of the spatial location is determined to be an interior space.
[0012] Secondly, the present invention provides an apparatus for generating alien celestial bodies, the apparatus comprising: The processing module is used to perform a preset standardization process on the basic shape model of the target celestial body in the game world to obtain a convex polyhedron model; perform a preset dilation process on the convex polyhedron model to obtain a geometric intermediate model; obtain the height map of the geometric intermediate model, and perform vertex coordinate mapping on the convex polyhedron model based on the height map of the geometric intermediate model to obtain a surface model of the irregular celestial body. The rendering module is used to render the target celestial body in the game world based on the surface model of the alien celestial body.
[0013] Thirdly, the present invention provides an electronic device including a processor and a memory, wherein the memory stores machine-executable instructions that can be executed by the processor, and the processor can execute the machine-executable instructions to implement the alien celestial body generation method described in any of the foregoing embodiments.
[0014] Fourthly, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the alien celestial body generation method as described in any of the foregoing embodiments.
[0015] The method, apparatus, electronic device, and computer-readable storage medium for generating irregular celestial bodies provided in this invention involve: performing a pre-standardized processing on the basic shape model of the target celestial body in the game world to obtain a convex polyhedron model; performing a pre-expansion processing on the convex polyhedron model to obtain a geometric intermediate model; obtaining the height map of the geometric intermediate model and performing vertex coordinate mapping on the convex polyhedron model based on the height map of the geometric intermediate model to obtain an irregular celestial body surface model; and rendering the target celestial body in the game world based on the irregular celestial body surface model. Because the embodiments of the present invention standardize the basic shape model of the target celestial body into a convex polyhedron, and then perform dilation processing on it to generate a smooth geometric intermediate model, and then construct a height map based on the model and map it to generate the final surface mesh, it realizes the automatic construction of continuous, natural and renderable irregular celestial body surface models from arbitrary polyhedral shapes. This avoids the problems of misaligned seams and inconsistent gravity caused by traditional manual splicing of multi-block terrain, reduces the production cost and maintenance complexity of art resources, and improves the consistency and automation of model generation. It makes the addition of new celestial bodies only require a small amount of configuration, and has good beneficial effects such as high generation efficiency, natural visual effects, and easy expansion and optimization.
[0016] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0017] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 This figure shows a schematic block diagram of an electronic device provided by an embodiment of the present invention; Figure 2 This illustration shows a flowchart of a method for generating alien celestial bodies according to an embodiment of the present invention. Figure 1 ; Figure 3 This invention provides an example of a rendering result of an alien celestial body according to an embodiment of the present invention. Figure 1 ; Figure 4 This invention provides an example of a rendering result of an alien celestial body according to an embodiment of the present invention. Figure 2 ; Figure 5 This invention provides an example of a rendering result of an alien celestial body according to an embodiment of the present invention. Figure 3 ; Figure 6 This invention provides an example of a rendering result of an alien celestial body according to an embodiment of the present invention. Figure 4 ; Figure 7 This invention provides an example of a rendering result of an alien celestial body according to an embodiment of the present invention. Figure 5 ; Figure 8 This illustration shows a flowchart of a method for generating alien celestial bodies according to an embodiment of the present invention. Figure 2 ; Figure 9 The diagram shows a functional block diagram of an alien celestial body generation device provided in an embodiment of the present invention.
[0019] Icons: 100 - Electronic device; 110 - Memory; 120 - Processor; 130 - Communication module; 200 - Alien celestial body generation device; 201 - Processing module; 202 - Rendering module. Detailed Implementation
[0020] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0021] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.
[0022] It should be noted that relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0023] Modeling and gravity simulation techniques for non-spherical or unconventional geometric celestial bodies, especially in game engines and virtual universe applications, primarily rely on manual design and segmented assembly. Existing techniques typically involve the following process: First, artists create multiple independent surface modules based on the design concept of the target celestial body (such as a cubic planet, tetrahedral planet, or other irregular structures); then, these modules are manually assembled according to a spatial layout, with each region having its own local coordinate system, terrain data, and physical rules such as gravity direction.
[0024] To support player movement and interaction on the surfaces of non-standard celestial bodies, developers often divide the entire celestial body into several "gravity domains" or "surface blocks," with each block having a pre-defined fixed gravity direction (usually perpendicular to the plane of that block). When a character enters a block, the system aligns their upper direction with the gravity direction of that area, thus achieving a basic walking experience. Some advanced implementations also combine normal mapping or local deformation techniques to enhance terrain detail.
[0025] However, this technical solution based on manual modeling and region division has many significant drawbacks: 1. Unnatural transitions: Geometric misalignment, texture breakage, or sudden changes in gravity direction are prone to occur at the seams between different surface modules, causing visual jumps or abnormal movements when the character crosses areas, which seriously affects the sense of immersion.
[0026] 2. Poor scalability: Each new alien celestial body shape requires a significant investment of manpower for model creation, region division, and logic configuration, resulting in long development cycles and high iteration costs.
[0027] 3. High resource consumption: Due to the lack of a unified data structure and generation mechanism, various celestial bodies need to store a large number of independent resources (such as multiple sets of terrain meshes, materials, collision bodies and gravity configuration files), resulting in package expansion and increased runtime memory pressure.
[0028] 4. Difficult to optimize: Each celestial body is processed using a customized approach, making it impossible to apply general LOD (Level of Detail) strategies, streaming loading mechanisms, or physics calculation optimization algorithms, which limits the performance and real-time capabilities of large-scale irregular celestial body scenarios.
[0029] 5. Complex maintenance: As the number of celestial bodies increases, the logical branches and state management in the project expand rapidly, increasing the difficulty of testing and the probability of errors.
[0030] In summary, existing methods for constructing alien celestial bodies rely heavily on human intervention and lack automated, parameterized, and universal technical support, making it difficult to meet the demands of modern high-quality interactive virtual worlds for diverse, efficient, and consistent experiences.
[0031] Against this backdrop, embodiments of the present invention provide a method, apparatus, electronic device, and storage medium for generating alien celestial bodies, which will be described in detail below.
[0032] Please refer to Figure 1 This is a block diagram of an electronic device 100. The electronic device 100 includes a memory 110, a processor 120, and a communication module 130. The memory 110, processor 120, and communication module 130 are electrically connected to each other directly or indirectly to realize data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines.
[0033] The memory 110 is used to store programs or data. The memory 110 may be, but is not limited to, random access memory (RAM), read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), etc.
[0034] The processor 120 is used to read / write data or programs stored in the memory 110 and to perform corresponding functions.
[0035] The communication module 130 is used to establish a communication connection between the electronic device 100 and other communication terminals through the network, and to send and receive data through the network.
[0036] It should be understood that, Figure 1 The structure shown is only a schematic diagram of the electronic device 100. The electronic device 100 may also include components that are larger than... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown. Figure 1 The components shown can be implemented using hardware, software, or a combination thereof.
[0037] Please refer to Figure 2 The method for generating alien celestial bodies provided in this embodiment of the invention includes steps S101 to S104.
[0038] S101, the basic shape model of the target celestial body in the game world is pre-standardized to obtain a convex polyhedron model.
[0039] To achieve unified geometric mapping and gravity space division, the target celestial body's basic shape model (such as a regular tetrahedron, cylinder, diamond, etc.) input by the user must first be converted into a standard geometric representation that is structurally sound and mathematically analyzable.
[0040] In a possible implementation, step S101 can be implemented as follows: S101-1, extract the outermost vertex set of the basic shape model and construct a non-concave 3D convex polyhedron.
[0041] By invoking convex hull algorithms in 3D geometry processing, such as Quick Hull or Gift Wrapping, all vertices of the original basic shape model are processed to extract its outermost boundary point set, and a closed, non-concave 3D convex polyhedron is constructed. This process effectively eliminates local concavities, self-intersections, or multi-connected structures in the original model, ensuring that the final generated celestial body has good topological continuity and physical rationality.
[0042] S101-2, calculate the minimum bounding box of the 3D convex polyhedron, and obtain the center coordinates and half-length vector of the 3D convex polyhedron.
[0043] Based on the coordinates of all vertices of the convex polyhedron, its axis-aligned minimum bounding box is calculated. This bounding box defines the maximum extent of the convex polyhedron in the X, Y, and Z directions. The center coordinates C = (c_x, c_y, c_z) and the semi-length vector L = (l_x, l_y, l_z) of the bounding box are extracted from it, where each component is the distance from the center to the boundary along the corresponding axis.
[0044] S101-3, based on the center coordinates and the half-length vector, perform translation and scaling operations on each first vertex of the three-dimensional convex polyhedron to obtain the convex polyhedron model.
[0045] In this embodiment of the invention, each first vertex of the convex polyhedron model can be offset according to the center of the bounding box, and then each first vertex can be scaled according to the half-length of the bounding box. That is, the following transformation is performed on each first vertex V_i in the convex polyhedron: V'_i = (V_i – C) / L The division operation is a component-wise operation, which involves translating the vertices relative to the center of the bounding box and then normalizing them according to the half-length of each axis. After this processing, all first vertices are mapped to the model space [-1,1], forming a standardized convex polyhedron model at a uniform scale. This model serves as the reference geometry for subsequent dilation processing, height map generation, and gravity space partitioning, facilitating the reuse of algorithm parameters across celestial bodies of different sizes.
[0046] S102, perform a pre-defined dilation process on the convex polyhedron model to obtain an intermediate geometric model.
[0047] To make the generated surface of the alien celestial body more rounded and natural, and to avoid visual stiffness or abrupt motion caused by the sharp edges of the original polyhedron, this embodiment of the invention introduces a "model expansion" mechanism to soften the edges and vertex regions while preserving the overall geometric features.
[0048] In a possible implementation, step S102 can be implemented as follows: S102-1, construct a capsule on the edge of a convex polyhedron model.
[0049] For each edge of the convex polyhedron, a three-dimensional capsule with radius R is constructed, using its two endpoints as the upper and lower sphere centers of the capsule. This capsule is used to simulate the curvature transition effect of the edge region. R is called the expansion ratio, which can be adjusted according to actual needs (optionally R=0.06). Practical tests have verified that it can provide a sufficiently smooth edge transition while maintaining the polyhedron outline.
[0050] S102-2, each plane of the convex polyhedron model is translated outward by a preset distance along the normal vector direction of the capsule body to obtain the offset plane corresponding to each plane.
[0051] Each face (i.e., the polygonal plane) of a convex polyhedron is translated globally along its unit normal vector f{n} by a distance R (i.e., the radius of the capsule), generating a new parallel plane called the offset plane. This operation is equivalent to expanding the plane away from the origin, forming part of a smooth outer skin.
[0052] S102-3 uses the spatial envelope formed by all offset planes as a geometric intermediate model.
[0053] The closed geometry formed by taking the intersection of the spatial region enclosed by the capsule and all the translated offset planes is the intermediate geometric model. This model is essentially the result of morphological dilation of the original convex polyhedron, possessing both the overall shape characteristics of the original polyhedron and the smooth appearance of a sphere. Since the capsule implicitly participates in the curvature definition at its edges, this envelope automatically achieves edge and corner fusion, making it suitable as a source model for heightmap sampling.
[0054] S103, obtain the height map of the intermediate geometric model, and perform vertex coordinate mapping on the convex polyhedron model based on the height map of the intermediate geometric model to obtain the surface model of the irregular celestial body.
[0055] In a possible implementation, the process of "obtaining the height map of the intermediate geometric model" could be as follows: The six faces of the circumscribed cube of the intermediate geometric model are used as projection planes; for each projection plane, a predetermined number of second vertices are uniformly sampled on the projection plane, and rays are emitted from each second vertex towards the origin of the intermediate geometric model. The intersection points of the rays and the intermediate geometric model are detected, and the distance from the intersection point to the origin is taken as the height value, thus obtaining the height map corresponding to the projection plane. Understandably, the height map of the intermediate geometric model includes the height map corresponding to each projection plane.
[0056] In other words, by using the six faces (±X, ±Y, ±Z) of the circumscribed cube of a unit sphere with a radius of 1 as six projection planes; and uniformly distributing M on each projection plane... M sampling points (second vertices), where M is the height map resolution; for each sampling point P, its position vector is normalized and then extended in the reverse direction (i.e., from the point to the origin) to emit a ray, and the first intersection point Q with the geometric intermediate model is detected; the distance h from the intersection point Q to the origin is calculated, and this value is used as the height value of the pixel position and stored in a grayscale image; finally, six independent height maps are generated, corresponding to the six faces of the cube, which are collectively referred to as the height map set of the geometric intermediate model.
[0057] For example, the height map resolution M can be 513, and the height value is stored using 16-bit floating-point numbers. The data size of a single height map is about 3MB, which can maintain sufficient surface smoothness and detail accuracy even when the maximum celestial body radius reaches 10,000 units.
[0058] Furthermore, the implementation process of "mapping vertex coordinates of a convex polyhedron model based on the height map of the intermediate geometric model to obtain a surface model of an irregular celestial body" can be as follows: For each third vertex in the convex polyhedron model, normalize the coordinates of the third vertex into a unit vector; determine the projection plane corresponding to the third vertex based on the component with the largest absolute value in the unit vector; determine the target height map to be queried for the third vertex based on the projection plane corresponding to the third vertex; use the other components in the unit vector except for the component with the largest absolute value to locate the third vertex in the target height map, and set the new coordinates of the third vertex based on the height value at the location.
[0059] In other words, for each vertex V (the third vertex) to be mapped in the original convex polyhedron model, perform the following operations: normalize the coordinates of V to a unit vector Q; analyze the absolute values of the three components of the unit vector Q, find the largest one (e.g., Q_z is the largest), and thus determine its projection plane (e.g., the +Z or -Z plane); based on the values of the other two components (e.g., Q_x, Q_y) in the interval [-1,1], map them to the texture coordinate system of the corresponding height map; use bilinear interpolation to read the height value h of the corresponding position from the target height map; reposition the original vertex as: V_new = Q*h.
[0060] After repeating the above process to map all third vertices, the resulting mesh is a preliminary model of the surface of the irregular celestial body. To further enrich the terrain details, procedural noise can be superimposed along the normal direction to realize landform features such as mountains and canyons.
[0061] S104 renders target celestial bodies in the game world based on the surface model of an alien celestial body.
[0062] The generated terrain model is imported into the game engine, and real-time rendering is performed using the material system, lighting model, and LOD mechanism. The rendering result is as follows: Figure 3 , Figure 4 , Figure 5 , Figure 6 as well as Figure 7 As shown in the image, this model can not only be used for visual presentation but also synchronously generate colliders for the physics engine, supporting functions such as character movement, vehicle driving, and ballistic simulation. Since the entire terrain is generated using a unified algorithm, there are no seams, thus seamlessly supporting cross-region movement and dynamic loading.
[0063] Please refer to Figure 8 The method for generating alien celestial bodies also includes steps S105 to S107.
[0064] S105, for the spatial location of the target object in the game world, determine the spatial type of the spatial location according to the spatial division rules of the convex polyhedron model.
[0065] To achieve an intuitive gravity sensing experience, differentiated gravity direction calculation strategies are needed for different spatial regions. Based on the aforementioned standardized convex polyhedron model, this invention divides the entire celestial space into four mutually exclusive types: planar space, edge space, vertex space, and interior space.
[0066] In a possible implementation, step S105 can be implemented as follows: S105-1, Determine whether the spatial position is located within any plane of the convex polyhedron model.
[0067] S105-2, If the spatial location is located in any plane of the convex polyhedron model, then the spatial type of the spatial location is planar space.
[0068] In this embodiment of the invention, if the spatial position P is located in the "front side space" of a certain surface, it is determined that the space type is a planar space. The "front side space" refers to a semi-open area jointly enclosed by multiple dividing planes defined by the surface itself and its adjacent sides. Let the equation of a plane be N*P+D=0, where the normal vector N points outward. After determining N, substitute the coordinates of any point on the plane into the expression to calculate D. When N*P+D>=0, the spatial position P is considered to belong to the positive and negative space of the plane.
[0069] S105-3, if the spatial position is not located in any plane of the convex polyhedron model, then determine whether the spatial position is located on any edge of the convex polyhedron model.
[0070] S105-4 If the spatial location is located on any edge of the convex polyhedron model, then the spatial type of the spatial location is determined as edge space.
[0071] In the embodiments of the invention, if the spatial location P does not belong to any planar space, but is located within the "edge influence domain" of a certain edge, it is determined that the spatial type is edge space.
[0072] The edge influence domain is defined by two parts: two angular planes (A1, A2) passing through the edge and related to the normal vectors of the two adjacent faces, with their normals pointing outwards from the angle between the two faces; and two truncating planes (B1, B2) perpendicular to the edge and passing through its two endpoints, limiting the extension of the influence domain along the edge direction. When the spatial position P satisfies the positive and negative conditions of these four planes, it falls into the edge space.
[0073] S105-5, If the spatial position is not located on any edge of the convex polyhedron model, then determine whether the spatial position passes through any vertex of the convex polyhedron model.
[0074] S105-6 If the spatial location passes through any vertex of the convex polyhedron model, then the spatial type of the spatial location is determined to be vertex space.
[0075] In this embodiment of the invention, if a spatial position P does not belong to the first two types of spaces but is within the influence range of a vertex, it is determined to be a vertex space. The vertex influence domain is enclosed by several planes (A1…An) passing through the vertex and perpendicular to the connected edges, with their normals pointing in the opposite direction of each edge. If the spatial position P is located on the positive side of these planes, it belongs to that vertex space.
[0076] S105-7 If the spatial location does not pass through any vertex of the convex polyhedron model, then the spatial type of the spatial location is determined to be interior space.
[0077] If none of the above three conditions are met, then the spatial location P is classified as internal space, that is, it is located in the core region of the celestial body and has not yet approached any surface structure.
[0078] This hierarchical judgment order prioritizes the external structure (plane → edge → vertex) and finally considers the internal space, ensuring that the classification is complete and unambiguous.
[0079] S106, Calculate the local gravity direction vector at the spatial location based on the spatial type.
[0080] In this embodiment of the invention, a corresponding gravity direction calculation strategy is adopted according to different space types.
[0081] In planar space, the direction of gravity f{g} is the opposite direction of the unit normal vector of the current plane, so that the character always "stands vertically" on the current plane.
[0082] For the edge space, the direction of gravity is a unit vector pointing from the spatial position P to the foot of its perpendicular on the corresponding edge, realizing a converging attraction along the edge direction.
[0083] For vertex space, the direction of gravity is a unit vector pointing from spatial position P to the coordinates of the vertex, which can realize a radial gravity field centered on the vertex.
[0084] For the internal space, the direction of gravity is a unit vector pointing from the spatial position P to the origin of the convex polyhedron model, ensuring that even when going deep into the interior of the celestial body, the character still has a clear "downward" perception.
[0085] All gravity directions are unit vectors, which makes them easy to use directly for coordinate system alignment and physics updates.
[0086] S107, determine the vertical direction of the target object on the target celestial body based on the local gravity direction vector.
[0087] By applying the calculated local gravity direction vector to the game logic, the "up" direction of the character controller can be adjusted to automatically conform to the current ground; the camera's attitude can be controlled to prevent inversion or tilting; the direction of objects falling, rolling, or sliding can be driven; and the suspension and flight control systems of vehicles can be affected. Players can achieve a smooth and natural movement and interaction experience on the surface of any complex-shaped alien celestial body without the need for manual configuration of regional gravity parameters, significantly improving development efficiency and user experience consistency.
[0088] In summary, the embodiments of the present invention construct a complete, efficient, and scalable system for generating irregular celestial bodies by combining standardized modeling, geometric expansion, height map mapping, and layered spatial gravity calculation. This solves the problems of relying on manual splicing, resource redundancy, and maintenance difficulties in existing technologies, and has significant technological progress and industrial application value.
[0089] To perform the corresponding steps in the above embodiments and various possible methods, an implementation of the alien celestial body generation device 200 is given below. Further, please refer to... Figure 9 , Figure 9 This is a functional block diagram of an alien celestial body generation device 200 provided in an embodiment of the present invention. It should be noted that the basic principle and technical effects of the alien celestial body generation device 200 provided in this embodiment are the same as those in the above embodiments. For the sake of brevity, any parts not mentioned in this embodiment can be referred to the corresponding content in the above embodiments. The alien celestial body generation device 200 includes: The processing module 201 is used to perform preset standardization processing on the basic shape model of the target celestial body in the game world to obtain a convex polyhedron model; perform preset dilation processing on the convex polyhedron model to obtain a geometric intermediate model; obtain the height map of the geometric intermediate model, and perform vertex coordinate mapping on the convex polyhedron model based on the height map of the geometric intermediate model to obtain the surface model of the irregular celestial body.
[0090] Rendering module 202 is used to render the target celestial body in the game world based on the surface model of the alien celestial body.
[0091] Optionally, the above modules can be stored in the form of software or firmware. Figure 1 The memory 110 shown is either stored in or embedded in the operating system (OS) of the electronic device 100, and can be used by... Figure 1 The processor 120 executes the program. Meanwhile, the data and program code required to execute the above modules can be stored in the memory 110.
[0092] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative; for example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0093] In addition, the functional modules in the various embodiments of the present invention can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0094] If the aforementioned functions are implemented as software functional modules 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 invention, essentially, 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, electronic device 100, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0095] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method of generating a celestial body, characterized by, The method comprises: performing preset standardization processing on a basic shape model of a target celestial body in a game world to obtain a convex polyhedron model; performing preset inflation processing on the convex polyhedron model to obtain a geometric intermediate model; obtaining a height map of the geometric intermediate model, and performing vertex coordinate mapping on the convex polyhedron model based on the height map of the geometric intermediate model to obtain a special celestial body ground surface model; based on the special celestial body ground surface model, rendering the target celestial body in the game world.
2. The anisotropic celestial body generation method according to claim 1, wherein The step of performing preset standardization processing on a basic shape model of a target celestial body in a game world to obtain a convex polyhedron model comprises: extracting a set of outermost vertices of the basic shape model to construct a three-dimensional convex polyhedron without recesses; calculating the minimum bounding box of the three-dimensional convex polyhedron to obtain the center coordinates and half-length vector of the three-dimensional convex polyhedron; performing translation and scaling operations on each first vertex of the three-dimensional convex polyhedron based on the center coordinates and the half-length vector to obtain the convex polyhedron model.
3. The anisotropic celestial body generation method according to claim 1, wherein The step of performing preset inflation processing on the convex polyhedron model to obtain a geometric intermediate model comprises: constructing a capsule on the edge of the convex polyhedron model; translating each plane of the convex polyhedron model outward along the normal vector direction of the capsule by a preset distance to obtain an offset plane corresponding to each plane, the preset distance being the radius of the capsule; regarding the space envelope formed by the capsule and all the offset planes as the geometric intermediate model.
4. The anisotropic celestial body generation method according to claim 1, wherein The step of obtaining a height map of the geometric intermediate model comprises: regarding the six faces of the circumscribed cube of the geometric intermediate model as projection faces; for each projection face, uniformly sampling a preset number of second vertices on the projection face, and emitting a ray from each second vertex to the origin of the geometric intermediate model, detecting the intersection point of the ray and the geometric intermediate model, and taking the distance from the intersection point to the origin as the height value to obtain the height map corresponding to the projection face; the height map of the geometric intermediate model comprises the height map corresponding to each projection face.
5. The anisotropic celestial body generation method according to claim 1, wherein The height map of the geometric intermediate model comprises six height maps corresponding to different projection faces, and the step of performing vertex coordinate mapping on the convex polyhedron model based on the height map of the geometric intermediate model comprises: for each third vertex in the convex polyhedron model, normalizing the coordinates of the third vertex to a unit vector; determining the projection face corresponding to the third vertex according to the component with the maximum absolute value in the unit vector; determining the target height map to be queried by the third vertex according to the projection face corresponding to the third vertex; using the components other than the component with the maximum absolute value in the unit vector to locate in the target height map, and setting the new coordinates of the third vertex according to the height value at the location.
6. The anisotropic celestial body generation method according to claim 1, wherein The method further comprises: determining the space type of the space position of the target object in the game world according to the space division rule of the convex polyhedron model; calculating the local gravity direction vector of the space position according to the space type; According to the local gravity direction vector, a top-bottom direction of the target object on the target celestial body is determined.
7. The anisotropic celestial body generation method according to claim 6, wherein The step of determining the space type of the space position according to the space division rule of the convex polyhedron model comprises: judging whether the space position is located in any plane of the convex polyhedron model; if the space position is located in any plane of the convex polyhedron model, determining that the space type of the space position is a plane space; if the space position is not located in any plane of the convex polyhedron model, judging whether the space position is located on any edge of the convex polyhedron model; if the space position is located on any edge of the convex polyhedron model, determining that the space type of the space position is an edge space; if the space position is not located on any edge of the convex polyhedron model, judging whether the space position passes through any vertex of the convex polyhedron model; if the space position passes through any vertex of the convex polyhedron model, determining that the space type of the space position is a vertex space; if the space position does not pass through any vertex of the convex polyhedron model, determining that the space type of the space position is an internal space.
8. A strange object generating apparatus characterized by comprising: The device comprises: a processing module configured to perform a preset standardization process on a basic shape model of a target celestial body in a game world to obtain a convex polyhedron model, perform a preset inflation process on the convex polyhedron model to obtain a geometric intermediate model, obtain a height map of the geometric intermediate model, and perform vertex coordinate mapping on the convex polyhedron model based on the height map of the geometric intermediate model to obtain a special celestial body ground surface model; a rendering module configured to render the target celestial body in the game world based on the special celestial body ground surface model.
9. An electronic device, comprising: The device comprises a processor and a memory, the memory stores machine executable instructions which can be executed by the processor, and the processor can execute the machine executable instructions to implement the special celestial body generation method of any one of claims 1-7.
10. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the special celestial body generation method of any one of claims 1-7.