Scene rendering method, game scene rendering method and device
By obtaining scene interaction data and object models, determining the rendering mode for instantiation, the problem of insufficient rendering effect in the existing technology is solved, dynamic rendering and efficient rendering effects are achieved, and interactive experience is improved.
Patent Information
- Application Number
- CN202411243368.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-05
- Publication Date
- 2024-12-27
AI Technical Summary
The prior art is difficult to achieve targeted dynamic instantiated rendering in real-time scene interaction, resulting in insufficient rendering effect and reducing the interactive experience.
By obtaining scene interaction data and object models, determining the interactive scene coordinates and rendering modes, performing targeted instantiation rendering, and concentrating computing resources to improve rendering efficiency and authenticity.
Dynamic instantiated rendering for each interactive situation is realized, which improves the interactive experience and rendering efficiency, and provides more refined and complex scene rendering effects.
Smart Images

Figure CN119185930A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present specification relate to the field of computer technology, and in particular to a scene rendering method, a game scene rendering method and a device. Background Art
[0002] With the development of computer technology, scene rendering has been widely used in multiple technical and commercial fields. For example, it is used to create immersive gaming environments in video game development, to generate realistic visual effects in movie special effects production, to simulate building exteriors and interior spaces in the architectural design industry, and to provide real interactive experiences in virtual reality and augmented reality.
[0003] Currently, scene rendering needs to be completed under real-time scene interaction, which puts higher demands on computing performance and efficiency. Through instance rendering, the rendering speed can be greatly improved without affecting the quality.
[0004] However, for a large number of scene objects, since the object models are all static models, it is impossible to perform targeted dynamic instantiation rendering, resulting in insufficient rendering effect and reduced interactive experience. Therefore, a scene rendering method that can complete targeted dynamic instantiation rendering is urgently needed. Summary of the invention
[0005] In view of this, an embodiment of this specification provides a scene rendering method. One or more embodiments of this specification also relate to a game scene rendering method, a scene rendering device, a game scene rendering device, a computing device, a computer-readable storage medium and a computer program to solve the technical defects existing in the prior art.
[0006] According to a first aspect of an embodiment of this specification, a scene rendering method is provided, including:
[0007] Acquire scene interaction data in the target scene and an object model of at least one scene object in the target scene, wherein the scene interaction data includes interaction scene coordinates and an interaction type;
[0008] Determining a target object model of a target scene object corresponding to the interaction scene coordinates from an object model of at least one scene object;
[0009] Determine a rendering mode of the target object model based on the interaction type and the model type of the target object model;
[0010] According to the rendering mode of the at least one object model, at least one object model is instantiated and rendered.
[0011] According to a second aspect of an embodiment of this specification, a game scene rendering method is provided, including:
[0012] Acquire scene interaction data in the game scene and an object model of at least one building object in the game scene, wherein the scene interaction data includes interaction scene coordinates and an interaction type;
[0013] Determine, from the object model of at least one building object, a target object model of a target building object corresponding to the interaction scene coordinates;
[0014] Determine a rendering mode of the target object model based on the interaction type and the model type of the target object model;
[0015] According to the rendering mode of the at least one object model, at least one object model is instantiated and rendered.
[0016] According to a third aspect of an embodiment of this specification, a scene rendering device is provided, including:
[0017] A first acquisition module is configured to acquire scene interaction data in a target scene and an object model of at least one scene object in the target scene, wherein the scene interaction data includes interaction scene coordinates and an interaction type;
[0018] A first model determination module is configured to determine a target object model of a target scene object corresponding to the interaction scene coordinates from an object model of at least one scene object;
[0019] A first mode determination module is configured to determine a rendering mode of a target object model based on an interaction type and a model type of the target object model;
[0020] The first rendering module is configured to perform instantiation rendering on at least one object model according to a rendering mode of the at least one object model.
[0021] According to a fourth aspect of the embodiments of this specification, a game scene rendering device is provided, including:
[0022] A second acquisition module is configured to acquire scene interaction data in the game scene and an object model of at least one building object in the game scene, wherein the scene interaction data includes interaction scene coordinates and an interaction type;
[0023] A second model determination module is configured to determine a target object model of a target building object corresponding to the interaction scene coordinates from an object model of at least one building object;
[0024] A second mode determination module is configured to determine a rendering mode of the target object model based on the interaction type and the model type of the target object model;
[0025] The second rendering module is configured to perform instantiation rendering on at least one object model according to a rendering mode of the at least one object model.
[0026] According to a fifth aspect of an embodiment of this specification, a computing device is provided, including:
[0027] Memory and processor;
[0028] The memory is used to store computer executable instructions, and the processor is used to execute the computer executable instructions. When the computer executable instructions are executed by the processor, the steps of the above method are implemented.
[0029] According to a sixth aspect of the embodiments of this specification, a computer-readable storage medium is provided, which stores computer-executable instructions, and the instructions implement the steps of the above method when executed by a processor.
[0030] According to a seventh aspect of the embodiments of this specification, a computer program is provided, wherein when the computer program is executed in a computer, the computer is caused to execute the steps of the above method.
[0031] In one embodiment of the present specification, scene interaction data in a target scene and an object model of at least one scene object in the target scene are obtained, wherein the scene interaction data includes interaction scene coordinates and interaction types; a target object model of a target scene object corresponding to the interaction scene coordinates is determined from the object model of at least one scene object; a rendering mode of the target object model is determined based on the interaction type and the model type of the target object model; and at least one object model is instantiated and rendered according to the rendering mode of at least one object model. By determining the target object model of the target scene object corresponding to the interaction scene coordinates from the object model of at least one scene object, computing resources can be concentrated to perform efficient instantiation rendering of these objects, thereby improving the rendering efficiency of the overall scene. By determining the rendering mode according to the interaction type and the model type of the target object model to complete targeted instantiation rendering, a more realistic and dynamic rendering effect can be achieved, and dynamic instantiation rendering can be completed for each interaction situation, thereby improving the interactive experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 is a flow chart of a scene rendering method provided by an embodiment of this specification;
[0033] Figure 2 It is a schematic diagram of a process of instantiated rendering in a scene rendering method provided by an embodiment of this specification;
[0034] Figure 3 It is an effect diagram of a rendering mode in a scene rendering method provided by an embodiment of this specification;
[0035] Figure 4 It is an effect diagram of coordinate offset in a scene rendering method provided by an embodiment of this specification;
[0036] Figure 5 It is an effect diagram of texture scaling in a scene rendering method provided by an embodiment of this specification;
[0037] Figure 6 It is a rendering effect diagram of dynamic rendering in a scene rendering method provided by an embodiment of this specification;
[0038] Figure 7 is a flowchart of a game scene rendering method provided by an embodiment of this specification;
[0039] Figure 8 is a structural schematic diagram of a scene rendering device provided by an embodiment of this specification;
[0040] Fig. 9 It is a structural schematic diagram of a game scene rendering device provided by an embodiment of this specification;
[0041] Fig.10 It is a structural block diagram of a computing device provided by an embodiment of this specification.
[0042] Specific implementation mode
[0043] Many specific details are described in the following description to facilitate a full understanding of this specification. However, this specification can be implemented in many other modes different from those described herein, and those skilled in the art can make similar generalizations without violating the connotation of this specification, so this specification is not limited to the specific implementation disclosed below.
[0044] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.
[0045] It should be understood that although the terms first, second, etc. may be used to describe various information in one or more embodiments of this specification, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0046] In addition, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of this specification are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0047] First, the terms involved in one or more embodiments of this specification are explained.
[0048] Voxel (volume element, Voxel): The basic unit of a 3D scene. It can be used to represent the shape and structure of an object model in a 3D scene and is usually used in 3D graphics and computer graphics.
[0049] Pixel (picture element, Pixel): The basic unit of a two-dimensional scene. It can be used to represent the color and texture of a two-dimensional image and is commonly used in computer graphics and digital image processing.
[0050] Mesh: A data structure used to represent the surface of a three-dimensional object in three-dimensional computer graphics. It consists of vertices, edges, and faces (faces or polygons) to define the geometric shape of an object. The Mesh model is one of the most basic representations in three-dimensional modeling and rendering.
[0051] Distributed computing nodes: In a distributed computing system, multiple computer nodes are responsible for executing computing tasks. Each distributed computing node can independently process computing tasks and transmit the computing results to other nodes through the network. Finally, the computing results of each node are integrated to obtain the final computing result.
[0052] At present, the scheme of instanced rendering usually only renders a single non-moving scene object in a single virtual scene, such as grass, gravel, etc. However, as the scene objects of the target scene become more and more detailed and complex, for example, complex scene objects composed of a main object and multiple small building attachments, decals with inconsistent decals and a large number, building attachments that can interact with users, and objects in areas that need translation and rotation, there is no good solution for processing.
[0053] However, the embodiments of this specification combine the art production process to design a solution that can support complex scene objects and perform targeted dynamic instantiation rendering. The solution includes resource integration and algorithm optimization, and can render more detailed and complex scene objects in the scene through instantiation under limited performance consumption.
[0054] In this specification, a scene rendering method is provided. This specification also relates to a game scene rendering method, a scene rendering device, a game scene rendering device, a computing device, and a computer-readable storage medium, which are described in detail one by one in the following embodiments.
[0055] See also Figure 1 , Figure 1 A flowchart of a scene rendering method provided according to an embodiment of the present specification is shown, comprising the following specific steps:
[0056] Step 102: Acquire scene interaction data in the target scene and an object model of at least one scene object in the target scene, wherein the scene interaction data includes interaction scene coordinates and interaction type.
[0057] The embodiments of this specification are applied to applications, websites or applets with image rendering functions, including but not limited to: Unity development engine, 3DS Max development engine, Unreal Engine development engine, Maya development engine, Blender development engine, Three.js library, Babylon.js development engine and A-Frame framework.
[0058] The target scene is a virtual scene to be rendered, which is expressed as a multi-dimensional virtual space, including scene elements such as scene objects, scene lighting and scene background. The target scene has scene space coordinates. For example, in a game, the target scene is a game map scene, which includes scene objects such as mountains, woods, waters and buildings, scene lighting of sunlight and scene background of the sky, wherein the scene objects such as mountains, woods, waters, buildings and characters have corresponding element parameters such as size, position, texture, material, etc., the scene light source of sunlight has element parameters such as light source type (sunlight), position, intensity, etc., and the scene background of the sky has element parameters such as position, texture, size, etc.
[0059] Scene objects are virtual objects in the target scene. These virtual objects can be immovable or movable, and they constitute the basic components of the target scene. For example, in a game, mountains, forests, waters, and buildings in a game map scene are all scene objects.
[0060] The object model of the scene object is a physical model of the scene object in the target scene, which is used to describe the attributes of the scene object such as size, geometry, texture, etc. The object model can be a voxel model, a pixel model, a mesh model, etc. For example, in a game, the object model of a building object can be a complex mesh model, including thousands or even tens of thousands of vertices, and the vertices form a mesh to finely represent details such as windows and doors to provide a realistic appearance. The object model has corresponding scene space coordinates in the target scene. At least one object model is pre-defined with a corresponding model type.
[0061] Scene interaction data is data generated when interacting with scene objects in the target scene. Scene interaction data can include interaction scene coordinates and interaction types. Scene interaction data is key information for achieving scene responsiveness and dynamic changes, and helps adjust rendering strategies to better reflect user intent and improve user experience. For example, in a game, a player clicks on a tree to collect wood. This action triggers the generation of scene interaction data, which includes the clicked location coordinates and interaction type (collecting resources).
[0062] The interactive scene coordinates are the scene space coordinates when interacting with the scene objects in the target scene. They are used to accurately identify the spatial position where the interaction occurs, thereby determining the target object model of the target scene object that needs to be dynamically instantiated and rendered. For example, in the game, the player is exploring an ancient castle. The player approaches a wall and uses a prop to destroy it. The point where the prop touches the wall is the interactive scene coordinate. The coordinates in the target scene of the ancient castle are (3.5, 1.2, -2.0), where 3.5 is the distance along the X axis, 1.2 is the distance along the Y axis, and -2.0 is the distance along the Z axis.
[0063] The interaction type is the type of interaction with the scene objects in the target scene. It is a classification that describes the characteristics of the interaction behavior. It is used to distinguish different forms of interaction operations, and then participate in determining the rendering method to complete the targeted dynamic instantiation rendering. For example, in the game, one player destroys the wall by throwing props, and the other player destroys the wall by hitting. The interaction type of the former is "throwing props" and the interaction type of the latter is "hitting".
[0064] To obtain scene interaction data in the target scene, one optional method is to obtain scene interaction data of the user's real-time interactive behavior in the target scene. Another optional method is to obtain scene interaction data in a pre-set target scene. Another optional method is to use a machine learning algorithm to predict scene interaction data in the target scene, which is not limited here.
[0065] An optional method for obtaining an object model of at least one scene object in a target scene is to obtain a pre-stored scene data file of the target scene by preloading, wherein the scene data file includes an object model of at least one scene object in the target scene. Another optional method is to dynamically load or stream load an object model of at least one scene object in the target scene, which is not limited here.
[0066] Exemplarily, in a first-person shooter game, a scene data Json file is loaded to obtain scene interaction data of real-time interactive behaviors of four player users in the game map scene, and mesh models of two building entities (walls) and multiple building attachments (bricks) on the two building entities in the game map scene are dynamically loaded, wherein one scene interaction data includes interaction scene coordinates (X1, Y1, Z1) and interaction type: bullet shooting, and one scene interaction data includes interaction scene coordinates (X2, Y2, Z2) and interaction type: artillery bombardment.
[0067] Acquire scene interaction data in the target scene and an object model of at least one scene object in the target scene, wherein the scene interaction data includes interaction scene coordinates and interaction types, providing data support for position coordinates for subsequent determination of the target object model of the target scene object, and providing data support for the interaction type for the subsequent rendering mode of the target object model.
[0068] Step 104: Determine a target object model of a target scene object corresponding to the interaction scene coordinates from the object model of at least one scene object.
[0069] The target scene object is a virtual object that interacts in the target scene. The target scene object can be an immovable object or a movable object. For example, in the game, the user clicks on a tree to collect wood, and the tree is the target scene object.
[0070] The target object model of the target scene object is a physical model of the target scene object in the target scene, which is used to describe the properties of the target scene object such as size, geometry, texture, etc. The target object model can be a voxel model, a pixel model, a grid model, etc. The target object model is located at the interactive scene coordinates or within a certain distance range of the interactive scene coordinates. For example, the target object model of the target scene object, a tree, is located at the interactive scene coordinates of (4, 12, 10).
[0071] An optional way to determine the target object model of the target scene object corresponding to the interactive scene coordinates from the object model of at least one scene object is to traverse the object model of at least one scene object to determine the target object model of the target scene object corresponding to the interactive scene coordinates. Another optional way is to use a space partitioning technique to determine the target object model of the target scene object corresponding to the interactive scene coordinates from the object model of at least one scene object, such as a binary tree, an octree, or a KD tree (K-dimensional tree, K-neighboring space partitioning tree), etc. This is not limited here.
[0072] Exemplarily, the grid models of two building entities (walls) and the grid models of multiple building attachments (bricks) on the two building entities in the game map scene are traversed to determine the building attachment (brick 1) of the building entity (wall) corresponding to the interactive scene coordinates (X1, Y1, Z1), and determine the building attachment (brick 2) of the building entity (wall) corresponding to the interactive scene coordinates (X2, Y2, Z2).
[0073] By determining the target object model of the target scene object corresponding to the interactive scene coordinates from the object model of at least one scene object, computing resources can be concentrated to efficiently instantiate and render these objects, thereby improving the rendering efficiency of the overall scene and providing model support for subsequent targeted dynamic instantiation rendering.
[0074] Step 106: Determine a rendering mode of the target object model based on the interaction type and the model type of the target object model.
[0075] The model type of an object model is a predefined type used to distinguish the properties of different scene object models. These types can help determine the rendering method, interaction capabilities, and required computing resources of the object model. Model types are usually classified according to the static or dynamic, complexity, and whether the object model is interactive. By defining model types, you can better manage and optimize the rendering process when real-time interaction and large-scale scene rendering are required. For example, static models: such as hills and trees in the game, these models usually do not change their position or state. Dynamic models: such as doors and windows in the game, these models may change state due to player interaction, such as opening or closing. High-complexity models: such as buildings in the game, these models may contain a lot of details and textures, and require high rendering resources. Low-complexity models: such as small stones or grass in the game, these models are relatively simple and do not require too many rendering resources.
[0076] The model type of the target object model is a predefined type used to distinguish the properties of the target object model. These types can help determine the rendering method, interaction capabilities, and required computing resources of the target object model. Model types are usually classified according to the static or dynamic, complexity, and whether the target object model is interactive. By defining model types, you can better manage and optimize the rendering process when real-time interaction and large-scale scene rendering are required.
[0077] The rendering mode of the target object model is a model rendering method determined based on the model type and interaction type of the object model, which determines how to process and display the visual rendering effect of the target object model. Including but not limited to: static rendering, falling rendering, disappearing rendering, high-quality rendering, and low-quality rendering. For example, in the game, the player approaches a grass field, but the grass field as the background does not change at all. The grass field, as a static model, can be set to static rendering, which means that the rendering of the grass field will not be updated over time, thereby saving computing resources. For another example, in the game, the player uses a weapon to hit a wooden box, and the wooden box breaks and scatters on the ground. The fragments of the wooden box after breaking are dynamic models, and their rendering mode can be set to falling rendering, which means that the fragments will simulate the effect of gravity and fall to the ground. For another example, in the game, the player uses a special skill to hit a wall, and the wall disappears. This wall, as a dynamic model, can be set to disappearing rendering after being hit, which means that the wall will disappear from the scene.
[0078] The rendering mode is determined by the model type of the object model (such as whether it needs to be dynamically updated, whether it has complex textures, etc.) and the type of interaction (such as whether it involves physical collisions, whether it needs to change dynamically, etc.). Different rendering modes can significantly affect the visual rendering effect and rendering efficiency.
[0079] Based on the interaction type and the model type of the target object model, the rendering mode of the target object model is determined. One optional method is: based on the interaction type and the model type of the target object model, a preset rendering rule set is queried to determine the rendering mode of the target object model, wherein any rendering rule defines the interaction type, model type and the corresponding rendering mode. Another optional method is to use a machine learning model to predict the rendering mode of the target object model based on the interaction type and the model type of the target object model, which is not limited here.
[0080] Exemplarily, based on the interaction type (bullet shooting) and the model type of the target object model (brick 1): (dynamic model, high complexity model), the preset rendering rule set is queried to determine that the rendering mode of the target object model (brick 1) is: disappearing rendering; based on the interaction type (artillery bombing) and the model type of the target object model (brick 2): (dynamic model, high complexity model), the preset rendering rule set is queried to determine that the rendering mode of the target object model (brick 2) is: dropping rendering.
[0081] The rendering mode is determined based on the interaction type and the model type of the target object model, providing appropriate rendering mode support for subsequent instanced rendering.
[0082] Step 108: Perform instantiation rendering on at least one object model according to the rendering mode of the at least one object model.
[0083] Instance Rendering is a rendering technique that allows batch rendering of identical or similar object models in the same scene, thereby improving rendering efficiency. This method speeds up the rendering process by reducing repeated calculations, and is particularly effective when dealing with a large number of identical or similar objects. Optionally, instanced rendering calculates the geometric information shared by multiple instances at once, and then applies different coordinate transformation matrices to each instance to place these instances. It is suitable for rendering a large number of recurring objects, such as grass in a meadow, trees in a forest, and street lights in a city. Through instanced rendering, batch rendering can be achieved, reducing the number of drawcalls (Drawcall, that is, the number of calls to the Graphics Processing Unit (GPU)) to optimize performance, thereby improving rendering efficiency. Optionally, Figure 2 A schematic diagram of a process of instantiated rendering in a scene rendering method provided by an embodiment of this specification is shown, including:
[0084] 1. Preparation stage, including:
[0085] Get the object model;
[0086] Create materials and textures;
[0087] Set rendering parameters.
[0088] 2. Prepare instance data, including:
[0089] Set the coordinate transformation matrix for each object model;
[0090] Set the model coordinate offset and model texture scale for each object model.
[0091] 3. Rendering call settings, including:
[0092] Configure shaders to process instance data;
[0093] Set up a Vertex Array Object (VAO) to contain the data needed for instancing.
[0094] 4. Rendering stage, including:
[0095] Drawcall: A call to render multiple object models, including:
[0096] Get vertex data from the vertex array object;
[0097] Apply the transformation matrix of each object model;
[0098] Perform pixel shading calculations;
[0099] Write pixels to the frame buffer.
[0100] According to the rendering mode of the at least one object model, at least one object model is instantiated and rendered, specifically in the following manner: using a graphics processing unit to run rendering instance data, and according to the rendering mode of the at least one object model, rendering the at least one object model.
[0101] Exemplarily, the rendering instance data is run using a graphics processing unit to render each mesh model according to the rendering mode of the mesh model of two building bodies (walls) and the mesh model of multiple building attachments (bricks) on the two building bodies.
[0102] In the embodiments of the present specification, the target object model of the target scene object corresponding to the interaction scene coordinates is determined from the object model of at least one scene object, and computing resources can be concentrated to efficiently instantiate and render these objects, thereby improving the rendering efficiency of the overall scene. The rendering mode is determined according to the interaction type and the model type of the target object model to complete the targeted instantiation rendering, which can achieve a more realistic and dynamic rendering effect, realize dynamic instantiation rendering for each interaction situation, and enhance the interactive experience.
[0103] In an optional embodiment of the present specification, step 108 includes the following specific steps:
[0104] Generate rendering instance data corresponding to each model type according to the model type of at least one object model, and record the rendering mode of each object model in each rendering instance data;
[0105] The graphics processing unit is used to run each rendering instance data, and at least one object model is rendered according to the rendering mode of the at least one object model.
[0106] The rendering instance data corresponding to the model type is a data set used in computer graphics to describe the object model under the model type in the target scene, that is, a data set used to describe multiple identical or similar object models. The rendering embodiment data enables the graphics processing unit to efficiently render a large number of recurring object models without having to perform repeated calculations for each individual object model. The rendering instance data includes but is not limited to the following data: Coordinate transformation matrix: used to determine the position, rotation and scaling of each instance in the scene. Model coordinate offset: used to fine-tune the position of each instance to make it slightly different from other instances. Model texture scaling: used to control the size of each instance texture to adapt to different viewing distances or viewing angles. Material and texture information: defines the appearance characteristics of each instance, such as color, texture mapping, etc. Rendering mode: indicates how to render the instance (for example, static rendering, dynamic rendering, etc.). For example, in a game, suppose you need to render a piece of grass with thousands of identical grasses. In order to improve rendering efficiency, you can create a rendering instance data corresponding to a model type for the grass model type. This rendering instance data will contain data such as the position, rotation angle, and possible texture changes of each blade of grass. You only need to load and run the rendering instance data of the grass once, and use the instanced rendering technology to quickly render a large amount of grass in the scene without repeated calculations for each individual blade of grass.
[0107] A graphics processing unit is a hardware component specifically designed for processing and rendering images and videos. A graphics processing unit can process large amounts of data and instructions simultaneously, making it ideal for parallel computing tasks such as rendering complex three-dimensional scenes. There can be one or more graphics processing units, which can be deployed on a local system platform or on distributed computing nodes, without limitation. For example, in a game development project based on the Unity engine, the graphics processing unit is responsible for processing all rendering requests from the game engine. When the player moves the character in the game, the graphics processing unit needs to quickly re-render the scene to reflect the character's new position. In addition, the graphics processing unit also handles special effects (such as shadows, reflections, and particle effects) and advanced rendering techniques such as ambient occlusion to provide more realistic visuals. In this case, the graphics processing unit reads the prepared rendering instance data and efficiently renders the game scene based on this data.
[0108] Generate rendering instance data corresponding to each model type based on the model type of at least one object model. An optional method is: generate rendering instance data corresponding to each model type based on the model type of at least one object model, and at least one of the model coordinate offset, model texture scaling, material and texture information.
[0109] Using a graphics processing unit to run each rendering instance data, at least one object model is rendered according to the rendering mode of at least one object model. An optional method is: using a graphics processing unit on a local system platform to run each rendering instance data, at least one object model is rendered according to the rendering mode of at least one object model, for example, using a graphics processing unit (GPU) of a local system to run the rendering instance data of trees in a forest. The trees are set as static models, so their rendering mode is set to static rendering. The GPU loads the mesh model of the trees, and efficiently renders all the trees in the forest according to the coordinate transformation matrix, coordinate offset and texture scaling in the instance data. Another optional method is: using a graphics processing unit on a distributed computing node to run each rendering instance data, at least one object model is rendered according to the rendering mode of at least one object model, for example, calling the graphics processing unit (GPU) on computing nodes distributed in different geographical locations through an application programming interface (Application Programming Interface, referred to as API) to run the rendering instance data, and each computing node is responsible for rendering the object model in a part of the scene. One computing node may be responsible for rendering a piece of grass, while another computing node may be responsible for rendering a group of buildings. Each computing node renders according to the coordinate transformation matrix, coordinate offset and texture scaling amount assigned to its own object model, and sends the results back to the main node for integration to form the final rendering output, which is not limited here.
[0110] Exemplarily, according to the model types of the mesh models of two building bodies (walls) and the mesh models of multiple building attachments (bricks) on the two building bodies, as well as the model coordinate offset, model texture scaling, material and texture information, the rendering instance data Instance1 corresponding to the wall and the rendering instance data Instance2 corresponding to the brick are generated, and the rendering mode of the wall mesh model is recorded in the rendering instance data Instance1 corresponding to the wall: static rendering, and the rendering mode of the wall mesh model is recorded in the rendering instance data Instance2 corresponding to the brick: brick 1-disappearing rendering; brick 2-dropping rendering. The two rendering instance data are run by calling the graphics processing unit (GPU) on the computing nodes distributed in different geographical locations through the application programming interface, and the mesh models of the two building bodies (walls) and the mesh models of multiple building attachments (bricks) on the two building bodies are rendered according to their respective rendering modes.
[0111] With reference to the above exemplary content, Figure 3 The effect diagram of a rendering mode in a scene rendering method provided by an embodiment of the present specification is shown, specifically:
[0112] A building body (wall) includes multiple building accessories (bricks). In static rendering mode, the bricks on the wall remain static and do not change. In falling rendering mode, the bricks on the wall show a falling animation effect. In disappearing rendering mode, the bricks on the wall are invisible, that is, the object model is not rendered.
[0113] In the embodiments of this specification, by adopting rendering instance data for different model types and reasonable rendering mode allocation, the graphics processing unit is efficiently utilized, and efficient rendering of a large number of object models is achieved, which significantly improves the overall efficiency and performance of scene rendering. This method not only reduces unnecessary computing load, but also optimizes resource utilization, further improving the interactive experience.
[0114] In an optional embodiment of the present specification, generating rendering instance data corresponding to each model type according to the model type of at least one object model includes the following specific steps:
[0115] generating, according to a model type of at least one object model, rendering instance data corresponding to each model type in a plurality of video frames;
[0116] Utilizing a graphics processing unit to run each rendering instance data and rendering at least one object model according to the rendering mode of at least one object model comprises the following specific steps:
[0117] The graphics processing unit is used to run each rendering instance data, and at least one object model is rendered according to the rendering mode of the at least one object model.
[0118] Video frames are used to describe the images presented at each timestamp during dynamic rendering. When performing instanced rendering, each rendering actually creates a video frame. For example, in the game, when a player interacts, such as shooting a tree, this action generates a scene interaction data, including the interaction scene coordinates and the interaction type. Based on this interaction data, the system determines the target object model that needs to be dynamically instanced and sets the corresponding rendering mode. Subsequently, these target object models are rendered in each video frame, forming a dynamic visual effect. For example, in the game, when a player shoots a tree and causes leaves to fall, each video frame will show the different positions and postures of the falling leaves, creating a coherent dynamic effect.
[0119] Based on the model type of at least one object model, rendering instance data corresponding to each model type in multiple video frames is generated. An optional method is: based on the model type of at least one object model, and at least one of the model coordinate offset, model texture scaling, material and texture information of multiple timestamps, rendering instance data corresponding to each model type in multiple video frames is generated.
[0120] Exemplarily, according to the model types of the mesh models of two building bodies (walls) and the mesh models of multiple building attachments (bricks) on the two building bodies, as well as multiple timestamps and model coordinate offsets, model texture scaling, material and texture information, the rendering instance data Instance1 corresponding to the wall and the rendering instance data Instance2 corresponding to the brick are generated, and the rendering mode of the wall mesh model is recorded in the rendering instance data Instance1 corresponding to the wall: static rendering, and the rendering mode of the wall mesh model is recorded in the rendering instance data Instance2 corresponding to the brick: brick 1-disappearing rendering; brick 2-dropping rendering. The two rendering instance data are run by calling the graphics processing unit (GPU) on the computing nodes distributed in different geographical locations through the application programming interface, and the mesh models of the two building bodies (walls) and the mesh models of multiple building attachments (bricks) on the two building bodies are rendered frame by frame according to their respective rendering modes, so as to achieve the rendering mode effect of playing one model type in one video frame.
[0121] In the embodiments of this specification, through the frame splitting technology, it is possible to achieve the rendering mode effect of playing a model type in each video frame. This technology not only reduces unnecessary computing load, but also optimizes resource utilization, significantly improves the overall efficiency and performance of scene rendering, and further enhances the interactive experience.
[0122] In an optional embodiment of the present specification, the scene interaction data further includes: a scene coordinate offset;
[0123] Before generating rendering instance data corresponding to each model type according to the model type of at least one object model, the method further includes the following specific steps:
[0124] Calculating a model coordinate offset of at least one object model according to the scene coordinate offset and the scene coordinates of at least one object model;
[0125] Generating rendering instance data corresponding to each model type according to the model type of at least one object model includes the following specific steps:
[0126] According to the model type and the model coordinate offset of at least one object model, rendering instance data corresponding to each model type is generated.
[0127] In the rendering of a large target scene, there are often a large number of reusable scene objects. If the scene coordinates of the models are set one by one for rendering, it is time-consuming and labor-intensive. The model coordinate offset of at least one object model can be calculated based on the scene coordinate offset and the scene coordinates of at least one object model to complete the correct scene coordinate restoration.
[0128] The scene coordinate offset is the offset of the scene space coordinate relative to the scene origin (usually the origin of the world coordinate system) when interacting with the scene objects in the target scene. The scene coordinate offset is used to describe the offset of the global coordinate position of the target scene. For example, in a game map, the origin of the world coordinate system is located in the lower left corner of the map. The player was originally at (0, 0, 0), and after turning 30 degrees, he arrived at a new position (x, y, z), then the scene coordinate offset is (x, y, z).
[0129] The scene coordinates of an object model are the coordinate values used to describe the scene space coordinates of the object model in the target scene. These coordinate values are relative to the global coordinate system of the scene and are usually used to determine the specific position of the model in the scene. For example, in a game, the position of a tree is defined as (30, 20, 10). Here (30, 20, 10) is the scene coordinate of the tree, indicating that the base of the tree is located at the position X=30, Y=20, Z=10 in the scene.
[0130] The model coordinate offset is the offset distance in the target scene relative to the model's own local coordinate system. It is used to describe the change in the specific position of the model instance in the scene relative to the original position of the model. The model coordinate offset is used to place multiple identical or similar model instances in the scene to create subtle positional differences between them, thereby increasing the realism and diversity of the scene. For example, there is a cube model, whose center is located at the origin of the local coordinate system (0, 0, 0) by default. If we want to place two such cubes in the scene, one at (1, 1, 1) and the other at (2, 2, 2), then the model coordinate offsets of the two cubes relative to their own local coordinate systems are (1, 1, 1) and (2, 2, 2), respectively. This allows the two cubes to be in different positions in the target scene.
[0131] For example, according to the scene coordinate offset The scene coordinates (x, y, z) of the mesh models of the two building bodies (walls) and the mesh models of multiple building attachments (bricks) on the two building bodies are used to calculate the model coordinate offset of each mesh model. According to the model type and model coordinate offset of each mesh model, the rendering instance data Instance1 corresponding to the wall and the rendering instance data Instance2 corresponding to the brick are generated.
[0132] Figure 4 The effect diagram of coordinate offset in a scene rendering method provided by an embodiment of the present specification is shown, specifically:
[0133] Among the many cultural buildings in the big world scene, there will be a type of reusable building complex. The building complex is designed and spliced by the artist in an independent scene, and then randomly scattered into the big world scene through tools. The rendering is completed by calculating the model coordinate offset as mentioned above, and the three buildings are basically the same in appearance, but the angle and position have changed.
[0134] In the embodiments of this specification, the method of calculating the model coordinate offset effectively solves the problem of efficient rendering of a large number of reusable models in a large scene, thereby ensuring that the position of each model instance in the scene is correct. This position offset transformation not only improves rendering efficiency, but also enhances the realism and diversity of the scene, so that even a large number of reused models can show natural changes, improving the interactive experience.
[0135] In an optional embodiment of the present specification, the scene interaction data further includes: a scene texture scaling amount;
[0136] Before generating rendering instance data corresponding to each model type according to the model type of at least one object model, the method further includes the following specific steps:
[0137] Calculating a model texture scaling amount of at least one object model according to the scene texture scaling amount and the model texture coordinates of at least one object model;
[0138] Generating rendering instance data corresponding to each model type according to the model type of at least one object model includes the following specific steps:
[0139] According to the model type and the model texture scaling amount of the at least one object model, a corresponding texture scaling amount is added to the at least one object model, and rendering instance data corresponding to each model type is generated.
[0140] Currently, texture decals use a public atlas, which captures part of the pattern by scaling the model texture. Although this is convenient for art production and intuitive, it will add multiple models, increase the amount of rendering data, and increase the resource burden.
[0141] The scene texture scaling is the scaling ratio relative to the original texture coordinates when interacting with scene objects in the target scene. For example, in a game, when the player uses a close-up camera and interacts with scene objects in the target scene, the scaling ratio relative to the original texture coordinates is 2.0.
[0142] Model texture coordinates are a coordinate system used to map an object model from a three-dimensional model surface to a two-dimensional texture image, including but not limited to: UV coordinates, spherical coordinates, and cylindrical coordinates. These coordinates are used to determine which pixel in the texture image corresponds to each point on the model surface. For example, there is a cube model whose six faces need to be covered with a wood grain pattern. The texture image of the wood grain pattern is a 1024x1024 image file that defines the texture coordinate range for each face. The top face may use a texture coordinate range of (0, 0) to (1, 1), while the bottom face may use the same coordinate range but in the opposite direction, from (0, 1) to (1, 0).
[0143] The model texture scale is the scale factor used to scale the model texture coordinates during rendering. It can be used to change the way the texture appears on the model surface, such as zooming in or out. Adjusting the model texture scale can enhance the realism and detail of the scene. For example, for object models that are observed up close, increasing the model texture scale can make the texture more delicate; while for object models that are far away, you can reduce the model texture scale to reduce details and improve performance. For example, each model has a 1024x1024 wood grain texture. For a nearby wall, you can set the model texture scale to 2.0, which means that each pixel in the texture will be stretched to twice its original size on the model surface, making the texture look clearer and more delicate. For a distant wall, you can set the model texture scale to 0.5 to reduce texture details and improve rendering efficiency.
[0144] Exemplarily, based on the scene texture scaling amount (0.7) and the scene coordinates of the mesh models of two building entities (walls) and the model UV coordinates of the mesh models of multiple building attachments (bricks) on the two building entities, the model UV coordinate scaling amount of each mesh model is calculated, and based on the model type and model UV coordinate scaling amount of each mesh model, rendering instance data Instance1 corresponding to the wall and rendering instance data Instance2 corresponding to the brick are generated.
[0145] Figure 5 The effect diagram of texture scaling in a scene rendering method provided by one embodiment of the present specification is shown, specifically:
[0146] The size relationship (distance relationship) of the three object models is arranged as follows: object model 1, object model 2, and object model 3.
[0147] A common model instance is used to render three decal textures by calculating their UV scaling: Decal Texture 1, Decal Texture 2, and Decal Texture 3.
[0148] In the embodiments of this specification, the method of calculating the model texture scaling amount effectively solves the problem of efficient rendering of a large number of reusable models in a large scene, thereby ensuring the texture authenticity of each model instance. This texture scaling transformation not only improves rendering efficiency, but also enhances the realism and diversity of the scene, so that even a large number of reused models can show natural changes, improving the interactive experience.
[0149] In an optional embodiment of the present specification, the target scene includes a plurality of pre-divided scene areas; step 104 includes the following specific steps:
[0150] Based on the interaction scene coordinates, determining a target scene area from multiple scene areas;
[0151] The object models in the target scene area are traversed to determine the target object model of the target scene object corresponding to the interaction scene coordinates.
[0152] Scene regions are multiple scene space regions pre-divided in the target scene. Scene regions are used to manage and locate object models in the target scene and improve rendering efficiency and interactive performance. By pre-dividing the target scene into multiple scene regions, object models can be managed and located more efficiently, unnecessary calculations can be reduced, and search speed can be accelerated. For example, in a game map scene, the entire scene is divided into multiple square regions, each of which contains all object models in the region. One region contains trees and grass in the forest, while another region contains houses and roads in the village.
[0153] The target scene area is the scene area where the interactive scene coordinates are located. By determining the target scene area, the object model related to the interactive event can be found more quickly, thereby improving rendering efficiency and interactive performance. For example, the player fires a bullet, and the position coordinates of the bullet are (100, 50, 0), that is, the interactive scene coordinates determine the scene area A where it is located, then scene area A is the target scene area, and only the object models in scene area A need to be traversed to find brick 1 that matches the position of the bullet as the target object model, and further determine the rendering mode, marked as disappearing (invisible) rendering mode, and the target object model will not be added in the subsequent instantiation rendering process.
[0154] The multiple scene areas can be divided in advance, and the multiple scene areas can be divided into multiple scene areas in a grid manner according to the scene coordinates, and the area coordinate range of each scene area is recorded and stored in a dictionary.
[0155] Exemplarily, based on the interactive scene coordinates (X1, Y1, Z1) and (X2, Y2, Z2), the scene area where two building entities (walls) are located is determined as the target scene area from multiple pre-divided scene areas, the grid models of the two building entities (walls) and the grid models of multiple building attachments (bricks) on the two building entities are traversed, and the building attachment (brick 1) of the building entity (wall) corresponding to the interactive scene coordinates (X1, Y1, Z1) is determined, and the building attachment (brick 2) of the building entity (wall) corresponding to the interactive scene coordinates (X2, Y2, Z2) is determined.
[0156] In the embodiments of this specification, by pre-dividing the scene into multiple small scene areas, effective management and rapid retrieval of objects in the scene are achieved. This helps to improve rendering efficiency and interactive performance, improve the efficiency of traversing and determining the target object model, and reduce unnecessary calculations, which not only reduces unnecessary computing loads, but also optimizes resource utilization, further improving the interactive experience.
[0157] In an optional embodiment of the present specification, at least one scene object includes a movable scene object;
[0158] Before step 108, the following specific steps are also included:
[0159] According to the preset coordinate association area for the movable scene object, an object model of a scene object in the target scene that is located in the coordinate association area is identified, and the scene object is determined to be an associated scene object that has a coordinate transformation relationship with the movable scene object;
[0160] Performing matrix transformation on the coordinate transformation matrix of the object model of the movable scene object to obtain the coordinate transformation matrix of the object model of the associated scene object;
[0161] Step 108 includes the following specific steps:
[0162] According to the rendering mode of the at least one object model and based on the coordinate transformation matrix of the at least one object model, instantiated rendering is performed on the at least one object model.
[0163] The movable scene objects are virtual objects that can be moved in the target scene, for example, building entities such as battleships and lifts. The building accessories on the building entities need to move with the movement of the entities. Battleships and lifts are movable scene objects.
[0164] The coordinate association area is a specific spatial range related to the coordinates of the movable scene objects. The scene objects in this area will be affected by the scene coordinate transformation of the movable scene objects, and the scene coordinate transformation will occur accordingly. By defining the coordinate association area, it is possible to determine which scene objects are associated with the scene coordinate transformation of the movable scene objects, so that the corresponding coordinate transformation will be performed when moving. For example, there is a coordinate association area with a radius of 3 meters around the car. Within this area, if the car moves, the pendants on the car must also move.
[0165] The coordinate transformation relationship is the scene coordinate transformation relationship between a movable scene object and its associated scene object. This relationship describes how the scene coordinates of the associated scene object should be transformed when the scene coordinates of the movable scene object are transformed. Defining the coordinate transformation relationship can ensure that the scene coordinates of related objects in the scene are transformed synchronously, thereby maintaining the consistency and authenticity of the scene. For example, in a game, if a car (a movable scene object) moves forward, then the pet (an associated scene object) that follows the car should also move forward to maintain their relative positions.
[0166] The associated scene objects are scene objects that have a coordinate transformation relationship with the movable scene objects. The positions of these objects will change as the positions of the movable scene objects change. The existence of associated scene objects ensures that the relative position relationship between objects in the scene remains consistent, enhancing the realism and interactivity of the scene. For example, the building main body such as a battleship or a lift platform, the building attachments on the building main body need to move with the movement of the main body, and the building attachments are associated scene objects.
[0167] The object model of the associated scene object is an entity model of the associated scene object in the target scene.
[0168] Coordinate transformation matrices are data structures used to represent the position, rotation, and scaling of objects in three-dimensional space. In computer graphics, they are often used to describe the transformation of objects from one coordinate system to another. Coordinate transformation matrices can help calculate and update the position, direction, and size of objects in a scene to achieve operations such as translation, rotation, and scaling. For example, in a game, when a car moves forward 10 meters, a coordinate transformation matrix is used to calculate the new position of the car. Similarly, the position of the pet is also updated through the corresponding coordinate transformation matrix to keep the relative position with the car unchanged.
[0169] Perform matrix transformation on the coordinate transformation matrix of the object model of the movable scene object to obtain the coordinate transformation matrix of the object model of the associated scene object. An optional method is to use a shader to perform matrix transformation on the coordinate transformation matrix of the object model of the movable scene object to obtain the coordinate transformation matrix of the object model of the associated scene object. For example, the rotation and displacement matrices of the movable object are transmitted to the shader compute shader in real time. The shader compute shader will perform matrix transformation on the coordinate transformation matrix of the object model of the movable scene object to obtain the coordinate transformation matrix of the object model of the associated scene object and save it in the frame buffer. This process is completed in the clipping calculation of the model and does not increase additional overhead.
[0170] Exemplarily, according to the preset coordinate association area (100*100*50 square) for the movable building body (lifting platform), the grid model of the building attachment located in the coordinate association area in the game map scene is identified, and the building attachment is determined to be an associated scene object that has a coordinate transformation relationship with the movable building body. The coordinate transformation matrix of the grid model of the movable scene object is transformed by using the shader computeshader to obtain the coordinate transformation matrix of the grid model of the associated scene object. According to the rendering mode of at least one grid model, each grid model is instantiated and rendered according to the coordinate transformation matrix of each grid model.
[0171] Figure 6 The effect diagram of dynamic rendering in a scene rendering method provided by one embodiment of this specification is shown, specifically:
[0172] The three cylinders are movable scene objects. A square coordinate association area is preset for the movable scene objects. A sphere is located in the coordinate association area and is an associated scene object having a coordinate transformation relationship with the movable scene object.
[0173] When the movable scene object is translated upward, the associated scene object is translated upward together.
[0174] When the movable scene object rotates 180 degrees around the vertical axis, the associated scene object rotates 180 degrees around the vertical axis together.
[0175] In the embodiments of this specification, accurate and efficient coordinate synchronization transformation between movable objects and their associated objects in the scene is achieved through dynamic rendering. This method not only improves the realism and interactivity of the scene, but also optimizes rendering efficiency and reduces unnecessary computing overhead.
[0176] Take the game scene as an example. Figure 7A flowchart of a game scene rendering method provided by an embodiment of the present specification is shown, including the following specific steps:
[0177] Step 702: Obtain scene interaction data in the game scene and an object model of at least one building object in the game scene, wherein the scene interaction data includes interaction scene coordinates and interaction types.
[0178] The embodiments of this specification are applied to applications, websites or applets with image rendering functions, including but not limited to: Unity development engine, 3DS Max development engine, Unreal Engine development engine, Maya development engine, Blender development engine, Three.js library, Babylon.js development engine and A-Frame framework.
[0179] It should be noted that the technical solution of the game scene rendering method is the same as the above Figure 1 - Figure 6 The technical solution of the scene rendering method described above belongs to the same concept. For details not described in detail in step 702, please refer to the description of the technical solution of the scene rendering method described above, which will not be repeated here.
[0180] For example, a player shoots at a wall in the game world. At this time, the interaction data between the player and the wall and the Mesh model of the wall need to be obtained. Scene interaction data: the player presses the left mouse button to shoot a bullet, the interaction scene coordinates are a certain point on the wall (100, 50, 30), and the interaction type is "shooting". Object model of the building object: Mesh model file of the wall (.json format).
[0181] Step 704: Determine a target object model of a target building object corresponding to the interaction scene coordinates from the object model of at least one building object.
[0182] In an optional embodiment of the present specification, the building object includes a building body and a building accessory, the object model of the building object includes a main model of the building body and a building accessory model of the building accessory, the target building object is a target building body and / or a target building accessory, and the target object model of the target building object is a target main model of the target building body and / or a target building accessory model of the target building accessory.
[0183] It should be noted that the technical solution of the game scene rendering method is the same as the above Figure 1 - Figure 6 The technical solution of the scene rendering method described above belongs to the same concept. For details not described in detail in step 704, please refer to the description of the technical solution of the scene rendering method described above, which will not be repeated here.
[0184] For example, it is determined whether the bullet shot by the player hits the wall, and multiple pre-divided scene areas are matched, and the object models of all building objects in the target scene are traversed to determine the Mesh model of the wall that was hit. Target building object: the wall that was shot. Target object model: the Mesh model of this wall.
[0185] Step 706: Determine the rendering mode of the target object model based on the interaction type and the model type of the target object model.
[0186] In an optional embodiment of the present specification, the rendering mode includes at least one of a disappearing rendering mode, a dropping rendering mode and a static rendering mode.
[0187] It should be noted that the technical solution of the game scene rendering method is the same as the above Figure 1 - Figure 6 The technical solution of the scene rendering method described above belongs to the same concept. For details not described in detail in step 706, please refer to the description of the technical solution of the scene rendering method described above, which will not be repeated here.
[0188] Exemplarily, since the interaction type between the player and the wall is "shooting", combined with the model type of "wall", the rendering mode after the wall is shot is determined: Rendering mode: For shooting interaction, you can select "dropping rendering mode" to simulate the debris splashing effect that may appear after the wall is shot.
[0189] Step 708: Perform instantiation rendering on at least one object model according to the rendering mode of the at least one object model.
[0190] It should be noted that the technical solution of the game scene rendering method is the same as the above Figure 1 - Figure 6 The technical solution of the scene rendering method described above belongs to the same concept. For details not described in detail in step 708, please refer to the description of the technical solution of the scene rendering method described above, which will not be repeated here.
[0191] Exemplarily, rendering instance data is generated and batch rendering is performed through GPU Instance to simulate the flying debris after the wall is shot. At the point where the wall is shot, the particle system plays a preset animation to simulate the visual effect of flying debris.
[0192] In an embodiment of the present specification, in a game scene, the target object model of the target building object corresponding to the interactive scene coordinates is determined from the object model of at least one building object, and computing resources can be concentrated to efficiently instantiate and render these building objects, thereby improving the rendering efficiency of the overall scene. The rendering mode is determined according to the interaction type and the model type of the target object model to complete the targeted instantiation rendering, which can achieve a more realistic and dynamic rendering effect, realize dynamic instantiation rendering for each interaction situation, and enhance the interactive experience in the game scene.
[0193] Corresponding to the above method embodiment, this specification also provides a scene rendering device embodiment, Figure 8 FIG. 1 is a schematic diagram showing the structure of a scene rendering device provided by an embodiment of the present specification. Figure 8 As shown, the device comprises:
[0194] A first acquisition module 802 is configured to acquire scene interaction data in a target scene and an object model of at least one scene object in the target scene, wherein the scene interaction data includes interaction scene coordinates and an interaction type;
[0195] A first model determination module 804 is configured to determine a target object model of a target scene object corresponding to the interaction scene coordinates from an object model of at least one scene object;
[0196] A first mode determination module 806 is configured to determine a rendering mode of a target object model based on an interaction type and a model type of the target object model;
[0197] The first rendering module 808 is configured to perform instantiation rendering on at least one object model according to a rendering mode of the at least one object model.
[0198] Optionally, the first rendering module 808 is further configured to:
[0199] Generate rendering instance data corresponding to each model type according to the model type of at least one object model, and record the rendering mode of each object model in each rendering instance data; use a graphics processing unit to run each rendering instance data, and render at least one object model according to the rendering mode of at least one object model.
[0200] Optionally, the first rendering module 808 is further configured to:
[0201] Generate rendering instance data corresponding to each model type in multiple video frames according to the model type of at least one object model; use a graphics processing unit to run each rendering instance data, and render at least one object model frame by frame according to the rendering mode of at least one object model.
[0202] Optionally, the scene interaction data further includes: scene coordinate offset;
[0203] Correspondingly, the device also includes:
[0204] A first offset calculation module is configured to calculate a model coordinate offset of at least one object model according to the scene coordinate offset and the scene coordinates of at least one object model;
[0205] Correspondingly, the first rendering module 808 is further configured as follows:
[0206] According to the model type and the model coordinate offset of at least one object model, rendering instance data corresponding to each model type is generated.
[0207] Optionally, the scene interaction data further includes: scene texture scaling amount;
[0208] Correspondingly, the device also includes:
[0209] A first scaling amount calculation module is configured to calculate a model texture scaling amount of at least one object model according to a scene texture scaling amount and a model texture coordinate of at least one object model;
[0210] Correspondingly, the first rendering module 808 is further configured as follows:
[0211] According to the model type and the model texture scaling amount of the at least one object model, a corresponding texture scaling amount is added to the at least one object model, and rendering instance data corresponding to each model type is generated.
[0212] Optionally, the target scene includes a plurality of pre-divided scene areas;
[0213] Correspondingly, the first model determination module 804 is further configured to:
[0214] Based on the interaction scene coordinates, a target scene area is determined from multiple scene areas; and object models in the target scene area are traversed to determine a target object model of the target scene object corresponding to the interaction scene coordinates.
[0215] Optionally, at least one scene object comprises a movable scene object;
[0216] Correspondingly, the device also includes:
[0217] The first matrix conversion module is configured to identify an object model of a scene object located in a coordinate association area in a target scene according to a preset coordinate association area for the movable scene object, and determine that the scene object is an associated scene object having a coordinate transformation relationship with the movable scene object; perform matrix transformation on the coordinate transformation matrix of the object model of the movable scene object to obtain a coordinate transformation matrix of the object model of the associated scene object;
[0218] Correspondingly, the first rendering module 808 is further configured as follows:
[0219] According to the rendering mode of the at least one object model and based on the coordinate transformation matrix of the at least one object model, instantiated rendering is performed on the at least one object model.
[0220] In the embodiments of the present specification, the target object model of the target scene object corresponding to the interaction scene coordinates is determined from the object model of at least one scene object, and computing resources can be concentrated to efficiently instantiate and render these objects, thereby improving the rendering efficiency of the overall scene. The rendering mode is determined according to the interaction type and the model type of the target object model to complete the targeted instantiation rendering, which can achieve a more realistic and dynamic rendering effect, realize dynamic instantiation rendering for each interaction situation, and enhance the interactive experience.
[0221] The above is a schematic scheme of a scene rendering device of this embodiment. It should be noted that the technical scheme of the scene rendering device and the technical scheme of the scene rendering method described above are of the same concept, and the details not described in detail in the technical scheme of the scene rendering device can be referred to the description of the technical scheme of the scene rendering method described above.
[0222] Corresponding to the above method embodiment, this specification also provides a game scene rendering device embodiment, Fig. 9 FIG. 1 is a schematic diagram showing the structure of a game scene rendering device provided by an embodiment of the present specification. Fig. 9 As shown, the device comprises:
[0223] A second acquisition module 902 is configured to acquire scene interaction data in the game scene and an object model of at least one building object in the game scene, wherein the scene interaction data includes interaction scene coordinates and interaction types;
[0224] The second model determination module 904 is configured to determine a target object model of a target building object corresponding to the interaction scene coordinates from the object model of at least one building object;
[0225] A second mode determination module 906 is configured to determine a rendering mode of the target object model based on the interaction type and the model type of the target object model;
[0226] The second rendering module 908 is configured to perform instantiation rendering on at least one object model according to the rendering mode of the at least one object model.
[0227] Optionally, the building object includes a building body and a building accessory, the object model of the building object includes a main model of the building body and a building accessory model of the building accessory, the target building object is a target building body and / or a target building accessory, and the target object model of the target building object is a target main model of the target building body and / or a target building accessory model of the target building accessory.
[0228] Optionally, the rendering mode includes at least one of a disappearing rendering mode, a dropping rendering mode and a static rendering mode.
[0229] In an embodiment of the present specification, in a game scene, the target object model of the target building object corresponding to the interactive scene coordinates is determined from the object model of at least one building object, and computing resources can be concentrated to efficiently instantiate and render these building objects, thereby improving the rendering efficiency of the overall scene. The rendering mode is determined according to the interaction type and the model type of the target object model to complete the targeted instantiation rendering, which can achieve a more realistic and dynamic rendering effect, realize dynamic instantiation rendering for each interaction situation, and enhance the interactive experience in the game scene.
[0230] The above is a schematic scheme of a game scene rendering device of this embodiment. It should be noted that the technical scheme of the game scene rendering device and the technical scheme of the above-mentioned game scene rendering method belong to the same concept, and the details not described in detail in the technical scheme of the game scene rendering device can be referred to the description of the technical scheme of the above-mentioned game scene rendering method.
[0231] Fig.10 The block diagram of a computing device 1000 according to an embodiment of the present specification is shown. The components of the computing device 1000 include but are not limited to a memory 1010 and a processor 1020. The processor 1020 is connected to the memory 1010 via a bus 1030, and the database 1050 is used to store data.
[0232] The computing device 1000 also includes an access device 1040, which enables the computing device 1000 to communicate via one or more networks 1060. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 1040 may include one or more of any type of network interface (e.g., a network interface card (NIC)) of wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a Worldwide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, and a Near Field Communication (NFC).
[0233] In one embodiment of the present specification, the above components of the computing device 1000 and Fig.10 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Fig.10 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.
[0234] The computing device 1000 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or a personal computer (PC). The computing device 1000 may also be a mobile or stationary server.
[0235] Among them, the processor 1020 is used to execute the following computer program / instructions, which, when executed by the processor, implement the steps of the above-mentioned scene rendering method or game scene rendering method.
[0236] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the above-mentioned scene rendering method and game scene rendering method belong to the same concept, and the details not described in detail in the technical scheme of the computing device can be referred to the description of the technical scheme of the above-mentioned scene rendering method or game scene rendering method.
[0237] An embodiment of the present specification also provides a computer-readable storage medium storing a computer program / instruction, which implements the steps of the above-mentioned scene rendering method or game scene rendering method when executed by a processor.
[0238] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the above-mentioned scene rendering method and game scene rendering method belong to the same concept, and the details not described in detail in the technical scheme of the storage medium can be referred to the description of the technical scheme of the above-mentioned scene rendering method or game scene rendering method.
[0239] An embodiment of the present specification also provides a computer program product, including a computer program / instruction, which implements the steps of the above-mentioned scene rendering method or game scene rendering method when executed by a processor.
[0240] The above is a schematic scheme of a computer program product of this embodiment. It should be noted that the technical scheme of the computer program product and the technical scheme of the above-mentioned scene rendering method and game scene rendering method belong to the same concept, and the details not described in detail in the technical scheme of the computer program product can be referred to the description of the technical scheme of the above-mentioned scene rendering method or game scene rendering method.
[0241] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0242] The computer program / instruction includes computer program code, which may be in source code form, object code form, executable file or some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer readable medium may be appropriately increased or decreased according to the requirements of patent practice. For example, in some regions, according to patent practice, the computer readable medium does not include electric carrier signal and telecommunication signal.
[0243] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of this specification are not limited by the order of the actions described, because according to the embodiments of this specification, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the embodiments of this specification.
[0244] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0245] The preferred embodiments of this specification disclosed above are only used to help explain this specification. The optional embodiments do not describe all the details in detail, nor do they limit the invention to only the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the embodiments of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of this specification, so that technicians in the relevant technical field can well understand and use this specification. This specification is only limited by the claims and their full scope and equivalents.
Claims
1. A scene rendering method, characterized in that: include: Acquire scene interaction data in a target scene and an object model of at least one scene object in the target scene, wherein the scene interaction data includes interaction scene coordinates and an interaction type; Determining, from the object model of the at least one scene object, a target object model of the target scene object corresponding to the interaction scene coordinates; Determining a rendering mode of the target object model based on the interaction type and the model type of the target object model; According to the rendering mode of the at least one object model, instantiated rendering is performed on the at least one object model.
2. The method according to claim 1, characterized in that The instantiating and rendering the at least one object model according to the rendering mode of the at least one object model comprises: Generate rendering instance data corresponding to each model type according to the model type of at least one object model, and record the rendering mode of each object model in each rendering instance data; The rendering instance data are run by a graphics processing unit to render the at least one object model according to the rendering mode of the at least one object model.
3. The method according to claim 2, characterized in that The generating, according to the model type of at least one object model, rendering instance data corresponding to each model type comprises: generating, according to a model type of at least one object model, rendering instance data corresponding to each model type in a plurality of video frames; The step of using a graphics processing unit to run each rendering instance data and rendering the at least one object model according to the rendering mode of the at least one object model includes: The rendering instance data are run by a graphics processing unit to render the at least one object model frame by frame according to the rendering mode of the at least one object model.
4. The method according to claim 2, characterized in that: The scene interaction data also includes: scene coordinate offset; Before generating rendering instance data corresponding to each model type according to the model type of at least one object model, the method further includes: Calculating a model coordinate offset of the at least one object model according to the scene coordinate offset and the scene coordinates of the at least one object model; The generating, according to the model type of at least one object model, rendering instance data corresponding to each model type comprises: According to the model type and the model coordinate offset of at least one object model, rendering instance data corresponding to each model type is generated.
5. The method according to claim 2, characterized in that: The scene interaction data also includes: scene texture scaling amount; Before generating rendering instance data corresponding to each model type according to the model type of at least one object model, the method further includes: Calculating a model texture scaling amount of the at least one object model according to the scene texture scaling amount and the model texture coordinates of the at least one object model; The generating, according to the model type of at least one object model, rendering instance data corresponding to each model type comprises: According to the model type and the model texture scaling amount of at least one object model, a corresponding texture scaling amount is added to the at least one object model, and rendering instance data corresponding to each model type is generated.
6. The method according to claim 1, characterized in that The target scene includes a plurality of pre-divided scene areas; The step of determining, from the object model of the at least one scene object, a target object model of the target scene object corresponding to the interaction scene coordinates comprises: Based on the interaction scene coordinates, determining a target scene area from the multiple scene areas; The object models in the target scene area are traversed to determine the target object model of the target scene object corresponding to the interaction scene coordinates.
7. The method according to claim 1, characterized in that The at least one scene object comprises a movable scene object; Before instantiating and rendering the at least one object model according to the rendering mode of the at least one object model, the method further includes: According to a preset coordinate association area for the movable scene object, an object model of a scene object in the target scene located in the coordinate association area is identified, and the scene object is determined to be an associated scene object having a coordinate transformation relationship with the movable scene object; Performing matrix transformation on the coordinate transformation matrix of the object model of the movable scene object to obtain the coordinate transformation matrix of the object model of the associated scene object; The instantiating and rendering the at least one object model according to the rendering mode of the at least one object model comprises: According to the rendering mode of at least one object model, the at least one object model is instantiated and rendered according to the coordinate transformation matrix of the at least one object model.
8. A game scene rendering method, characterized in that: include: Acquire scene interaction data in a game scene and an object model of at least one building object in the game scene, wherein the scene interaction data includes interaction scene coordinates and an interaction type; Determining a target object model of a target building object corresponding to the interaction scene coordinates from the object model of the at least one building object; Determining a rendering mode of the target object model based on the interaction type and the model type of the target object model; According to the rendering mode of the at least one object model, instantiated rendering is performed on the at least one object model.
9. The method according to claim 8, characterized in that The building object includes a building body and building accessories, the object model of the building object includes a main body model of the building body and a building accessory model of the building accessory, the target building object is a target building body and / or a target building accessory, and the target object model of the target building object is a target main body model of the target building body and / or a target building accessory model of the target building accessory.
10. The method according to claim 8 or 9, characterized in that: The rendering mode includes at least one of a disappearing rendering mode, a dropping rendering mode and a static rendering mode.
11. A scene rendering device, characterized in that: include: A first acquisition module is configured to acquire scene interaction data in a target scene and an object model of at least one scene object in the target scene, wherein the scene interaction data includes interaction scene coordinates and an interaction type; A first model determination module is configured to determine a target object model of a target scene object corresponding to the interaction scene coordinates from the object model of the at least one scene object; A first mode determination module is configured to determine a rendering mode of the target object model based on the interaction type and the model type of the target object model; The first rendering module is configured to perform instantiation rendering on the at least one object model according to the rendering mode of the at least one object model.
12. A game scene rendering device, characterized in that: include: A second acquisition module is configured to acquire scene interaction data in a game scene and an object model of at least one building object in the game scene, wherein the scene interaction data includes interaction scene coordinates and an interaction type; A second model determination module is configured to determine a target object model of a target building object corresponding to the interaction scene coordinates from the object model of the at least one building object; A second mode determination module is configured to determine a rendering mode of the target object model based on the interaction type and the model type of the target object model; The second rendering module is configured to perform instantiation rendering on the at least one object model according to the rendering mode of the at least one object model.
13. A computing device, characterized in that: include: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions. When the computer-executable instructions are executed by the processor, the steps of the method according to any one of claims 1 to 10 are implemented.
14. A computer-readable storage medium, characterized in that: It stores computer executable instructions, which, when executed by a processor, implement the steps of the method described in any one of claims 1 to 10.
