A GPU-instantiated scatter decoration field and deterministic instance-by-instance variation method
By attaching scatter field specifications to arbitrary entities, the initial and aligning scattering points of decorations are determined, and instance-by-instance changes are driven by integer seeds. This solves several problems in decoration placement in the prior art and achieves decoration field generation with no code execution, ground alignment, and deterministic changes.
Patent Information
- Application Number
- CN202611440926.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-16
- Publication Date
- 2026-11-17
AI Technical Summary
Existing technologies for decorative placement suffer from several problems, including reliance on runtime code or editor creation, exponential cost of per-entity generation, artificial-looking instance cloning, randomness and uncertainty, temporary patching of ground adhesion and sprinkling, failure of whole-area color changing during runtime, and the fact that the spreading capability is fixed to specific consumer ends.
By attaching scatter field specifications to any entity, including the instantiated mesh, instance count, scatter distribution, ground label, per-instance field, and integer seed, the initial scatter position and the attached scatter position of the instance are determined, and the per-instance variation parameters are determined based on the per-instance field and integer seed, thus constructing multi-mesh instance nodes.
It enables creation without runtime code or editor, avoids cost explosion, ensures that decorations fit the ground and have deterministic changes, supports recoloring of the entire decorative field, and solves several shortcomings of existing technologies.
Smart Images

