Game scene switching method, device, equipment and medium
By analyzing scene switching points in the game, preloading resources, analyzing features and performing instant dynamic rendering, the problem of scene switching in the existing technology is solved, and a higher game interactivity and immersion is achieved.
Patent Information
- Application Number
- CN202411451724.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-17
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2044-10-17
AI Technical Summary
Existing game scene switching technology is difficult to ensure the smoothness and nature of the switching process, causing interruption of player immersion and may lead to game performance problems.
By analyzing the scene switching points, calculating the spatial position coordinates of the scene switching points, preloading the scene resources, analyzing the characteristics of the scene resources to be switched, generating multiple shaded calling scene modules, and performing real-time dynamic rendering and smooth control of rendering parameters to generate seamless switching rendering scenes.
It achieves more accurate and smooth scene switching, enhances the interactiveness and immersion of the game, reduces loading time, and improves the smoothness and visual effects of the game.
Smart Images

Figure CN119280805B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of game scene switching, and in particular to a game scene switching method, device, equipment and medium. Background Art
[0002] With the booming development of the gaming industry, game scene switching has become a key link in game design. The simple transition animations commonly seen in traditional game engines can no longer meet the players' increasing demands for immersion and interactive experience. With the continuous advancement of cutting-edge technologies such as virtual reality and artificial intelligence, game scene switching also urgently needs to seek breakthrough innovative solutions.
[0003] Among the existing game scene switching technologies, most rely on pre-designed 2D / 3D animation transitions, or some simple transition effects based on physics engines. Although these methods can achieve basic scene switching functions, it is difficult to ensure the smoothness and naturalness of the switching process by relying solely on traditional scene switching methods. Sudden scene switching will not only interrupt the player's immersion, but may also cause problems with game performance. Therefore, how to achieve intelligent perception of player behavior and provide a more natural and seamless scene switching experience based on this has become a key technical challenge in the field of game development. Summary of the invention
[0004] In order to solve the above technical problems, the present invention proposes a game scene switching method, device, equipment and medium to solve at least one of the above technical problems.
[0005] To achieve the above object, the present invention provides a game scene switching method, comprising the following steps:
[0006] Step S1: obtaining the user's current game scene model; parsing the scene switching point of the user's current game scene model, and calculating the scene spatial position, thereby obtaining the scene switching point spatial position coordinates;
[0007] Step S2: According to the spatial position coordinates of the scene switching point, the scene switching trigger judgment is performed on the user's current game scene model, and then the scene resources are preloaded to extract the scene resources to be switched;
[0008] Step S3: Analyze texture detail features of scene resources to be switched, and perform dynamic shading call encoding to obtain multiple shading call scene modules;
[0009] Step S4: calculating the positions to be switched for multiple shading call scene modules, and matching the positions after switching to obtain the position coordinates of the scene modules after switching;
[0010] Step S5: performing a game user visual perception on the user's current game scene model and performing a gradual blurring process to obtain a gradual blurring scene model;
[0011] Step S6: Based on the position coordinates after the scene module is switched, multiple shading call scene modules are used to perform real-time dynamic rendering of the gradient blur scene model, and the rendering parameters are smoothly adjusted to generate a seamless switching rendering scene.
[0012] The present invention also provides a game scene switching device, comprising:
[0013] The scene switching point recognition module is used to obtain the user's current game scene model; analyze the scene switching point of the user's current game scene model, and calculate the scene space position, so as to obtain the scene switching point space position coordinates;
[0014] The scene preloading module is used to determine the scene switching trigger of the user's current game scene model according to the spatial position coordinates of the scene switching point, and then preload the scene resources to extract the scene resources to be switched;
[0015] A scene disassembly module is used to analyze texture detail features of scene resources to be switched and to perform dynamic shading call encoding to obtain multiple shading call scene modules;
[0016] A scene matching module is used to calculate the positions to be switched for multiple shading call scene modules, and to match the positions after switching to obtain the position coordinates of the scene modules after switching;
[0017] A gradient blur module is used to perform a game user's visual perception on the user's current game scene model and perform a gradient blur process to obtain a gradient blur scene model;
[0018] The dynamic rendering module is used to perform real-time dynamic rendering of the gradient blurred scene model by calling multiple shading scene modules based on the position coordinates after the scene module is switched, and to smoothly adjust the rendering parameters to generate a seamless switching rendering scene.
[0019] The present invention also provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any of the above-mentioned game scene switching methods when executing the computer program.
[0020] The present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the steps of any of the above-mentioned game scene switching methods are implemented.
[0021] The beneficial effects of the present invention are as follows: by parsing the scene switching points, users can switch scenes at specific locations, enhancing the interactivity and experience of the game; calculating the spatial position coordinates of the scene switching points helps determine the user's position in the game, providing more accurate and smooth scene switching; judging based on the spatial position coordinates of the scene switching points ensures that the scene is switched at the appropriate time, enhancing the rhythm and immersion of the game; preloading the scene resources to be switched can reduce the loading time, improve the game fluency and user experience; analyzing the characteristics of the scene resources to be switched helps improve the visual effect and realism, enhancing the user's perception of the game scene, and calling through dynamic coloring Encoding generates multiple shading call scene modules to improve rendering efficiency and quality. Calculating the position coordinates of the position to be switched and the matching scene module can ensure smooth transition and seamless connection after scene switching, improve game continuity, perceive user vision and perform gradient blur processing to reduce abruptness and make scene switching more natural and smooth. Instant dynamic rendering is performed based on position coordinates to realize the rendering of gradient blur scene models by multiple shading call scene modules, generate seamless switching rendering scenes, improve the smoothness and continuity of game scene switching, optimize rendering effects through smooth regulation of rendering parameters, and ensure visual continuity and smoothness during scene switching. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 A schematic diagram of the process flow of a game scene switching method of the present invention;
[0023] Figure 2 Detailed implementation flow chart of step S1;
[0024] Figure 3 Detailed implementation flow chart of step S2;
[0025] Figure 4 Detailed implementation flow chart of step S3. DETAILED DESCRIPTION
[0026] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0027] The present application example provides a game scene switching method, device, equipment and medium. The execution subjects of the game scene switching method, device, equipment and medium include but are not limited to the following: mechanical equipment, data processing platform, cloud server node, network upload equipment, etc. equipped with the system can be regarded as the general computing node of the present application, and the data processing platform includes but is not limited to: at least one of an audio and image management system, an information management system, and a cloud data management system.
[0028] See also Figures 1 to 4The present invention provides a game scene switching method, which comprises the following steps:
[0029] Step S1: obtaining the user's current game scene model; parsing the scene switching point of the user's current game scene model, and calculating the scene spatial position, thereby obtaining the scene switching point spatial position coordinates;
[0030] Step S2: According to the spatial position coordinates of the scene switching point, the scene switching trigger judgment is performed on the user's current game scene model, and then the scene resources are preloaded to extract the scene resources to be switched;
[0031] Step S3: Analyze texture detail features of scene resources to be switched, and perform dynamic shading call encoding to obtain multiple shading call scene modules;
[0032] Step S4: calculating the positions to be switched for multiple shading call scene modules, and matching the positions after switching to obtain the position coordinates of the scene modules after switching;
[0033] Step S5: performing a game user visual perception on the user's current game scene model and performing a gradual blurring process to obtain a gradual blurring scene model;
[0034] Step S6: Based on the position coordinates after the scene module is switched, multiple shading call scene modules are used to perform real-time dynamic rendering of the gradient blur scene model, and the rendering parameters are smoothly adjusted to generate a seamless switching rendering scene.
[0035] By parsing the scene switching points, users can switch scenes at specific locations, enhancing the interactivity and experience of the game. Calculating the spatial position coordinates of the scene switching points helps determine the user's position in the game and provides more accurate and smooth scene switching. Judgment is made based on the spatial position coordinates of the scene switching points to ensure that the scene is switched at the right time, enhancing the rhythm and immersion of the game. Preloading the scene resources to be switched can reduce loading time, improve game fluency and user experience. Analyzing the characteristics of the scene resources to be switched helps improve visual effects and realism, and enhances the user's perception of the game scene. Multiple shading call scene modules are generated through dynamic shading call encoding to improve rendering efficiency and quality. Calculating the position coordinates of the position to be switched and the matching scene module can ensure smooth transition and seamless connection after scene switching, improving game coherence. Perceiving the user's vision and performing gradient blur processing can reduce the abruptness and make the scene switching more natural and smooth. Instant dynamic rendering is performed based on the position coordinates, and multiple shading call scene modules are used to render the gradient blur scene model, generating a seamless switching rendering scene, improving the smoothness and coherence of the game scene switching, and optimizing the rendering effect through smooth regulation of rendering parameters to ensure visual coherence and smoothness during scene switching.
[0036] In the embodiment of the present invention, refer to Figure 1 , is a flowchart of a method for switching game scenes of the present invention. In this example, the method for switching game scenes includes:
[0037] Step S1: obtaining the user's current game scene model; parsing the scene switching point of the user's current game scene model, and calculating the scene spatial position, thereby obtaining the scene switching point spatial position coordinates;
[0038] In this embodiment, the data source of the user's current game scene model is determined, which is usually a game engine (such as Unity, Unreal Engine) or a custom scene database. The game engine's API or database query statement is used to load the data of the current scene model, which may include the scene's geometric information, materials, object positions and attributes, etc. In Unity, SceneManager.GetActiveScene() can be used to obtain the current scene information, determine the identification method of the switching point in the scene model, which may be achieved through specific tags (such as tags, layers or attributes), or embed the location information of the switching point when the model is designed, traverse the objects in the scene model, check the attributes of each object, identify and extract the information of the scene switching point, record the position of each switching point and its related attributes (such as switching type, target scene, etc.), determine the coordinate system of the scene (such as world coordinate system, local coordinate system), ensure that a consistent coordinate reference is used when calculating the position of the switching point, traverse the previously extracted switching point data, calculate the spatial position coordinates of each switching point, and convert the local coordinates of the switching point into world coordinates according to the scene's coordinate system. For a switching point in the local coordinate system, the world coordinates can be obtained by multiplying its position vector with the transformation matrix of the parent object.
[0039] Step S2: According to the spatial position coordinates of the scene switching point, the scene switching trigger judgment is performed on the user's current game scene model, and then the scene resources are preloaded to extract the scene resources to be switched;
[0040] In this embodiment, in the main loop of the game, the user's current position and orientation are monitored in real time. This can be achieved by obtaining the user's character coordinates and viewing direction. The interface provided by the game engine is used. For example, in Unity, transform.position can be used to obtain the character's position. Collision detection is performed on each scene switching point to determine whether the user's position has entered the trigger range of the switching point. Usually, an bounding box (AABB) or a spherical collision body can be used for detection. For example, the Physics.OverlapSphere method is used to detect whether the user has entered the radius range of the switching point. A condition is determined, such as the user pressing a specific key or staying in the switching point for a certain period of time. Combined with the position detection result, it is determined whether to trigger the switch. If the condition is met, the scene switch is marked as a triggered state. According to the extracted switching point data, the resources of the scene to be switched are determined, which may include models, textures, sounds, animations, etc. The resource identifier or path of the scene to be switched is recorded, and a suitable resource loading method is selected. Usually, asynchronous loading technology is used to avoid Avoid blocking the main thread. For example, in Unity, you can use Resources.LoadAsync or Addressables system to start the resource preloading process, load resources one by one according to the resource identifier of the scene to be switched, ensure that these resources are ready when switching, monitor the loading process, and ensure that all important resources are loaded before switching. After loading is completed, confirm the status of all necessary resources and record the loaded resource information for direct use when switching. Get the loaded resources of the scene to be switched through the resource management system of the game engine. In Unity, you can use Resources.Load or Addressables.GetDownloadSizeAsync to obtain and manage resources, organize the resources of the scene to be switched into a data structure, such as a dictionary or list, to facilitate subsequent access and rendering, ensure that the extracted resources contain necessary information, such as models, materials, textures, and sound effects, and store the extracted resources of the scene to be switched in memory for quick access when the scene is switched.
[0041] Step S3: Analyze texture detail features of scene resources to be switched, and perform dynamic shading call encoding to obtain multiple shading call scene modules;
[0042] In this embodiment, all texture information, including texture images, resolutions, formats, etc., is extracted from the scene resources to be switched. A graphics API (such as OpenGL or DirectX) or a texture management system of a game engine can be used to obtain texture data. A selected feature extraction algorithm is applied to each texture to calculate and extract feature vectors, and feature information of each texture is recorded, including color distribution, edge features, and other related data. According to the extracted texture features, a suitable shader program (such as a vertex shader and a fragment shader) is designed to process dynamic rendering of the texture, and the input and output of the shader, including texture coordinates, normals, and lighting information, is determined. A shader language (such as G LSL or HLSL) to write dynamic shader code, dynamically adjust the shading effect according to texture features, for example: adjust color mixing based on color histogram, enhance details according to edge features, ensure that shaders can be dynamically loaded and switched according to scene requirements, combine the written shaders and texture feature information, build multiple shading call scene modules, each module should contain necessary resources (such as textures, shaders and materials), and can be quickly called when the scene switches, test the generated shading call scene modules to ensure that the rendering effect under different scene conditions meets expectations, optimize according to the test results, adjust shader parameters and texture features to improve rendering performance and visual effects.
[0043] Step S4: calculating the positions to be switched for multiple shading call scene modules, and matching the positions after switching to obtain the position coordinates of the scene modules after switching;
[0044] In this embodiment, the coordinate system of the current scene is determined, including the origin, direction and unit length, so as to accurately calculate the position. If the scene uses a local coordinate system, it is necessary to ensure that the transformation information (position, rotation, scaling) of the parent object is known. All shader call scene modules to be switched are traversed, the current coordinate information of each module is collected, and the relative position and direction of each module are obtained, usually including its position coordinates (X, Y, Z) and rotation angle in the current scene. According to the spatial position coordinates of the scene switching point and the relative position of the module, the position coordinates of each module to be switched in the new scene are calculated. For example, simple vector addition can be used to add the switching point coordinates to the relative position vector of the module to determine the coordinate system of the new scene, ensure that the position calculation after switching is consistent with the coordinate system of the new scene, select a suitable matching algorithm, such as nearest neighbor matching or minimum distance calculation, to determine the final position of the module to be switched in the new scene, and for each module to be switched, use the selected matching algorithm to match the position coordinates to be switched with the available positions in the new scene. For example, for each module to be switched, calculate its distance from all available positions in the new scene, and find the available position with the smallest distance for matching.
[0045] Step S5: performing a game user visual perception on the user's current game scene model and performing a gradual blurring process to obtain a gradual blurring scene model;
[0046] In this embodiment, the current position and viewing direction of the user are obtained from the game engine. This can be achieved through the transformation components (such as position and rotation) of the user character. In Unity, transform.position and transform.rotation can be used to obtain the user's position information and direction. According to the user's viewing angle and field of view (FOV), the user's field of view is defined. The field of view is usually a cone that includes the area that the user can see. The near clipping plane and the far clipping plane of the field of view are calculated to ensure that only objects within these ranges are processed. Ray casting or frustum culling technology is used to traverse all objects in the scene to determine which objects are within the user's field of view. The relevant information of the identified visible objects (such as position, material, texture, etc.) is stored in a data structure for subsequent processing. The depth information of each visible object is recorded to facilitate subsequent gradual blurring processing. The depth buffer is used to generate a depth map of the current scene. The depth map records the distance from each pixel to the user's viewpoint. When rendering the scene, it is ensured that the depth information is accurately written into the depth buffer. A suitable blurring algorithm, such as Gaussian blur or depth blur, is selected. Calculate the blur effect. Gaussian blur is suitable for uniform blur, while depth blur dynamically adjusts the degree of blur according to the distance of the object from the user. Traverse the visible objects and apply the blur effect according to their depth values in the depth map. For objects farther away from the user, apply a stronger blur effect. Use shader programming (such as GLSL or HLSL) to achieve the blur effect. In the fragment shader, calculate the blur intensity according to the depth value, and merge the blur result with the current scene image to generate the final gradient blur scene model. You can use the mixing mode (such as additive mixing or multiplicative mixing) to smoothly transition the blur effect.
[0047] Step S6: Based on the position coordinates after the scene module is switched, multiple shading call scene modules are used to perform real-time dynamic rendering of the gradient blur scene model, and the rendering parameters are smoothly adjusted to generate a seamless switching rendering scene.
[0048] In this embodiment, according to the position coordinates after switching, multiple shader call scene modules that need to be rendered are loaded and prepared, ensuring that these modules are already in memory and ready for rendering, configuring the rendering engine (such as Unity, UnrealEngine) to support dynamic rendering, setting rendering parameters such as anti-aliasing, shadow quality and lighting, traversing each scene module that needs to be rendered, calling the corresponding rendering function, and rendering each module to the corresponding position according to the position coordinates after switching. In Unity, the Graphics.DrawMesh or Renderer.Render method can be used to implement dynamic rendering, and the dynamically rendered scene module is merged with the previously generated gradient blur scene model, which can be implemented through a mixing mode (such as additive or multiplicative mixing). Now, ensure that the rendering results can reflect the depth and details of the scene, determine the rendering parameters that need to be smoothly adjusted, such as light intensity, material properties, shadow quality, etc., and select appropriate smoothing algorithms, such as exponentially weighted moving average (EWMA) or linear interpolation, to achieve smooth transition of parameters. These algorithms can effectively reduce the sudden change of parameters during the switching process and provide a more natural transition effect. In the rendering loop, according to the current rendering state and target value, the selected smoothing algorithm is applied to dynamically update the rendering parameters. For example, the current light intensity can be interpolated with the target value and gradually transitioned to the new value. The rendering effect is monitored in real time to ensure that the parameters for smooth control can maintain visual consistency under different scene conditions. According to user feedback and scene changes, the parameters for smooth control are dynamically adjusted to optimize the visual effect.
[0049] In this embodiment, refer to Figure 2 , is a flowchart of detailed implementation steps of step S1. In this embodiment, the detailed implementation steps of step S1 include:
[0050] Step S11: Obtain the user's current game scene model;
[0051] Step S12: performing scene semantic recognition on the user's current game scene model to obtain multiple game scene objects;
[0052] Step S13: classifying the multiple game scene objects into object types, thereby obtaining scene object type data;
[0053] Step S14: performing object instance segmentation based on scene object type data, and extracting bounding boxes of all objects;
[0054] Step S15: parsing the scene switching points of the bounding boxes of all objects based on the preset game development log, and marking the scene switching points;
[0055] Step S16: Calculate the scene spatial position of the scene switching point to obtain the spatial position coordinates of the scene switching point.
[0056] In this embodiment, the model data of the current scene is extracted from the game engine (such as Unity, Unreal Engine), and the API interface (such as Unity's SceneManager) is used to obtain all object information of the current scene, including position, size and type. The extracted scene model data is converted into a standardized format (such as JSON or XML) for subsequent processing, ensuring that the data contains necessary attributes, such as the coordinates, rotation and scaling information of the object, and using a pre-trained deep learning model (such as YOLO, Mask R-CNN) for scene semantic recognition, ensure that the model can recognize the categories of various common objects (such as characters, buildings, props, etc.), use the extracted game scene model data as input data, perform semantic recognition, process scene images or point cloud data so that the model can analyze and identify objects, record all objects in the scene and their types, generate a data structure called "scene object list", containing the attributes of each object (such as ID, type, location, etc.), use machine learning or deep learning algorithms (such as decision trees, support vector machines) to classify object types, select a suitable classification model, train according to the characteristics of the object (such as shape, color, texture), extract feature information from the identified objects, such as size, shape and material properties, convert the feature data into a format suitable for the classification algorithm, use the trained model to classify the objects, output the type information of each object, and store the classification results in "scene object type data", including object ID and corresponding type, use deep learning models (such as Mask The example segmentation model is used to perform instance segmentation of objects using R-CNN to ensure that the model can accurately segment each object in the scene, the scene object model and the corresponding classification information are input into the instance segmentation model, and the input data format meets the model requirements. The instance segmentation model is run to extract the bounding box and segmentation mask of each object, and the preset game development log is read to identify the conditions and events of scene switching, and the triggering conditions of each switching point are determined, such as the entry or exit of a specific object into or out of the scene. The bounding box data is matched with the switching conditions in the development log to identify the switching points, and the state and position of the object when the switching point is triggered are recorded. The scene switching points are marked in the bounding box data to form a data structure called "scene switching point data". The spatial coordinates of each switching point are calculated based on the bounding box information of the scene switching point, and the coordinate system (such as the world coordinate system) is used for conversion to ensure the accuracy of the coordinates. The calculated spatial position coordinates are recorded in the "scene switching point spatial position data", which includes the ID and corresponding coordinates of each switching point.
[0057] In this embodiment, refer to Figure 3 , is a flowchart of detailed implementation steps of step S2. In this embodiment, the detailed implementation steps of step S2 include:
[0058] Step S21: real-time user tracking is performed on the user's current game scene model to obtain user dynamic location data;
[0059] Step S22: performing switching point position matching on the scene switching point spatial position coordinates based on the user dynamic position data, and generating switching point position matching data when the switching point position matching succeeds;
[0060] Step S23: Perform dynamic light flow behavior analysis on the user's current game scene model to generate user dynamic behavior data;
[0061] Step S24: Perform scene switching triggering judgment on the user dynamic behavior data, and generate scene switching triggering behavior data when the scene switching triggering judgment is valid;
[0062] Step S25: pre-load scene resources based on the switching point position matching data and the scene switching triggering behavior data, and extract the scene resources to be switched, wherein the scene resources to be switched include scene shading texture resources and scene space area resources.
[0063] In this embodiment, the user's position is monitored in real time based on the game engine, the user's dynamic position data (such as coordinates, direction) is recorded in a dynamic data structure, the spatial position coordinate data of all scene switching points are collected, and the format of these data is ensured to be consistent with the user's dynamic position data. A suitable matching algorithm (such as the nearest neighbor matching algorithm) is selected to match the user's real-time position data with the switching point position data. According to the user's dynamic position data, it is determined whether it is close to any switching point position. If the match is successful, the matching switching point information is recorded, the switching point position matching data is generated, and the matching result is recorded, {"user ID":"user 1", "matching switching point":"switch point 1", "timestamp":time}, a suitable optical flow analysis method (such as Lucas-Kanade optical flow method) is selected to extract the dynamic behavior characteristics of the user in the scene, a camera is used to obtain an image sequence of the user in the scene, the optical flow field between consecutive frames is calculated, the user's movement and operation are identified, and the user's dynamic behavior data is extracted based on the optical flow field data, including features such as speed, acceleration, and moving direction, and the generated user dynamic behavior data is stored in a data frame, {"timestamp"} ":[time1, time2],"speed":[speed1, speed2],"direction":[direction1, direction2]}, define the triggering conditions for scene switching, such as when a user reaches a certain switching point within a specific time, or when the user's behavior pattern conforms to the preset switching behavior, use the rule engine or state machine model to analyze the user's dynamic behavior data to determine whether the triggering conditions for scene switching are met, and when the scene switching trigger judgment is valid, generate scene switching triggering behavior data, {"user ID":"user1","trigger time":time,"trigger condition":"reach switching point"}, determine the resources required for the scene to be switched, including scene shading texture resources and scene space area resources, match the data with the scene switching triggering behavior data according to the switching point position, design a resource preloading mechanism, load the required resources in advance once the switching conditions are met, implement resource preloading in the game engine, and use asynchronous loading technology to ensure that when the user switches scenes, resources can be quickly available to reduce loading time, and record the preloaded scene resource information, {"scene ID":"scene1","resource type":["texture","model"],"loading status":"loaded"}.
[0064] In this embodiment, refer to Figure 4 , is a flowchart of detailed implementation steps of step S3. In this embodiment, the detailed implementation steps of step S3 include:
[0065] Step S31: performing scene structure analysis on scene space area resources, and extracting structural object data in all scenes to be switched;
[0066] Step S32: Analyze the texture detail characteristics of the scene shading texture resources to extract the shading texture details in the scene;
[0067] Step S33: performing rendering pre-compilation processing on the shaded texture details in the scene to generate pre-compiled dynamic shader resource code;
[0068] Step S34: performing fine-grained regional division on the structural object data in all scenes to be switched to obtain a plurality of scene region division data;
[0069] Step S35: modularizing the plurality of scene area division data to generate a plurality of map modules of the scenes to be switched;
[0070] Step S36: performing dynamic shading call coding on the map modules of the multiple scenes to be switched based on the precompiled dynamic shading resource coding to obtain multiple shading call scene modules;
[0071] In this embodiment, the spatial region resource data of the scene to be switched is collected to ensure that the geometric information and attributes of all objects are included, and a suitable parsing algorithm is selected, such as a tree-structured spatial partitioning algorithm (such as an octree or a quadtree) to efficiently identify the structural objects in the scene, and the scene region resources are traversed. The parsing algorithm is used to extract the structural object data in all the scenes to be switched, and the extracted object data is recorded in a data structure, including information such as object ID, position, size and type, and the shading texture resources of the scene to be switched are collected to ensure that all relevant texture images and material information are included, and an image processing tool or library (such as OpenCV, PIL) is selected for texture analysis. The application method includes texture filtering, edge detection and frequency domain analysis to extract detail features, and the texture resources are analyzed to extract detail features, such as texture pattern, color distribution and detail level, and the extracted texture detail features are stored in a data structure for subsequent use. According to the extracted texture detail features, a dynamic shader for rendering is designed, and the graphics API (such as OpenGL, DirectX) is used for shading. Pre-compilation of the shader ensures that it can be quickly called at runtime, encodes the pre-compiled dynamic shader resources, generates reusable shader code, so that it can be quickly called when the scene is rendered, determines the basis for fine-grained division, such as object type, functional area or user interaction requirements, uses space division algorithms (such as quadtree, octree or grid division) to perform fine-grained regional division, divides the extracted structural object data into regions, and generates multiple scene region division data, determines the principle of modular decomposition, for example, based on function, visual consistency or interaction requirements, uses algorithms (such as clustering analysis or partitioning algorithms) to decompose the scene area, and generates multiple map modules for scenes to be switched, decomposes the divided scene areas according to the modular principle to form reusable map modules, designs a shading call strategy based on the pre-compiled dynamic shader resource encoding to ensure efficient use during rendering, implements dynamic shading calls for multiple map modules for scenes to be switched in the graphics engine, ensures that each module can be quickly rendered according to scene requirements, monitors rendering performance, optimizes the efficiency of dynamic shading calls, and ensures the smoothness of scene switching.
[0072] The specific steps of performing rendering pre-compilation processing on the shaded texture details in the scene and generating pre-compiled dynamic shader resource code are as follows:
[0073] Perform texture distribution statistics on the shading texture details in the scene and identify the shading texture distribution frequency;
[0074] Perform texture structure analysis based on the distribution frequency of the shading texture to obtain dynamic texture details and static texture details;
[0075] Compile static code for static texture details to obtain static texture bytecode;
[0076] Encapsulate the static texture bytecode into an image object to generate a shaded texture object;
[0077] Reserving a dynamic cache position for the shaded texture object to obtain a dynamic cache slot;
[0078] Perform dynamic thread coding embedding on dynamic cache slots based on dynamic texture details to obtain thread coding slots;
[0079] Rendering call mapping is performed based on shader texture objects and thread encoding slots to generate pre-compiled dynamic shader resource encoding.
[0080] In this embodiment, all shader texture resources in the scene to be analyzed are collected, including texture images and related attributes (such as size, color, and type), and a suitable statistical method is selected, such as using a histogram or cluster analysis, to identify the distribution frequency of textures, all texture data are traversed, the frequency of occurrence of each texture type is counted, and a distribution frequency table is generated, and a suitable graphics compilation tool (such as a GLSL compiler or other graphics API tool) is selected to compile static textures, and the static texture details are converted into a bytecode format for efficient use in a graphics engine, and all static texture details are compiled to generate static texture bytecodes, and a class structure of a texture object is designed to include necessary attributes (such as texture ID, bytecode, width, height, etc.), and the static texture bytecodes are encapsulated into the designed texture object, and a shader texture object instance is created to ensure that the object can support subsequent rendering calls, and a dynamic cache strategy is designed to determine the cache size and management method, and corresponding cache slots are reserved in the memory. , used to store shading texture objects, record the status of each slot (used / unused) to ensure efficient management, reserve dynamic cache slots for each shading texture object to ensure efficient access at runtime, design a thread management module to ensure efficient processing of cache slot requests from multiple threads, generate corresponding thread codes for each dynamic texture detail to ensure that it can correctly access and render the corresponding cache slots, use multi-threaded programming technology (such as C++'s std::thread or Java's ExecutorService) to implement it, design rendering call logic to determine how to combine shading texture objects with thread code slots, implement call mapping logic to associate shading texture objects with thread code slots, generate precompiled dynamic shader resource codes to ensure that the mapping process is efficient and seamless to optimize rendering performance, and save the generated precompiled dynamic shader resource codes to a database or memory for quick call during rendering.
[0081] In this embodiment, step S4 includes the following steps:
[0082] Step S41: performing module layout analysis on multiple shading call scene modules, and extracting layout data of each scene module;
[0083] Step S42: Calculate the position to be switched for the layout data of each scene module to obtain the position coordinates of each module to be switched;
[0084] Step S43: performing three-dimensional network division according to the user's current game scene model to obtain an original scene three-dimensional network;
[0085] Step S44: Based on the original scene three-dimensional network, the position coordinates of each module to be switched are matched after switching to obtain the position coordinates of the scene module after switching.
[0086] In this embodiment, information of all the shader call scene modules to be switched is collected, including the shape, size, boundary and relative position of each module, and a suitable layout analysis algorithm is selected, such as a space partitioning algorithm (such as a Voronoi diagram or a Delaunay triangulation) to process the layout relationship between the modules. The layout analysis algorithm is run to extract the layout data of each scene module, including its position, shape and relative relationship, and a method for calculating the position to be switched is determined, such as a bounding box calculation or a geometric center calculation based on the scene module. The layout data of each scene module is traversed to calculate the coordinates of the position to be switched, and the coordinate information of each module, including the X, Y, and Z coordinates, is recorded. The user's current scene is collected. The geometric data of the scene, including the boundaries, positions and size information of all objects, selects a suitable 3D network partitioning algorithm, such as octree or voxel grid partitioning algorithm, to achieve effective space partitioning, runs the 3D partitioning algorithm, divides the original scene data into multiple small grids or voxels, forms a 3D network of the original scene, records the spatial position and connection relationship of each grid, selects a suitable matching algorithm, such as nearest neighbor matching or minimum distance calculation, to determine the new position of the module to be switched in the 3D network, traverses the position coordinates of the module to be switched, matches them with the 3D network of the original scene, finds the corresponding position of each module in the new scene, calculates the position coordinates after switching, and ensures that each module is correctly placed in the new scene.
[0087] In this embodiment, step S5 includes the following steps:
[0088] Step S51: performing visual perception of the game user based on the user's dynamic position data, and extracting the current game user's visual data;
[0089] Step S52: performing a cone simulation calculation on the current game user's visual data to obtain the game user's field of view;
[0090] Step S53: Calculate the depth map pixels of the game user's field of view to obtain the pixel values of the user's field of view scene;
[0091] Step S54: performing a gradual blurring process on the user's current game scene model according to the pixel values of the user's field of view scene, thereby obtaining a gradual blurring scene model.
[0092] In this embodiment, the position, orientation and viewing angle information of the user in the game scene are extracted from the user's dynamic position data. The range of the user's field of view is defined according to the user's position and orientation, which usually includes the angle of the field of view (such as FOV) and the viewing distance (such as the nearest and farthest viewing distances). The visual data of the current game user is extracted by calculating the visible objects within the user's field of view. The objects are determined by collision detection and ray casting techniques to determine which objects are within the user's visual range. The extracted visual data (including visible object information, their positions and attributes) are stored in a data structure for subsequent processing. A view cone model is defined according to the user's perspective and FOV. The view cone is usually determined by the user's position, orientation and field of view angle. The boundary of the view cone is calculated using a three-dimensional geometric calculation method, which involves calculating the vertices of the view cone and determining its interaction with objects in the scene. Traverse the objects in the scene and determine whether the boundary of each object intersects with the viewing cone. This can be achieved by using an intersection test between a bounding volume (such as AABB or a sphere) and the viewing cone. Use depth buffer technology to generate a depth map when rendering the scene. The depth map records the distance from each pixel to the user's viewpoint. Traverse the objects within the user's field of view, extract the pixel value of each object in the depth map, determine its relative position in the field of view based on the depth information of the object, select a suitable blur algorithm, such as Gaussian blur or depth blur, calculate the blur effect based on the depth information, traverse the pixel values within the user's field of view, apply the blur effect based on the depth information, apply a stronger blur effect to objects far away from the user, and a weaker blur effect to objects close to the user, generate a scene model that has been gradually blurred, and draw the result on the screen to provide the user with a sense of depth and focus effect.
[0093] In this embodiment, step S6 includes the following steps:
[0094] Step S61: based on the position coordinates after the scene module is switched, multiple shading call scene modules are used to perform real-time dynamic rendering on the gradient blur scene model to generate a real-time dynamic rendering scene;
[0095] Step S62: performing module real scene fusion delay calculation on the real-time dynamic rendering scene to obtain the real scene fusion delay value of the scene module;
[0096] Step S63: performing smooth control of rendering parameters on the real scene fusion delay value of the scene module to obtain intelligently controlled rendering parameters;
[0097] Step S64: dynamically optimizing the real-time dynamic rendering scene based on intelligently regulating rendering parameters, thereby generating a seamlessly switching rendering scene.
[0098] In this embodiment, a suitable dynamic rendering technology is selected, such as a real-time rendering technology based on a GPU, and a graphics API (such as OpenGL, DirectX) is used to combine multiple shading call scene modules with a gradient blur scene model, and a real-time rendering engine is used for rendering to generate an instant dynamic rendering scene. During the implementation process, it is ensured that each scene module is correctly drawn according to the position coordinates, all scene modules to be rendered are traversed, and each module is rendered using a shader and a rendering call. The gradient blur scene model is used as the background, and the scene module is overlaid for rendering. A suitable delay calculation method is selected, such as by time series analysis or delayed rendering technology, to measure the fusion delay of the scene module. For each module in the instant dynamic rendering scene, its fusion delay with the previous rendering frame is calculated to ensure that changes can be reflected in real time during the rendering process. The generated delay value can be calculated based on the timestamp or frame rate. Smoothing control algorithms, such as exponentially weighted moving average (EWMA) or Kalman filtering, are used to reduce the fluctuation of delay values. The selected smoothing algorithm is applied to the real-scene fusion delay value of each scene module, and the smoothed parameter values are calculated. The intelligent control rendering parameters, including lighting, material and texture loading, are recorded. Dynamic rendering optimization strategies are formulated, and how to adjust the rendering process according to the intelligent control parameters is considered. According to the smoothed rendering parameters, the rendering settings are adjusted, such as reducing the detail level of unimportant objects, or dynamically adjusting the quality of light sources and shadows. Streaming loading technology is implemented to ensure that there is no loading delay when switching scenes. An optimized seamless switching rendering scene is generated to ensure that users have a smooth visual experience when switching scenes. Optimization strategies are applied in real-time dynamic rendering scenes, and rendering parameters are adjusted to improve rendering quality and frame rate to ensure seamless switching. Rendering performance is monitored to ensure that no performance loss occurs during the optimization process.
[0099] In this embodiment, a game scene switching device is also provided, including:
[0100] The scene switching point recognition module is used to obtain the user's current game scene model; analyze the scene switching point of the user's current game scene model, and calculate the scene space position, so as to obtain the scene switching point space position coordinates;
[0101] The scene preloading module is used to determine the scene switching trigger of the user's current game scene model according to the spatial position coordinates of the scene switching point, and then preload the scene resources to extract the scene resources to be switched;
[0102] A scene disassembly module is used to analyze texture detail features of scene resources to be switched and to perform dynamic shading call encoding to obtain multiple shading call scene modules;
[0103] A scene matching module is used to calculate the positions to be switched for multiple shading call scene modules, and to match the positions after switching to obtain the position coordinates of the scene modules after switching;
[0104] A gradient blur module is used to perform a game user's visual perception on the user's current game scene model and perform a gradient blur process to obtain a gradient blur scene model;
[0105] The dynamic rendering module is used to perform real-time dynamic rendering of the gradient blurred scene model by calling multiple shading scene modules based on the position coordinates after the scene module is switched, and to smoothly adjust the rendering parameters to generate a seamless switching rendering scene.
[0106] The present invention also provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements any of the above-mentioned game scene switching methods when executing the computer program.
[0107] The present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the steps of any of the above-mentioned game scene switching methods are implemented.
[0108] Those skilled in the art clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described systems, systems and units refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0109] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it is stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or partly or all or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions for a computer device (a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media for storing program codes such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0110] Therefore, the embodiments should be regarded as illustrative and non-restrictive from all points, and the scope of the present invention is limited by the appended claims rather than the above description, and it is therefore intended that all changes falling within the meaning and range of equivalent elements of the application documents are included in the present invention.
[0111] The above is only a specific embodiment of the present invention, so that those skilled in the art can understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features invented herein.
Claims
1. A game scene switching method, characterized in that: The following steps are involved: Step S1: obtaining the user's current game scene model; parsing the scene switching point of the user's current game scene model, and calculating the scene spatial position, thereby obtaining the scene switching point spatial position coordinates; Step S2: According to the spatial position coordinates of the scene switching point, the scene switching trigger judgment is performed on the user's current game scene model, and then the scene resources are preloaded to extract the scene resources to be switched; Step S3: Analyze texture detail features of scene resources to be switched, and perform dynamic shading call encoding to obtain multiple shading call scene modules; Step S4: calculating the positions to be switched for multiple shading call scene modules, and matching the positions after switching to obtain the position coordinates of the scene modules after switching; Step S5: performing a game user visual perception on the user's current game scene model and performing a gradual blurring process to obtain a gradual blurring scene model; Step S6: based on the position coordinates after the scene module is switched, multiple shading call scene modules are used to perform real-time dynamic rendering on the gradient blur scene model, and rendering parameters are smoothly adjusted to generate a seamless switching rendering scene; Among them, the specific steps of step S3 are: Step S31: performing scene structure analysis on scene space area resources, and extracting structural object data in all scenes to be switched; Step S32: Analyze the texture detail characteristics of the scene shading texture resources to extract the shading texture details in the scene; Step S33: performing rendering pre-compilation processing on the shaded texture details in the scene to generate pre-compiled dynamic shader resource code; Step S34: performing fine-grained regional division on the structural object data in all scenes to be switched to obtain a plurality of scene region division data; Step S35: modularizing the plurality of scene area division data to generate a plurality of map modules of the scenes to be switched; Step S36: performing dynamic shading call coding on the map modules of the multiple scenes to be switched based on the precompiled dynamic shading resource coding to obtain multiple shading call scene modules; The specific steps of performing rendering pre-compilation processing on the coloring texture details in the scene and generating pre-compiled dynamic shader resource code are as follows: Perform texture distribution statistics on the shading texture details in the scene and identify the shading texture distribution frequency; Perform texture structure analysis based on the distribution frequency of the shading texture to obtain dynamic texture details and static texture details; Compile static code for static texture details to obtain static texture bytecode; Encapsulate the static texture bytecode into an image object to generate a shaded texture object; Reserving a dynamic cache position for the shaded texture object to obtain a dynamic cache slot; Perform dynamic thread coding embedding on dynamic cache slots based on dynamic texture details to obtain thread coding slots; Rendering call mapping is performed based on shader texture objects and thread encoding slots to generate pre-compiled dynamic shader resource encoding.
2. The game scene switching method according to claim 1, characterized in that: The specific steps of step S1 are: Step S11: Obtain the user's current game scene model; Step S12: performing scene semantic recognition on the user's current game scene model to obtain multiple game scene objects; Step S13: classifying the multiple game scene objects into object types, thereby obtaining scene object type data; Step S14: performing object instance segmentation based on scene object type data, and extracting bounding boxes of all objects; Step S15: parsing the scene switching points of the bounding boxes of all objects based on the preset game development log, and marking the scene switching points; Step S16: Calculate the scene spatial position of the scene switching point to obtain the spatial position coordinates of the scene switching point.
3. The game scene switching method according to claim 1, characterized in that: The specific steps of step S2 are: Step S21: real-time user tracking is performed on the user's current game scene model to obtain user dynamic location data; Step S22: performing switching point position matching on the scene switching point spatial position coordinates based on the user dynamic position data, and generating switching point position matching data when the switching point position matching succeeds; Step S23: Perform dynamic light flow behavior analysis on the user's current game scene model to generate user dynamic behavior data; Step S24: Perform scene switching triggering judgment on the user dynamic behavior data, and generate scene switching triggering behavior data when the scene switching triggering judgment is valid; Step S25: pre-load scene resources based on the switching point position matching data and the scene switching triggering behavior data, and extract the scene resources to be switched, wherein the scene resources to be switched include scene shading texture resources and scene space area resources.
4. The game scene switching method according to claim 1, characterized in that: The specific steps of step S4 are: Step S41: performing module layout analysis on multiple shading call scene modules, and extracting layout data of each scene module; Step S42: Calculate the position to be switched for the layout data of each scene module to obtain the position coordinates of each module to be switched; Step S43: performing three-dimensional network division according to the user's current game scene model to obtain an original scene three-dimensional network; Step S44: Based on the original scene three-dimensional network, the position coordinates of each module to be switched are matched after switching to obtain the position coordinates of the scene module after switching.
5. The game scene switching method according to claim 1, characterized in that: The specific steps of step S5 are: Step S51: Performing visual perception of the game user based on the user's dynamic position data, and extracting the current game user's visual data; Step S52: performing a cone simulation calculation on the current game user's visual data to obtain the game user's field of view; Step S53: Calculate the depth map pixels of the game user's field of view to obtain the pixel values of the user's field of view scene; Step S54: performing a gradual blurring process on the user's current game scene model according to the pixel values of the user's field of view scene, thereby obtaining a gradual blurring scene model.
6. The game scene switching method according to claim 1, characterized in that: The specific steps of step S6 are: Step S61: Based on the position coordinates after the scene module is switched, multiple shading call scene modules are used to perform real-time dynamic rendering on the gradient blur scene model to generate a real-time dynamic rendering scene; Step S62: performing module real scene fusion delay calculation on the real-time dynamic rendering scene to obtain the real scene fusion delay value of the scene module; Step S63: performing smooth control of rendering parameters on the real scene fusion delay value of the scene module to obtain intelligently controlled rendering parameters; Step S64: dynamically optimizing the real-time dynamic rendering scene based on intelligently regulating rendering parameters, thereby generating a seamlessly switching rendering scene.
7. A game scene switching device, characterized in that: The method for switching game scenes according to claim 1 comprises: The scene switching point recognition module is used to obtain the user's current game scene model; analyze the scene switching point of the user's current game scene model, and calculate the scene space position, so as to obtain the scene switching point space position coordinates; The scene preloading module is used to determine the scene switching trigger of the user's current game scene model according to the spatial position coordinates of the scene switching point, and then preload the scene resources to extract the scene resources to be switched; A scene disassembly module is used to analyze texture detail features of scene resources to be switched and to perform dynamic shading call encoding to obtain multiple shading call scene modules; A scene matching module is used to calculate the positions to be switched for multiple shading call scene modules, and to match the positions after switching to obtain the position coordinates of the scene modules after switching; A gradient blur module is used to perform a game user's visual perception on the user's current game scene model and perform a gradient blur process to obtain a gradient blur scene model; The dynamic rendering module is used to perform real-time dynamic rendering of the gradient blurred scene model by calling multiple shading scene modules based on the position coordinates after the scene module is switched, and to smoothly adjust the rendering parameters to generate a seamless switching rendering scene.
8. A computer device comprising a memory and a processor, wherein a computer program is stored in the memory, wherein: When the processor executes the computer program, the steps of the game scene switching method described in any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the game scene switching method described in any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Panoramic switching method and system thereof
CN106485772A