Figure CN123118972A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of 3D scene rendering and AI-generated game content technology, specifically to a GPU-instantiated scatter decoration field and deterministic instance-by-instance variation method. Background Technology
[0002] Decorative density is crucial for the overall richness and believability of most 3D scenes, and it's also one of the most easily abandoned aspects in AI-generated games. It's impossible to write the coordinates for manually placing tens of thousands of objects, nor is it maintainable. Placing thousands of decorations in traditional engines inevitably relies on instantiation APIs and placement scripts, both of which require runtime code, conflicting with no-code execution architectures. Building nodes per object is too cumbersome. If we resort to generating N independent entities for the scene, each entity having its own transformation, scene node, and logic update per frame, then a few hundred is the practical limit; placing ten thousand blades of grass would instantly exhaust the entity budget and drag down the frame rate. Tens of thousands of copies of the same mesh inevitably look artificial, and arbitrarily adding randomness cannot guarantee that the same scene will look identical every time it loads, nor can the per-instance randomness be read in the shader. Therefore, any movement of grass would only result in synchronized swaying across the entire scene. For decorations to fall to the ground rather than floating in the air or clipping through objects, they need to be projected downwards instance by instance and attached to the collision surface. However, a grassy field often has buildings, foundations, and column bases underneath simultaneously. Unfiltered projection will cause grass to climb onto rooftops and column heads. Traditionally, different types of scattering points—scattering in a disc, a rectangle, a sphere, or along a path—have their own separate loops, lacking a unified, verifiable, and reproducible vocabulary for scattering points. Changing the overall color of a GPU-instantiated decoration field at runtime can be achieved by writing a single material color binding for ordinary mesh entities. However, for GPU-instantiated fields, whose scene nodes are multi-mesh instance nodes rather than ordinary mesh instance nodes, existing material push searches cannot find them, and there are no writable runtime materials on the host entity. Therefore, color writing becomes silent and ineffective.
[0003] Regarding the above issues, the closest existing solutions include the following: Unity provides batch rendering with Graphics.DrawMeshInstanced, Graphics.DrawMeshInstancedIndirect, and DOTS. Developers must write C# scripts to construct the matrix for each instance and submit it every frame, which is a new instruction stream executed at runtime. Unreal's vegetation tool and Hierarchical Instanced Static Mesh (HISM) component can efficiently instantiate a large number of static meshes, but the vegetation tool is a brush-and-paste creation capability within the editor. Artificial intelligence cannot operate the editor, and runtime procedural placement still requires Blueprints or C++ to call the HISM component's AddInstance API, which is a new instruction stream added at runtime. Offline scattering tools (such as Houdini's scattering node network or copying node network) allow developers to use node networks to scatter points on a surface, randomly transform each point, instantiate geometry, and then bake and export it in professional tools. However, the construction process remains in the offline tool, and the runtime engine only receives the baked dead scene. Artificial intelligence cannot generate new scattering fields on the spot. If the evaluation of such node networks is brought into the runtime, it is essentially a new instruction stream executed at runtime. Two common degradation approaches in general-purpose engines are: First, the scattering capability is soldered into the terrain generation component, which can only scatter on the ground generated by the terrain generation component itself, only accepts external model files, does not fill in per-instance random data, and cannot scatter on a normal floor or arbitrary curved surface; Second, it directly uses "generate N independent entities" to spread the field, with each entity updating its own node and logic, reaching a limit of a few hundred. Alternatively, the engine can use scripts to call the GPU instantiation API to fill the instance matrix one by one, or the scattering capability can be soldered into the terrain component to serve only the terrain.
[0004] The existing technology has the following drawbacks. First, the scattering relies on runtime code or editor creation: script calls to instantiation APIs are runtime-added instruction streams, which are non-compliant, and artificial intelligence requires code writing; editor-based scattering is a creative capability that artificial intelligence cannot operate; pure data and load-time-verifiable scattering field primitives are lacking. Second, the cost of per-entity generation is explosive: using "generating N live entities" to scatter the field, with each entity requiring a node and a logic update, reaches its limit after a few hundred, and scattering tens of thousands will inevitably lead to failure. Third, instance cloning appears fake, random, and uncertain: copying the same mesh tens of thousands of times without per-instance changes is like stamping; naive randomness is unreproducible and cannot be regressed; if the shader cannot read per-instance randomness, the entire field will swing synchronously. Fourth, ground adhesion and scattering points are temporary patchwork: unfiltered downward projection causes grass to climb onto roof pillars; scattering points such as discs, rectangles, spheres, and along paths each have their own loops, lacking declarable and reproducible closed-set vocabulary. Fifth, runtime full-area color changing fails: The nodes of the GPU instantiated field are multi-mesh instance nodes. There are runtime materials that cannot be found by pushing materials and there are no writable runtime materials on the host entity. A single color write is silent and ineffective. The correct one-time rendering architecture loses the runtime color changing that is easily available in ordinary meshes. Sixth, the scattering capability is welded to a specific consumer: Welded to the terrain, it can only scatter on its self-generated ground, only accept model files, and does not fill in per-instance data, so it cannot serve arbitrary entities and arbitrary geometry.
[0005] In summary, the existing technology has the following shortcomings in terms of decorative placement: any entity can be equipped with pure data scatter field specifications, zero new instruction streams during runtime, full verification during loading, deterministic instance-by-instance changes, declarable, verifiable and reproducible scattering terms, ground bonding filtered by semantic tags, reuse of unified geometric source slots in instantiated meshes, and symmetry between the entire area color change and ordinary meshes during runtime. Summary of the Invention
[0006] To address at least some of the technical problems in the prior art, this invention provides a method for GPU instantiation of scattered decoration fields and deterministic instance-by-instance variations. Specifically, this invention includes the following:
[0007] A first aspect of the present invention provides a method for GPU-instantiated scatter decoration fields and deterministic instance-by-instance variations, the specific technical solution of which includes: S1, attach a scatter field specification to any entity, wherein the scatter field specification includes at least: instantiated mesh, instance count, scatter distribution, ground label, per-instance field and integer seed; S2, based on the distribution of the scattered points, determine the initial scattered point positions of the instance count; based on the ground label, perform projection processing on the initial scattered point positions of each instance to obtain the fitting scattered point positions of each instance; S3, based on the fitting point position of each instance, and according to the instance-by-instance field and the integer seed, determine the instance-by-instance variation parameters of each instance in a preset extraction order; S4, construct a multi-mesh instance node based on the instance-by-instance variation parameters of each instance, and lay out the instance count of instances using the instantiated mesh.
[0008] The beneficial effects of the GPU-instantiated scatter decoration field and deterministic instance-by-instance variation method provided by this invention are as follows: By attaching a scatter field specification to any entity, including at least the instantiated mesh, instance count, scatter distribution, ground labels, per-instance fields, and an integer seed, this addresses the lack of scatter field primitives that rely on runtime code or editor creation for tiling and allow for data-driven validation during loading. This eliminates the need for runtime scripts to repeatedly call the instantiation interface or for manual tiling by the editor, resulting in zero new instruction streams at runtime. Furthermore, by determining the initial scatter position of the instance count based on the scatter distribution, it solves the problem of cost explosion and reaching the upper limit after a few hundred instances when tiling with N live entities. Finally, by projecting the initial scatter position of each instance based on the ground labels to obtain the matching scatter position of each instance, it resolves the issues of ground matching and scattering. The problem of temporary, unfiltered downward projection causing grass to climb onto rooftop pillars is addressed by ensuring that decorations only fall on designated ground and do not climb onto buildings above them. By determining the per-instance variation parameters of each instance based on the matching sprinkle point position of each instance, according to the per-instance field and integer seed in a preset extraction order, the problem of copying the same mesh tens of thousands of times without per-instance variation resulting in stamping, naive randomness, and unreproducibility / regression is solved. This ensures that per-instance variation is deterministically driven by the integer seed in a preset extraction order, ensuring byte-by-byte consistency within the same seed and scene, and enabling headless reproduction and regression. Furthermore, by constructing multi-mesh instance nodes based on the per-instance variation parameters of each instance and laying out an instance count using the instantiated mesh, the entire decoration field only requires one draw call.
[0009] Furthermore, the instantiated mesh includes at least one of parametric primitives, custom vertex meshes, procedurally generated meshes, external models, multi-mesh arrays, and multi-surface meshes.
[0010] Furthermore, before determining the initial placement positions of the instance count based on the placement distribution, the method further includes: During the loading period, the specifications of the scattering field are verified. If the verification is successful, the initial scattering positions of the instance count are determined based on the scattering distribution. If the verification fails, the loading period is rejected and the process does not proceed to the running period. The verification includes: the instantiated mesh can be parsed, the instance count is positive, the point distribution meets the preset distribution conditions, the ground label points to a known entity label, and the per-instance field meets the preset change conditions.
[0011] Furthermore, determining the initial placement positions of the instance counts based on the placement distribution specifically includes: The distribution of the scattered points refers to the distribution area, the distribution shape, and the distribution along the path; The distribution shape is a closed set enumeration, including two-dimensional shapes and three-dimensional shapes; the filling pattern of the distribution shape is random or uniform. When the filling pattern is uniform, the initial placement position of the instance count is determined based on the instance count; otherwise, the initial placement position of the instance count is deterministically calculated based on the integer seed. The path distribution includes: taking a number of sampling points along a named curve at uniform arc lengths or at fixed intervals, where the sampling points are the initial sampling locations.
[0012] Furthermore, the projection process based on the initial spraying position of each instance according to the ground label to obtain the fitting spraying position of each instance specifically includes: For each instance, a ray is projected from the initial scattering point position to a preset projection direction. The ray intersects with the collider carrying the ground tag to obtain a collision surface. The point where the ray intersects with the collision surface is taken as the collision surface hit point. The instance is attached to the height corresponding to the collision surface hit point, and the instance is tilted according to the collision surface normal to obtain the attachment scattering point position. Among them, the ray is projected in a preset projection direction and only accepts the collider carrying the ground tag; the ray passes through the other colliders. When the ground label is defaulted, the ray hits the first arbitrary collider; When the ground tag is unavailable, the ray cannot find an acceptable collider, and the initial scattering point position is the fitting scattering point position.
[0013] Furthermore, the per-instance fields include scaling, yaw, pitch, roll, coloring, and multiple random channels; The per-instance change parameters include per-instance transformation parameters, per-instance color parameters, and per-instance custom parameters for each instance; The step-by-step variation parameters for each instance are determined according to the per-instance field and the integer seed, following a preset extraction order, based on the location of the splicing point for each instance. Specifically, this includes: Based on the contact point position of each instance, instance transformation processing is performed on each instance according to the scaling, yaw, pitch and roll to obtain the instance-by-instance transformation parameters of each instance; Based on the dyeing, each instance is processed for instance color to obtain the instance-by-instance color parameters for each instance; Each instance is processed using multiple random channels to obtain instance-specific custom parameters for each instance. The integer seed is used to drive the instance transformation processing, the instance color processing, and the instance customization processing according to the preset extraction order, so that the instance-by-instance change parameters of the same seed and the same scene can be reproduced.
[0014] Furthermore, the specifications of the scattering field also include: material; During runtime, when a change to the material parameters is received, the changed material parameters are written to the multi-mesh instance node, so that the changed material parameters are applied to all instances laid out by the multi-mesh instance node, completing a re-dyeing of the entire decorative field.
[0015] In a second aspect, the present invention provides a GPU instantiation scatter decoration field and deterministic instance-by-instance variation system, the specific technical solution of which includes: a specification mounting module, a scattering point grounding module, a variation determination module, and a mesh construction module; The specification mounting module is used to mount a scattering field specification to any entity. The scattering field specification includes at least: instantiated mesh, instance count, scattering distribution, ground label, per-instance field, and integer seed. The ground-attaching dot module is used to determine the initial dot positions of a count of instances based on the dot distribution; and to project the initial dot positions of each instance based on the ground labels to obtain the attached dot positions of each instance. The change determination module is used to determine the instance-by-instance change parameters of each instance based on the fitting point position of each instance, according to the instance-by-instance field and the integer seed, and in a preset extraction order. The mesh construction module is used to construct multiple mesh instance nodes according to the instance-by-instance variation parameters of each instance, and to lay out the instance count of instances with the instantiated mesh.
[0016] Furthermore, the instantiated mesh includes at least one of parametric primitives, custom vertex meshes, procedurally generated meshes, external models, multi-mesh arrays, and multi-surface meshes.
[0017] Furthermore, before determining the initial placement positions of the instance count based on the placement distribution, the method further includes: During the loading period, the specifications of the scattering field are verified. If the verification is successful, the initial scattering positions of the instance count are determined based on the scattering distribution. If the verification fails, the loading period is rejected and the process does not proceed to the running period. The verification includes: the instantiated mesh can be parsed, the instance count is positive, the point distribution meets the preset distribution conditions, the ground label points to a known entity label, and the per-instance field meets the preset change conditions.
[0018] Furthermore, determining the initial placement positions of the instance counts based on the placement distribution specifically includes: The distribution of the scattered points refers to the distribution area, the distribution shape, and the distribution along the path; The distribution shape is a closed set enumeration, including two-dimensional shapes and three-dimensional shapes; the filling pattern of the distribution shape is random or uniform. When the filling pattern is uniform, the initial placement position of the instance count is determined based on the instance count; otherwise, the initial placement position of the instance count is deterministically calculated based on the integer seed. The path distribution includes: taking a number of sampling points along a named curve at uniform arc lengths or at fixed intervals, where the sampling points are the initial sampling locations.
[0019] Furthermore, the projection process based on the initial spraying position of each instance according to the ground label to obtain the fitting spraying position of each instance specifically includes: For each instance, a ray is projected from the initial scattering point position to a preset projection direction. The ray intersects with the collider carrying the ground tag to obtain a collision surface. The point where the ray intersects with the collision surface is taken as the collision surface hit point. The instance is attached to the height corresponding to the collision surface hit point, and the instance is tilted according to the collision surface normal to obtain the attachment scattering point position. Among them, the ray is projected in a preset projection direction and only accepts the collider carrying the ground tag; the ray passes through the other colliders. When the ground label is defaulted, the ray hits the first arbitrary collider; When the ground tag is unavailable, the ray cannot find an acceptable collider, and the initial scattering point position is the fitting scattering point position.
[0020] Furthermore, the per-instance fields include scaling, yaw, pitch, roll, coloring, and multiple random channels; The per-instance change parameters include per-instance transformation parameters, per-instance color parameters, and per-instance custom parameters for each instance; The step-by-step variation parameters for each instance are determined according to the per-instance field and the integer seed, following a preset extraction order, based on the location of the splicing point for each instance. Specifically, this includes: Based on the contact point position of each instance, instance transformation processing is performed on each instance according to the scaling, yaw, pitch and roll to obtain the instance-by-instance transformation parameters of each instance; Based on the dyeing, each instance is processed for instance color to obtain the instance-by-instance color parameters for each instance; Each instance is processed using multiple random channels to obtain instance-specific custom parameters for each instance. The integer seed is used to drive the instance transformation processing, the instance color processing, and the instance customization processing according to the preset extraction order, so that the instance-by-instance change parameters of the same seed and the same scene can be reproduced.
[0021] Furthermore, the specifications of the scattering field also include: material; During runtime, when a change to the material parameters is received, the changed material parameters are written to the multi-mesh instance node, so that the changed material parameters are applied to all instances laid out by the multi-mesh instance node, completing a re-dyeing of the entire decorative field.
[0022] A third aspect of the present invention provides a computer device including a processor coupled to a memory storing at least one computer program, the at least one computer program being loaded and executed by the processor to enable the computer device to perform any of the methods described above.
[0023] A fourth aspect of the present invention provides a computer-readable storage medium storing at least one computer program, the at least one computer program being loaded and executed by a processor to enable a computer to perform any of the methods described above.
[0024] It should be noted that the beneficial effects of the technical solutions of the second to fourth aspects of the present invention and their corresponding possible implementations can be found in the above description of the technical effects of the first aspect and its corresponding possible implementations, and will not be repeated here. Attached Figure Description
[0025] Figure 1 This is a schematic diagram of the overall architecture of a GPU instantiation scatter decoration field and deterministic instance-by-instance variation method according to an embodiment of the present invention; Figure 2 This is a schematic diagram of the structure of a computer device according to an embodiment of the present invention. Detailed Implementation
[0026] To make the objectives, technical solutions, and advantages of the present invention clearer, the embodiments of the present invention will be described in further detail below with reference to the accompanying drawings.
[0027] Figure 1 This is a schematic diagram of the overall methodology. It should be noted that... Figure 1 The components in this paper (such as the scatter field parsing verifier, the scatter point solver, etc.) are distinguished only by name and do not imply that the components must be physically or logically independent of each other. Each component can be fully or partially integrated into the same processing unit, or it can be split into multiple processing units. The names are used only for ease of understanding of this method and do not constitute a limitation on this method. An embodiment of this invention provides a GPU-instantiated scatter decoration field and deterministic instance-by-instance variation method, comprising the following steps: S1, attach a scatter field specification to any entity. The scatter field specification includes at least: instantiated mesh, instance count, scatter distribution, ground labels, per-instance field, and integer seed. The specific implementation is as follows.
[0028] Graphics Processing Unit (GPU) instantiation refers to drawing a large number of copies at a time using a single grid and instance-by-instance data.
[0029] An entity refers to an object in the scene that can be attached to a pure data distribution field. Once the decoration is placed, it will no longer be queried as an entity, will not occupy the entity budget, and will not be updated with logic every frame.
[0030] Distribution area specifications (corresponding) Figure 1 The "scatter field specification" in the document is a pure data mapping that can be attached to any entity. Any entity can attach a pure data scatter field visual component. Developers write a scatter field specification on the entity. The scatter field specification is a pure data description and does not contain any string-to-instruction or configuration-to-code conversion.
[0031] The mesh refers to the unit geometry instantiated and tiled by the GPU. The evaluation results are normalized to the same triangular mesh structure before being delivered as a multi-mesh. The instantiated mesh (field "mesh:") corresponds to... Figure 1 The "mesh" in the "scatter field specification" refers to the instantiated cell mesh, taken from the engine's unified geometry source slot (corresponding to...). Figure 1 (Referring to "unified geometry source slots" in the text). A geometry source slot refers to the unified polymorphic data slot from which the instantiated mesh originates. One slot corresponds to multiple consumers, and scattering is one of the consumers of a geometry source slot.
[0032] Instance count (field is "count:") Figure 1 The “count” in the text refers to the total number of instances, that is, the number of instances that are drawn in a single draw call.
[0033] Scattered distribution (corresponding) Figure 1 The “distribution” in the field refers to where the points are scattered, including the distribution area (field “area:”), the distribution shape (field “distribution:”), and the distribution along the path (field “along:”).
[0034] Ground tag (fields include: "align_to_ground: / align_normal: / ground_tag:", corresponding to...) Figure 1 The term "ground label" refers to the semantic entity label that is filtered and projected towards the preset projection direction. Semantic entity labels are non-exposed collision layer numbers. Ground labels share the same labeling system as collision filtering. This engine's Domain Specific Language (DSL) consistently uses label semantics rather than numerical values; therefore, the ground label name is used instead of the layer number. An example of the preset projection direction is downward; projecting towards the preset projection direction is downward projection.
[0035] Per-instance field (corresponding) Figure 1 The “change” in the text refers to deterministic, instance-by-instance transformations and colors, including scaling (field “scale:”), yaw (field “yaw:”), pitch (field “pitch:”), roll (field “roll:”), coloring (field “color:”), and multiple random channels (field “per_instance:”).
[0036] Integer seed (field is "seed:", corresponding to) Figure 1 The "seed" in this context refers to the deterministically driven integers that are randomly selected and applied to... Figure 1 The "scattering solver" and "deterministic per-instance changer" are used in this context. All random sampling refers to all quantities in the scattering field that require random values, including the initial scattering position and per-instance changes in random mode, all driven by an integer seed in a fixed sampling order. In the scattering solver, when the filling mode is random, the initial scattering position of a count of instances is deterministically calculated based on the integer seed. In the deterministic per-instance changer, the deterministic per-instance change of each instance is driven according to a preset sampling order, ensuring reproducibility of the same scene with the same seed.
[0037] In a preferred implementation, the instantiated mesh is not simply connected to a single primitive or model file, but rather reuses a unified polymorphic geometry source slot from the engine. Therefore, the instantiated mesh includes at least one of parametric primitives, custom vertex meshes, procedurally generated meshes, external models, multi-mesh arrays, and multi-surface meshes. Specifically, parametric primitives are tessellated on-the-spot by a primitive constructor, which refers to a component that tessellates parametric primitives into an instantiable mesh. Parametric primitives include concave faces, boxes, spheres, and cylinders. Custom vertex meshes are parsed into a mesh by a shared custom mesh reader, with vertex coordinates and triangle indices provided by the developer, along with optional UVs, normals, and shading enumerations; for example, a handcrafted blade of grass, petal, or leaf resembles a real plant more than a planar concave face, and provides the vertex shader with truly bendable geometry. Procedural mesh generation includes turning, L-system syntax growth, CSG Boolean operations, and noise displacement. The geometry source evaluator bakes a triangular mesh once using content hashing, then instantiates it on the GPU. Multiple instances share the same mesh, so a forest of thousands of L-system trees is created with a single baking and rendering operation, rather than thousands of generation operations or thousands of vertex arrays that AI cannot program. Turning refers to rotating a 2D contour around an axis to create a solid-of-revolution mesh. L-system syntax growth involves repeatedly replacing symbols using rewriting rules to generate branching structures, thus producing tree, grass, and vine branches and leaves. CSG Boolean operations construct solid geometry, using Boolean operations such as union, intersection, and difference to combine simple entities into complex ones. Noise displacement involves superimposing offsets generated by noise functions on mesh vertices, creating surface undulations and irregular details. External model references are on disk GLB or GLTF, which are 3D model file formats. When an instantiated mesh takes a multi-mesh array, a count of instances are randomly assigned to each mesh, with each mesh having its own internal multi-mesh, representing a mixed species at a time, such as a pine and oak mixed forest. When an instantiated mesh takes a multi-surface mesh, a mesh carries multiple surfaces, each with its own material, and is drawn in the same instance. For example, the brown trunk and the colored crown of a tree are drawn in the same instance, saving the need to split a two-color tree into two fields and then manually align them.
[0038] In one alternative, the instantiated mesh degenerates into simply accepting parametric primitives and external models, still falling within the essence of arbitrary entity mounting and pure data. In another alternative, the baking of procedurally generated meshes can be preheated on-the-fly or offline, and the output is still normalized to a GPU-instantiable triangular mesh.
[0039] This step allows any entity to instantiate a grid GPU into a complete decoration field on the spot with just a scatter field specification of pure data. It solves the problem that existing technologies rely on runtime code or editor creation for deployment. There are zero new instruction streams added at runtime, which complies with no-code execution architecture and app store compliance requirements.
[0040] S2, based on the distribution of the scattered dots, determine the initial scattered dot positions of a count of instances; project the initial scattered dot positions of each instance based on the ground tags to obtain the fitting scattered dot positions for each instance. The specific implementation method is as follows.
[0041] The distribution of points is expressed by a set of declarative, verifiable, and reproducible closed-set vocabularies. A closed-set enumeration means that the values are confined to a predetermined, statically encoded finite set during packaging; values outside this set are not accepted. Please continue reading. Figure 1 The location of the scattered points is obtained by a scattered point solver. The scattered point solver calculates the initial scattered point location for each instance in a deterministic manner based on the scattered point distribution, either randomly or uniformly, using an integer seed.
[0042] The decoration (referring to an instance, a specific form of the instance) should be grounded, not floating or clipping through. Therefore, please continue reading. Figure 1 Based on the initial spray point position, the instances are attached to the collider using the ground attacher to obtain the attachment spray point position for each instance.
[0043] In a preferred embodiment, before determining the initial scattering locations of the instance count based on the scattering distribution, the method further includes: during the loading phase, verifying the scattering field specifications; if the verification passes, proceeding to determine the initial scattering locations of the instance count based on the scattering distribution; if the verification fails, the loading phase is rejected, and the process does not proceed to the runtime phase. Please continue reading. Figure 1The scatter field specification is a closed set statically encoded during packaging, with zero additions during runtime. A scatter field parser verifies the entire scatter field specification during loading, assigning stable diagnostic codes to each. Verification includes: the instantiated mesh can be parsed, the instance count is positive, the scatter distribution meets preset distribution conditions, ground labels point to known entity labels, and the per-instance field meets preset change conditions. Specifically, the instantiated mesh can be parsed because the parametric primitive name is known, the index of the custom vertex mesh is valid, the parameters of the procedurally generated mesh are valid, and the external model exists. A positive instance count means the instance count is positive, and the number of random channels in the per-instance field is positive. In some specific implementations, the number of random channels does not exceed four, i.e., there is a four-random-channel upper limit. The scatter distribution meets preset distribution conditions because the distribution shape name belongs to the closed set enumeration, its necessary parameters are complete (e.g., the radius of a disk or sphere, the size of a rectangle, and the inner radius of a ring). Unknown shapes are rejected upon loading and do not silently degenerate into single points; distribution along a path must be named after a known curve. "Ground label pointing to a known entity label" means that the entity label pointed to by the ground label should be carried by a known blueprint; otherwise, an error message will be displayed. A blueprint refers to the source of an object that can carry an entity label. Since the matching relationship between the ground label and the entity label carried by a known blueprint can be statically determined during loading, the loading phase uses this to determine whether the entity label pointed to by the ground label is known. "Per-instance fields meeting preset change conditions" means that the scaling axis keys in the per-instance fields are valid. For example, when scaling, x, y, and z axes are valid, while w indicates an unknown scaling axis. The color format must be valid; for example, providing color endpoints or a color palette is valid, while missing endpoints or a color palette field indicates a distorted color. The angle ranges corresponding to yaw, pitch, and roll must be valid; for example, a minimum angle value greater than the maximum angle value or an angle value exceeding the allowed range is an illegal angle range.
[0044] Each illegal value is assigned a diagnostic code. If the distribution field specifications do not meet any of the above verification items, it will be rejected during the loading period and will not enter the operation period.
[0045] This preferred implementation scheme solves the problem of the lack of pure data and loadable periodicity verification scatter field primitives in the prior art.
[0046] In a preferred embodiment, the distribution of scattered points includes a distribution area, a distribution shape, and a distribution along a path. The distribution shape is a closed set enumeration, including two-dimensional and three-dimensional shapes. Two-dimensional shapes include disks (filled planar circles), rectangles, and rings (with inner radii), etc., while three-dimensional shapes include spherical shells and spherical volumes, etc. The distance from the anchor point to the spherical shell is equal to the radius, and the spherical volume is uniform in volume. Two-dimensional shapes are scattered on a local horizontal surface of the host, and three-dimensional shapes are written in three-axis coordinates. The host refers to any entity that carries the specifications of the scattering field.
[0047] The distribution shape can be filled using either random or uniform methods. Random filling is the default. When the filling mode is uniform, the initial placement of the instance count is determined based on the instance count. The uniform mode uses a Fibonacci lattice, which refers to a deterministic and uniformly distributed distribution with a golden angle spacing. For spheres, it uses inverse cosine latitude plus golden angle longitude; for rings, it uses evenly divided golden angles; and for disks, it uses sunflower or Vogel lattice, resulting in a deterministic and visually uniform distribution. In uniform mode, the sampled points appear visually uniform, do not cluster together at low counts, and the positions of the sampled points obtained from two calculations of the same distribution are identical. Otherwise, the initial placement of the instance count is deterministically determined based on an integer seed. In random filling mode, the entire placement process is deterministically driven by an integer seed, placing the instance count as a single point within a distribution area, thus ensuring byte-by-byte consistency within the same seed and scene. Deterministic evaluation refers to using an integer seed as input and calculating the initial scattering position according to a preset extraction order (or changing parameters for each instance), or calculating the scattering position in a uniform mode using pure geometric methods such as Fibonacci grid points, so that the same seed and the same scene are loaded twice, and the two devices are consistent byte by byte, and the two evaluation positions are completely consistent, which can be reproduced and regressed without head.
[0048] The path-based distribution includes: taking a number of sampling points along a named curve at uniform arc lengths or at fixed intervals, which serve as the initial sampling points. Each sampling point can be offset laterally and jittered. The lateral offset is derived from the lateral normal, with positive and negative signs selected. The ordinate is taken from the named curve, and the yaw of each instance can be aligned with the curve tangent, making it face the route direction, such as guardrails, streetlights, roadside trees, or checkpoint gates.
[0049] The aforementioned distribution shape and filling pattern are statically encoded closed sets during packaging. Verification occurs during loading; unknown distribution shapes are rejected upon loading, and non-static distributions degenerate into single points. This scattering distribution vocabulary serves both this scattering field visual component and the logic for solving its distribution shape and filling pattern is shared with the batch scattering of the generation action, ensuring consistent syntax across all locations. It is deterministically driven by integer seeds, and reproducible within the same seed and scene.
[0050] In one alternative, the distribution shape is augmented with three-dimensional shapes such as cones, tori, or box volumes. As long as the shape and fill are statically encoded into a closed set, loaded for verification, and rejected if unknown, this is considered an equivalent implementation. In another alternative, uniform fill is replaced with other low-discrepancy sequences, such as Halton or Sobol, instead of Fibonacci lattice points; determinism and visual uniformity are still required.
[0051] In a preferred embodiment, the initial spraying position of each instance is projected based on the ground tag to obtain the fitting spraying position for each instance. Specifically, this includes: projecting a ray from the initial spraying position to a preset projection direction for each instance; the ray intersects with the collider carrying the ground tag to form a collision surface; the intersection point of the ray and the collision surface is taken as the collision surface hit point; the instance is then attached to the height corresponding to the collision surface hit point, and tilted according to the collision surface normal to obtain the fitting spraying position. More specifically, a ray is projected from the initial spraying position to a preset projection direction (pointing downwards); the ray intersects with the collider carrying the ground tag to form a collision surface; the intersection point of the ray and the collision surface is taken as the collision surface hit point; the instance is attached to the height corresponding to the collision surface hit point, and tilted according to the collision surface normal, for example, grass following a slope, to obtain the fitting spraying position. Collision surface attachment and collision surface normal tilting are considered the same hit, and both are reused in a single projection.
[0052] When a meadow often has buildings, foundations, and column bases underneath, unfiltered projection will cause the grass to climb onto rooftops and column capitals. To address this, a ground-label filtering method is proposed. The scatter field specification declares a ground label, and projections in the preset projection direction only accept colliders carrying the ground label. The ray passes through other colliders and stops only on the designated ground, ensuring that decorations only land on the designated ground and do not climb onto buildings above it. When the ground label is defaulted, the ray hits the first arbitrary collider, which is an existing behavior and backward compatible. Backward compatibility means that adding new fields or default behaviors does not change existing behaviors. When the ground label is unavailable, the ray cannot find an acceptable collider, the instance remains at the host height, which is synonymous with a ground-hugging miss, and the initial scatter point position is the same as the ground-hugging scatter point position.
[0053] During loading inspection, a warning is given for ground tags pointing to areas without any known blueprint labels. When ground adhesion is closed, the entire spread field is laid flat at the host height.
[0054] In one alternative, ground labels are expanded into a multi-label list, attached to one of several ground labels, without altering the semantic nature of the labels rather than their numerical values. In another alternative, ground label filtering is performed by a collision surface normal angle threshold, ensuring instances only fall on surfaces with a slope less than the normal angle threshold.
[0055] This step involves declaring the distribution area, shape, and closed-set vocabulary along the path of the sprinkled points. This process is declarative, verifiable, and reproducible, solving the problems of ground adhesion, temporary splicing of sprinkled points, and unfiltered downward projection that causes grass to climb onto roof columns. It ensures that decorations only fall on the designated ground and do not climb onto the buildings above them.
[0056] S3, based on the fitting point position of each instance, determines the instance-by-instance variation parameters of each instance according to the instance-by-instance field and the integer seed, following a preset extraction order. The specific implementation method is as follows.
[0057] Multigrids natively store a complete 3×3 basis plus translation for each instance, with optional per-instance color. The scatter field exposes these degrees of freedom as a set of deterministic per-instance fields, making a scatter field read like a natural population rather than a clone of N meshes. The basis refers to the 3×3 transformation basis, and the translation refers to the displacement along the three coordinate axes, i.e., the position of the scatter point of each instance, which, together with the 3×3 basis, constitutes part of the per-instance transformation process. The per-instance transformation process consists of 12 floating-point operations, with 9 floating-point operations for the 3×3 basis and 3 floating-point operations for the translation. Please continue reading... Figure 1 Each instance is modified using a deterministic per-instance changer to determine the per-instance change parameters for each instance.
[0058] The per-instance fields include scaling, yaw, pitch, roll, coloring, and multiple random channels, meaning that the per-instance variation dimensions are the various dimensions contained in the per-instance fields.
[0059] Scaling refers to anisotropic scaling, which can be applied to a uniform range (same scaling factor for all axes) or to an independent range for each axis (i.e., scale:{x,y,z}), giving trees or rocks different heights and shapes. Axes without a given scaling value are scaled by a factor of 1, meaning that the axis retains its original size without being enlarged or reduced.
[0060] Three-axis rotation includes yaw, pitch, and roll, each taking an angle range to give the plant a natural tilt. Yaw refers to rotation about the vertical axis. With only yaw, a symmetrical instantiated mesh (e.g., an icosahedron) appears to have no rotation; pitch / roll is needed to differentiate the attitudes of each instance, preventing them from looking like they were stamped with the same seal. The three-axis rotation is synthesized into a basis in the inner-rotation Euler order of yaw, pitch, and roll, and then scaled. The inner-rotation Euler order basis synthesis means that yaw, pitch, and roll are synthesized in the order of yaw to pitch to roll, with each rotation revolving around its new coordinate axis after the rotation, to create a single basis. When compounded with tilting based on the collision surface normal, the normal frame replaces the vertical frame, and yaw, pitch, and roll are applied within the normal frame. The normal frame is referenced to the collision surface normal, and the vertical frame is referenced to the vertical direction.
[0061] Coloring refers to coloring instance by instance. Two color endpoints are taken (random interpolation is performed between each instance), or a color palette is taken (a color is randomly selected for each instance). The color calculated by processing the instance color is written into the instance color of the multi-mesh. The surface shader reads the color and multiplies it with the material color instance by instance, so that a forest canopy has light and dark levels instead of the whole field being a single color, and it coexists orthogonally with the field-level whole-field color change during runtime.
[0062] Multiple random channels refer to named per-instance random channels. Developers assign a numerical range to each of these channels, and the engine extracts a random value for each instance, packaging them into the per-instance custom data four channels of the multi-mesh according to the declaration order, for the vertex shader or fragment shader to read. This is precisely the per-instance randomness missing in the "wind blowing through grass, leaf shifting phase" feature. The shader reads the phase or height of each leaf, and the entire scene is no longer rigidly synchronized. The declaration order refers to the order in which the random channels are declared by the developer.
[0063] In addition, per-instance change processing also includes: multi-grid or multi-species mixed broadcasting, and instance counts of instances being randomly assigned to each entry in the grid array (same as "when the instantiated grid takes a multi-grid array" in S1).
[0064] The preset sampling order refers to a fixed sampling order that is predetermined. All random sampling is driven by an integer seed according to this fixed order. The random sampling corresponding to the newly added per-instance variation dimension is arranged after the original random sampling, and the sampling order remains fixed. The scatter field of the newly added per-instance variation dimension is not enabled, and the calculated result is consistent with the previous byte-by-byte result. Per-instance variation parameters refer to the per-instance transformation parameters, per-instance color parameters, and per-instance custom parameters obtained by evaluating each instance.
[0065] Therefore, scaling, yaw, pitch, and roll are used to perform per-instance transformation processing on each instance to determine per-instance transformation parameters, coloring is used to perform per-instance transformation processing on each instance to determine per-instance color parameters, and multiple random channels are used to perform per-instance transformation processing on each instance to determine per-instance custom parameters.
[0066] Based on the snap-in position of each instance, and according to the per-instance field and integer seed, the per-instance variation parameters of each instance are determined according to a preset extraction order. Specifically, this includes: performing instance transformation processing on each instance based on zoom, yaw, pitch, and roll according to the snap-in position of each instance to obtain the per-instance transformation parameters; performing instance color processing on each instance based on coloring to obtain the per-instance color parameters; and performing instance-specific processing on each instance based on multiple random channels to obtain the per-instance custom parameters. The per-instance variation processing includes: performing instance transformation processing on each instance, performing instance color processing on each instance, and performing instance-specific processing on each instance. Specifically, each instance uses its own locating point as the translation (i.e., landing point), and then determines its attitude and size according to scaling, yaw, pitch, and roll along three axes, thus obtaining per-instance transformation parameters; it determines its own color according to coloring, thus obtaining per-instance color parameters; and it extracts random values from multiple random channels and packages them to obtain per-instance custom parameters, so that each instance laid out by the same instantiated mesh is different in position, attitude, size, color, and randomness.
[0067] During the per-instance change processing, an integer seed is used to drive instance transformation processing, instance color processing, and instance customization processing according to a preset extraction order, making the per-instance change parameters of the same seed and the same scene reproducible. Specifically, determinism is achieved through a positive seed. All random extractions are driven by an integer seed of the scatter field specification. The random extractions corresponding to the newly added per-instance change dimensions are arranged after the original random extractions, and the extraction order remains fixed. Thus, a field with the new change dimension enabled obtains a stable layout for a given seed, while a field without the new dimension enabled is consistent with the old behavior byte by byte. This is neither the unreproducible randomness in offline tools nor the no-change synchronization of the entire field in a welded terrain, but a reproducible change that is consistent byte by byte between two loads of the same seed and the same scene. It can be asserted per-instance by headless unit testing, sampling several instances to assert that their transformations, colors, and custom data are different from each other, and the two evaluations are completely consistent.
[0068] It should be noted that "instance-by-instance transformation" refers to the processing of all deterministic deformations of an instance, while "instance transformation" describes the processing of an instance based on scaling, yaw, pitch, and roll. The two are different in terms of processing level.
[0069] In an alternative, the addition or removal of per-instance variation dimensions, such as adding per-instance UV offsets or per-instance material indexes, is still equivalent as long as it is still deterministically driven by a single integer seed in a fixed order; in some degenerate implementations of per-instance variation dimensions, the omission of one or more (e.g., only uniform scaling and yaw) still falls within the essence of deterministic per-instance variation and integer seed reproduction.
[0070] Through this step, instance-by-instance variation is deterministically driven by integer seeds in a preset extraction order, solving the problem that copying the same grid tens of thousands of times without instance-by-instance variation results in stamping, naive randomness that is unreproducible and cannot be regressed, making a field read as a natural population rather than a grid cloned N times.
[0071] S4: Based on the instance-by-instance changing parameters of each instance, construct multi-mesh instance nodes, and then lay out an instance count of instances using the instantiated mesh. The specific implementation is as follows.
[0072] A multi-mesh instance node refers to a node that hosts multiple meshes (corresponding to...). Figure 1The scene node is a "multi-mesh". The multi-mesh is configured to carry per-instance transformation parameters (i.e., 3×3 base plus translation, a total of 12 floating-point values), optional per-instance color parameters, and optional per-instance custom parameters (i.e., four random channels), and is populated with an instance count, then drawn all at once by the instance rendering pipeline. The per-instance transformation parameters, per-instance color parameters, and per-instance custom parameters for each instance are all populated into the multi-mesh, constructing a multi-mesh instance node (corresponding to...). Figure 1 The "multi-mesh instance node" in the context of the instantiated mesh is used to lay out a count of instances, which only takes up one draw call. When the instantiated mesh is taken from the multi-mesh array, each type of instantiated mesh is taken once, which is still far less than the tens of thousands of times per entity. No colliders are generated. Decorative items are only for decoration and do not participate in gameplay. Once placed, they are never queried as entities, do not occupy entity budgets, and are not updated with logic every frame.
[0073] In an alternative, the instantiation backend is a layered instantiation of static meshes for other engines or indirect batch rendering, with the output still being a single or per-mesh render call; on low-end platforms, it degenerates into several merged mesh batches, with the scatter field size and per-instance variation evaluation remaining unchanged.
[0074] For ordinary mesh entities, writing a single line of material color binding allows their surface to change color in real-time according to a game variable, driving all runtime recoloring and palette tweening in the engine. Scatter fields ensure that the same material color binding also applies to the scatter field, without adding any new DSL keywords; it simply brings existing material color fields to the nodes of the scatter field. Therefore, in a preferred implementation, the scatter field specification also includes: material (field "material:", corresponding to...) Figure 1 (The "material" in the text); During runtime, when a change to the material parameters is received, the changed material parameters are written to the multi-mesh instance nodes, so that the changed material parameters apply to all instances laid out by the multi-mesh instance nodes, completing a re-dyeing of the entire decorative field (corresponding to...). Figure 1(Referring to "runtime whole-area color change" in the context of scattering fields). Specifically, the material push lookup can locate the shader material of multi-mesh instance nodes. While the original lookup only probes down to ordinary mesh instance nodes, the scattering field's nodes are multi-mesh instance nodes, hence the initial return of null and write failure. The scattering field host entity has a runtime material component initialized by its scattering field specification material, making changing material parameters a recognizable writable field on the scattering field host entity, consistent with ordinary mesh entities. Changing material parameters follows the same shader material color uniform variable path already used by ordinary meshes, writing once to recolor all instances, symmetrical to ordinary meshes byte-by-byte. Changing material parameters can be driven by binding a game variable every frame, written once by the processor, or driven by tweening animation; all three are equivalent. When nothing is written, the scattering field renders its baked material as before. Changing material parameters does not change the per-instance variation parameters; per-instance coloring is the difference between instances determined at load time, while runtime whole-area color change is a field-level uniform variable; the two coexist orthogonally.
[0075] Field-level uniform variables such as material color or self-illumination are written to multi-mesh instance nodes, and the entire instance is recolored in one write. In an alternative, runtime color buffer rewriting is supported on an instance-by-instance basis. When the multi-mesh color buffer needs to be rewritten, it is listed as another capability in addition to field-level color changing. Color changing is driven by binding a game variable every frame, or by the processor writing it once, or by tweening animation. All three are equivalent.
[0076] This step ensures that the entire decoration field only requires one draw call, solving the problem of cost explosion and reaching the limit after a few hundred when using N live entities to fill the decoration field. The runtime color change of the entire field is symmetrical to that of ordinary meshes byte by byte, solving the problem of silent failure of runtime color change of the entire field instantiated by GPU.
[0077] Example 1: Imagine a rock field that can change with the seasons. The developer only needs to write a scattering field specification. The instantiated mesh is a low-poly rock, which can be a parametric primitive, a custom vertex mesh, or a noise displacement geometry source. The instance count is 3,000. The scattering distribution is a rectangular distribution area, the ground label is floor, and grounding is enabled so that the 3,000 stones only fall on the ground and do not climb onto the temple roof. In the deterministic per-instance change, the scaling is given independently by axis, and each of the three axes takes an interval to make the stones vary in height and size. Yaw, pitch, and roll each take an angle interval to make each stone face and tilt differently. The coloring takes two endpoints from ochre to gray to make each stone different in brightness. The integer seed is an integer to ensure that this rock field is loaded twice, consistent byte by byte on both devices, and regressible. The material is a material whose material parameters are bound to a seasonal game variable. So when autumn arrives, a single line of writing to change the material parameters will color the entire rock field to a warm color, which is byte by symmetrical to the ordinary mesh coloring method. The above totals about a hundred words, which can be used to create a natural, reproducible, and seasonally changing rock field of three thousand blocks, occupying only one rendering call. In contrast, traditional solutions either require three thousand coordinates plus block-by-block transformations that artificial intelligence simply cannot write, or an instantiated script executed at runtime that is non-compliant, or three thousand living entities that would be overwhelmed after a few hundred. If the instantiated grid is replaced with a grid array, namely two L-system trees of pine and oak, the same specification becomes a mixed forest, with each species baked once and each occupying one rendering call.
[0078] The beneficial effects of the GPU-instantiated scatter decoration field and deterministic instance-by-instance variation method provided by this invention are as follows: By attaching a scatter field specification to any entity, including at least the instantiated mesh, instance count, scatter distribution, ground labels, per-instance fields, and an integer seed, this addresses the lack of scatter field primitives that rely on runtime code or editor creation for tiling and allow for data-driven validation during loading. This eliminates the need for runtime scripts to repeatedly call the instantiation interface or for manual tiling by the editor, resulting in zero new instruction streams at runtime. Furthermore, by determining the initial scatter position of the instance count based on the scatter distribution, it solves the problem of cost explosion and reaching the upper limit after a few hundred instances when tiling with N live entities. Finally, by projecting the initial scatter position of each instance based on the ground labels to obtain the matching scatter position of each instance, it resolves the issues of ground matching and scattering. The problem of temporary, unfiltered downward projection causing grass to climb onto rooftop pillars is addressed by ensuring that decorations only fall on designated ground and do not climb onto buildings above them. By determining the per-instance variation parameters of each instance based on the matching sprinkle point position of each instance, according to the per-instance field and integer seed in a preset extraction order, the problem of copying the same mesh tens of thousands of times without per-instance variation resulting in stamping, naive randomness, and unreproducibility / regression is solved. This ensures that per-instance variation is deterministically driven by the integer seed in a preset extraction order, ensuring byte-by-byte consistency within the same seed and scene, and enabling headless reproduction and regression. Furthermore, by constructing multi-mesh instance nodes based on the per-instance variation parameters of each instance and laying out an instance count using the instantiated mesh, the entire decoration field only requires one draw call.
[0079] In the above embodiments, although the steps are numbered S1, S2, etc., they are only specific embodiments given by the present invention. Those skilled in the art can adjust the execution order of S1, S2, etc. according to the actual situation, and these situations are also within the protection scope of the present invention. It can be understood that in some embodiments, some or all of the above embodiments may be included.
[0080] Furthermore, the acquisition process of the data involved in this application follows the principles of legality, legitimacy, and necessity. Based on obtaining the explicit authorization and consent of the user, only the minimum necessary information required to achieve the purpose is collected, and data security protection obligations are fulfilled in accordance with the law.
[0081] This invention also provides a GPU-instantiated scatter decoration field and deterministic instance-by-instance variation system, the specific technical solution of which is as follows: a specification mounting module, a scattering point ground-attached module, a variation determination module, and a mesh construction module; The specification mounting module is used to mount a scatter field specification to any entity. The scatter field specification includes at least: instantiated mesh, instance count, scatter distribution, ground label, per-instance field, and integer seed. The ground-attached dot module is used to determine the initial dot positions of a certain number of instances based on the dot distribution; and to project the initial dot positions of each instance based on the ground labels to obtain the matching dot positions of each instance. The change determination module is used to determine the per-instance change parameters of each instance based on the fitting point position of each instance, according to the per-instance field and the integer seed, and in accordance with the preset extraction order. The mesh construction module is used to construct multiple mesh instance nodes based on the instance-by-instance variable parameters of each instance, so that the instantiated mesh can be used to lay out an instance count of instances.
[0082] It should be noted that the beneficial effects of the GPU-instantiated scatter decoration field and deterministic per-instance variation system provided in the above embodiments are the same as those of the GPU-instantiated scatter decoration field and deterministic per-instance variation method described above, and will not be repeated here. Furthermore, the system provided in the above embodiments is only illustrated by the division of the above functional modules. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the system can be divided into different functional modules according to the actual situation to complete all or part of the functions described above. In addition, the system and method embodiments provided in the above embodiments belong to the same concept, and their specific implementation process is detailed in the method embodiments, and will not be repeated here.
[0083] like Figure 2 As shown, an embodiment of the present invention provides a computer device 300, which includes a processor 320 coupled to a memory 310. The memory 310 stores at least one computer program 330, which is loaded and executed by the processor 320 to enable the computer device 300 to implement any of the above-described methods. Specifically: The computer device 300 can vary considerably due to differences in configuration or performance. It may include one or more processors 320 (Central Processing Units, CPUs) and one or more memories 310. The one or more memories 310 store at least one computer program 330, which is loaded and executed by the one or more processors 320 to enable the computer device 300 to implement the GPU-instantiated scatter decoration field and deterministic instance-by-instance variation method provided in the above embodiments. Of course, the computer device 300 may also have wired or wireless network interfaces, a keyboard, and input / output interfaces for input / output. The computer device 300 may also include other components for implementing device functions, which will not be elaborated here.
[0084] An embodiment of the present invention provides a computer-readable storage medium storing at least one computer program, which is loaded and executed by a processor to enable a computer to implement any of the above-described methods.
[0085] Alternatively, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CD-ROM), magnetic tape, a floppy disk, and an optical data storage device, etc.
[0086] In an exemplary embodiment, a computer program product or computer program is also provided, the computer program product or computer program 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 the processor executes the computer instructions, causing the computer device to perform any of the above-described GPU instantiation scattering decoration field and deterministic instance-by-instance variation methods.
[0087] It should be noted that the terms "first," "second," etc., used in the specification of this application are used to distinguish similar objects and do not imply a specific order or sequence. Where appropriate, the order of use for similar objects can be interchanged so that the embodiments of this application described herein can be implemented in an order other than that shown in the figures or description.
[0088] Those skilled in the art will recognize that this invention can be implemented as a system, method, or computer program product. Therefore, this disclosure can be specifically implemented in the following forms: it can be entirely hardware, entirely software (including firmware, resident software, microcode, etc.), or a combination of hardware and software, generally referred to herein as a "circuit," "module," or "system." Furthermore, in some embodiments, the invention can also be implemented as a computer program product contained in one or more computer-readable media, which includes computer-readable program code.
[0089] Any combination of one or more computer-readable media may be used. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in connection with an instruction execution system, apparatus, or device.
[0090] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.
Claims
1. A GPU instantiation scatter decoration field and deterministic per-instance variation method, comprising: include: S1, attach a scatter field specification to any entity, wherein the scatter field specification includes at least: instantiated mesh, instance count, scatter distribution, ground label, per-instance field and integer seed; S2, based on the distribution of the scattered points, determine the initial scattered point positions of the instance count; based on the ground label, perform projection processing on the initial scattered point positions of each instance to obtain the fitting scattered point positions of each instance; S3, based on the fitting point position of each instance, and according to the instance-by-instance field and the integer seed, determine the instance-by-instance variation parameters of each instance in a preset extraction order; S4, construct a multi-mesh instance node based on the instance-by-instance variation parameters of each instance, and lay out the instance count of instances using the instantiated mesh.
2. The method of claim 1, wherein, The instantiated mesh includes at least one of parametric primitives, custom vertex meshes, procedurally generated meshes, external models, multi-mesh arrays, and multi-surface meshes.
3. The method for GPU instantiation of scattered decoration fields and deterministic instance-by-instance changes according to claim 1, characterized in that, Before determining the initial point locations of the instance counts based on the point distribution, the method further includes: During the loading period, the specifications of the scattering field are verified. If the verification is successful, the initial scattering positions of the instance count are determined based on the scattering distribution. If the verification fails, the loading period is rejected and the process does not proceed to the running period. The verification includes: the instantiated mesh can be parsed, the instance count is positive, the point distribution meets the preset distribution conditions, the ground label points to a known entity label, and the per-instance field meets the preset change conditions.
4. The method for GPU instantiation of scattered decoration fields and deterministic instance-by-instance changes according to claim 1, characterized in that, The step of determining the initial placement positions of the instance counts based on the placement distribution specifically includes: The distribution of the scattered points refers to the distribution area, the distribution shape, and the distribution along the path; The distribution shape is a closed set enumeration, including two-dimensional shapes and three-dimensional shapes; the filling pattern of the distribution shape is random or uniform. When the filling pattern is uniform, the initial placement position of the instance count is determined based on the instance count; otherwise, the initial placement position of the instance count is deterministically calculated based on the integer seed. The path distribution includes: taking a number of sampling points along a named curve at uniform arc lengths or at fixed intervals, where the sampling points are the initial sampling locations.
5. The method for GPU instantiation of scattered decoration fields and deterministic instance-by-instance changes according to claim 1, characterized in that, The process of projecting the initial spraying position of each instance based on the ground label to obtain the fitting spraying position of each instance specifically includes: For each instance, a ray is projected from the initial scattering point position to a preset projection direction. The ray intersects with the collider carrying the ground tag to obtain a collision surface. The point where the ray intersects with the collision surface is taken as the collision surface hit point. The instance is attached to the height corresponding to the collision surface hit point, and the instance is tilted according to the collision surface normal to obtain the attachment scattering point position. Among them, the ray is projected in a preset projection direction and only accepts the collider carrying the ground tag; the ray passes through the other colliders. When the ground label is defaulted, the ray hits the first arbitrary collider; When the ground tag is unavailable, the ray cannot find an acceptable collider, and the initial scattering point position is the fitting scattering point position.
6. The method for GPU instantiation of scattered decoration fields and deterministic instance-by-instance changes according to claim 1, characterized in that, The per-instance fields include scaling, yaw, pitch, roll, coloring, and multiple random channels; The per-instance change parameters include per-instance transformation parameters, per-instance color parameters, and per-instance custom parameters for each instance; The step-by-step variation parameters for each instance are determined according to the per-instance field and the integer seed, following a preset extraction order, based on the location of the splicing point for each instance. Specifically, this includes: Based on the contact point position of each instance, instance transformation processing is performed on each instance according to the scaling, yaw, pitch and roll to obtain the instance-by-instance transformation parameters of each instance; Based on the dyeing, each instance is processed for instance color to obtain the instance-by-instance color parameters for each instance; Each instance is processed using multiple random channels to obtain instance-specific custom parameters for each instance. The integer seed is used to drive the instance transformation processing, the instance color processing, and the instance customization processing according to the preset extraction order, so that the instance-by-instance change parameters of the same seed and the same scene can be reproduced.
7. The method for GPU instantiation of scattered decoration fields and deterministic instance-by-instance changes according to claim 1, characterized in that, The specifications for the scattering field also include: material; During runtime, when a change to the material parameters is received, the changed material parameters are written to the multi-mesh instance node, so that the changed material parameters are applied to all instances laid out by the multi-mesh instance node, completing a re-dyeing of the entire decorative field.
8. A GPU-instantiated scattered decoration field and deterministic instance-by-instance variation system, characterized in that, include: Specification mounting module, ground-attaching point module, variation determination module, and grid construction module; The specification mounting module is used to mount a scattering field specification to any entity. The scattering field specification includes at least: instantiated mesh, instance count, scattering distribution, ground label, per-instance field, and integer seed. The ground-attaching dot module is used to determine the initial dot positions of a count of instances based on the dot distribution; and to project the initial dot positions of each instance based on the ground labels to obtain the attached dot positions of each instance. The change determination module is used to determine the instance-by-instance change parameters of each instance based on the fitting point position of each instance, according to the instance-by-instance field and the integer seed, and in a preset extraction order. The mesh construction module is used to construct multiple mesh instance nodes according to the instance-by-instance variation parameters of each instance, and to lay out the instance count of instances with the instantiated mesh.
9. A computer device, characterized in that, The computer device includes a processor coupled to a memory storing at least one computer program, which is loaded and executed by the processor to enable the computer device to implement a GPU instantiation scatter decoration field and deterministic instance-by-instance variation method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores at least one computer program, which is loaded and executed by a processor to enable the computer to implement a GPU instantiation scattering decoration field and deterministic instance-by-instance variation method as described in any one of claims 1 to 7.
