Game scene rendering method and device, electronic equipment and storage medium
By analyzing the data of web game scenes and dynamically adapting texture, the problem of static texture mapping cannot achieve real -time changes, and improves the immersion and performance of the game.
Patent Information
- Application Number
- CN202411366010.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-27
- Publication Date
- 2025-01-24
AI Technical Summary
The rendering of the environment background in existing web games mainly relies on static texture mapping, and it is impossible to automatically adjust the texture according to real-time changes in the game environment, resulting in limited immersion and lack of intelligence in the game.
By obtaining real-time data of the game scene, analyzing and determining the target scene texture that matches the real-time scene characteristics, dynamically rendering the game scene, and realizing real-time adaptation of textures.
It improves the immersion, intelligence and authenticity of the game, provides dynamic and realistic scene backgrounds, while maintaining high performance and cross -platform compatibility.
Smart Images

Figure CN119345686A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of game technology, and in particular to a game scene rendering method, device, electronic device and storage medium. Background Art
[0002] With the continuous advancement of Internet technology, web games have become an important part of the digital entertainment field. Players' expectations for gaming experience are increasing. They are no longer satisfied with basic gameplay, but are pursuing richer and more realistic visual effects.
[0003] At present, the technology for implementing environmental background in web games mainly relies on static texture mapping, where static texture mapping means that the game scene uses preset static images as the background, and these images will not change during the game.
[0004] However, static texture mapping cannot automatically adjust the texture according to real-time changes in the game environment due to the lack of dynamic changes, resulting in limited immersion in the game and a lack of intelligence. Summary of the invention
[0005] In view of this, the embodiments of the present application provide a game scene rendering method, device, electronic device and storage medium to adapt the scene texture according to the real-time changes of the game scene without manual intervention, thereby improving the immersion, intelligence and authenticity of the game.
[0006] In a first aspect, an embodiment of the present application provides a game scene rendering method, comprising:
[0007] Obtaining real-time scene data of a game scene to be rendered of a preset web game;
[0008] Analyze the real-time scene data to obtain real-time scene features of the game scene to be rendered;
[0009] Determining, according to the real-time scene feature, a target scene texture matching the real-time scene feature;
[0010] The three-dimensional scene model of the game scene to be rendered is texture rendered according to the target scene texture, and a game screen of the game scene to be rendered is generated and displayed.
[0011] In a second aspect, an embodiment of the present application further provides a game scene rendering device, comprising:
[0012] An acquisition module is used to acquire real-time scene data of a game scene to be rendered of a preset web game;
[0013] A processing module, used for analyzing the real-time scene data to obtain the real-time scene features of the game scene to be rendered;
[0014] The processing module is further used to determine a target scene texture matching the real-time scene feature according to the real-time scene feature;
[0015] A rendering module is used to perform texture rendering on the three-dimensional scene model of the game scene to be rendered according to the target scene texture, and to generate and display the game screen of the game scene to be rendered.
[0016] In a third aspect, an embodiment of the present application further provides an electronic device, comprising: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the memory through the bus, and the processor executes the machine-readable instructions to execute any one of the methods described in the first aspect.
[0017] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the method described in any one of the first aspects is executed.
[0018] The present application provides a game scene rendering method, device, electronic device and storage medium, wherein the method includes: obtaining real-time scene data of a game scene to be rendered of a preset web game, analyzing the real-time scene data, obtaining real-time scene features of the game scene to be rendered, determining a target scene texture matching the real-time scene features according to the real-time scene features, performing texture rendering on a three-dimensional scene model of the game scene to be rendered according to the target scene texture, and generating and displaying a game screen of the game scene to be rendered. By adapting the scene texture according to the real-time changes of the game scene, no manual intervention is required, thereby improving the immersion, intelligence and authenticity of the game. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0020] Figure 1 Schematic diagram of the process of the game scene rendering method provided in the embodiment of the present application Figure 1 ;
[0021] Figure 2 Schematic diagram of the process of the game scene rendering method provided in the embodiment of the present application Figure 2 ;
[0022] Figure 3 Schematic diagram of the process of the game scene rendering method provided in the embodiment of the present application Figure 3 ;
[0023] Figure 4 Schematic diagram of the process of the game scene rendering method provided in the embodiment of the present application Figure 4 ;
[0024] Figure 5 Schematic diagram of the process of the game scene rendering method provided in the embodiment of the present application Figure 5 ;
[0025] Figure 6 Schematic diagram of the process of the game scene rendering method provided in the embodiment of the present application Figure 6 ;
[0026] Figure 7 A schematic diagram of the structure of a game scene rendering device provided in an embodiment of the present application;
[0027] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0028] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0029] First, the technical background technology involved in this application is described:
[0030] Web development: refers to the process of building and maintaining web applications using web technologies (HTML / CSS / JavaScript). Web development is an important branch of Internet application development, involving front-end development, back-end development, database design, network security, performance optimization and other aspects.
[0031] As a method to achieve 3D effects on web pages, CSS3D technology has been widely used in web design and development because it does not require additional plug-ins, is easy to implement, and has good cross-platform compatibility. CSS3D enables developers to build 3D scenes with depth on two-dimensional web pages through the transform-style, preserve-3d, and perspective properties of CSS3.
[0032] Currently, the technology for implementing game scenes in web games mainly relies on static texture mapping and some basic dynamic effects. Static texture mapping means that the game scene uses preset static images as the background. These images will not change during the game. Basic dynamic effects mean that some games may implement simple texture switching according to time (such as day and night cycle) or player operation. Among them, third-party graphics libraries such as Three.js and Babylon.js are used to enhance the 3D rendering capabilities of web games.
[0033] However, static texture mapping cannot automatically adjust the texture according to the real-time changes of the game environment due to the lack of dynamic changes, which limits the immersion of the game. In addition, although third-party graphics libraries such as Three.js and Babylon.js provide enhanced 3D rendering capabilities, they may bring additional loading and computing burdens to web games, affecting the smoothness and performance of the game. This leads to high development complexity, requiring a high level of technical skills and a lot of time investment, which increases development costs.
[0034] In addition, most existing technologies do not support user-customized environment backgrounds, limiting the possibility of personalized and interactive experiences. Cross-platform compatibility issues further exacerbate these challenges, as different browsers and devices have inconsistent support for 3D rendering, resulting in differences in game performance on different platforms.
[0035] Based on this, the present application adopts a game scene rendering method, which improves the immersion, intelligence and authenticity of the game by adapting the scene texture according to the real-time changes of the game scene without manual intervention, and can provide a dynamic and realistic scene background while maintaining high performance, easy integration, user-friendliness, and cross-platform compatibility.
[0036] In one embodiment of the present application, the game scene rendering method can be run on a local terminal device or a server. When the game scene rendering method is run on a server, the method can be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and a client device.
[0037] In an optional implementation, various cloud applications can be run under the cloud interaction system, such as cloud games. Taking cloud games as an example, cloud games refer to a game mode based on cloud computing. In the operation mode of cloud games, the operating body of the game program and the main body of the game screen presentation are separated. The storage and operation of the game scene rendering method are completed on the cloud game server. The role of the client device is used for receiving and sending data and presenting the game screen. For example, the client device can be a display device with data transmission function close to the user side, such as a mobile terminal, a TV, a computer, a handheld computer, etc.; but the cloud game server in the cloud is used for information processing. When playing the game, the player operates the client device to send an operation instruction to the cloud game server. The cloud game server runs the game according to the operation instruction, encodes and compresses the game screen and other data, and returns it to the client device through the network. Finally, the client device decodes and outputs the game screen.
[0038] In an optional embodiment, taking a game as an example, a local terminal device stores a game program and is used to present a game screen. The local terminal device is used to interact with the player through a graphical user interface, that is, the game program is downloaded and installed by an electronic device and run conventionally. The local terminal device may provide the graphical user interface to the player in a variety of ways, for example, it may be rendered and displayed on a display screen of the terminal, or provided to the player through a holographic projection. For example, the local terminal device may include a display screen and a processor, the display screen is used to present a graphical user interface, the graphical user interface includes a game screen, and the processor is used to run the game, generate a graphical user interface, and control the display of the graphical user interface on the display screen.
[0039] In a possible implementation, an embodiment of the present invention provides a game scene rendering method, which provides a graphical user interface through a terminal device, wherein the terminal device can be the local terminal device mentioned above, or it can be a client device in the cloud interaction system mentioned above.
[0040] Figure 1 Schematic diagram of the process of the game scene rendering method provided in the embodiment of the present application Figure 1 The execution subject of this embodiment can be an electronic device, such as a mobile phone, a computer, etc.
[0041] like Figure 1 As shown, the method may include:
[0042] S101, obtaining real-time scene data of a game scene to be rendered of a preset web game.
[0043] Among them, the preset web game can be any web game. When rendering the game scene, the real-time scene data of the game scene to be rendered of the preset web game is extracted from the rendering code of the preset web game, wherein the real-time scene data of the game scene to be rendered is the scene data of the game scene to be rendered.
[0044] The real-time scene data of the game scene to be rendered may include environmental information, game character information and game event information, wherein the environmental information includes but is not limited to time information, weather information, geographic area information, and lighting information; the game character information may include information related to the position of the game character in the game scene to be rendered; and the game event information may include information on game events occurring in the game scene to be rendered.
[0045] S102: Analyze the real-time scene data to obtain the real-time scene features of the game scene to be rendered.
[0046] The real-time scene data is analyzed to obtain the real-time scene features of the game scene to be rendered, wherein the real-time scene features are scene features of the game scene to be rendered, and are used to describe the properties or parameters of the game scene to be rendered. The real-time scene features may include: real-time environment features and real-time game features, wherein the real-time environment features are environment features of the game scene to be rendered, and the real-time game features are game features of the game scene to be rendered.
[0047] In an optional embodiment, environmental characteristics include: time characteristics, weather characteristics, geographic area characteristics, and lighting characteristics. Time characteristics are analyzed to obtain time characteristics, which may include daytime, dusk, and night, for example. Weather information is analyzed to obtain weather characteristics, which may include sunny, cloudy, and rainy days, for example. Geographic area information is analyzed to obtain geographic area characteristics, which may include indoors, outdoors, forests, deserts, and cities, and lighting information is analyzed to obtain lighting characteristics, which may include light direction, intensity, and color temperature.
[0048] In an optional embodiment, the game features include: position features of the virtual character in the game scene to be rendered, and game event features in the game scene to be rendered. Information related to the position of the game character in the game scene to be rendered is analyzed to obtain the position features of the virtual character in the game scene to be rendered, and the position features are used to indicate the position or area of the virtual character in the game scene to be rendered. Game event information occurring in the game scene to be rendered is analyzed to obtain the game event features in the game scene to be rendered, wherein the game event features may include game event types, such as combat type, exploration type, and dialogue type.
[0049] It is worth noting that a preset scene recognition function can be used to extract the real-time scene data of the game scene to be rendered from the rendering code of the preset network element game, and the artificial intelligence model trained by machine learning technology (such as deep learning) can be used to understand and analyze the real-time scene data to obtain real-time scene features. Among them, the real-time scene data of the game scene to be rendered can also include image form, and the scene recognition function can also be used to pre-process the image, including but not limited to adjusting the image size and normalization processing to convert the image into a format processed by the artificial intelligence model, and the processed image is input into the artificial intelligence model for analysis to obtain real-time scene features.
[0050] Among them, the development of artificial intelligence models will be based on existing machine learning frameworks and libraries, such as TensorFlow.js, which allow AI models to be run directly in the browser without server-side processing, thereby ensuring real-time performance and reducing latency.
[0051] In an optional implementation, a code library (such as a JavaScript AI library) of an artificial intelligence (AI) model is imported, a function for loading a pre-trained artificial intelligence model is defined, and a recognizeGameScene function is created to receive scene data of the game scene, use the model for reasoning, and return the identified scene features. In this way, the artificial intelligence module can provide real-time scene feature recognition for web games and provide intelligent decision-making support for dynamic texture adaptation. This method of integrating artificial intelligence technology not only improves the interactivity and immersion of the game, but also simplifies the development process through automated feature recognition, allowing developers to focus more on creating an engaging gaming experience. The combination of front-end technology and AI technology has promoted the development of game rendering technology and brought players an unprecedented visual experience.
[0052] S103: Determine a target scene texture that matches the real-time scene feature according to the real-time scene feature.
[0053] According to the real-time scene characteristics, a preset texture library can be queried to determine the target scene texture that matches the real-time scene characteristics, wherein the preset texture library includes: multiple pre-generated scene textures, or a target scene texture that matches the real-time scene characteristics is generated in real time according to the real-time scene characteristics.
[0054] Among them, according to the real-time scene characteristics, the adapted target scene texture is dynamically selected. In web games, based on the real-time scene characteristics provided by the artificial intelligence model, a dynamic texture adaptation algorithm is used to intelligently select the scene texture that best matches the current game scene. This algorithm is a key link in realizing the replacement of self-use environment texture, ensuring that players can experience a visual scene consistent with the scene.
[0055] It is worth noting that the texture resources of multiple scenes in the preset texture library, such as textures of different times (such as daytime, night), different weather (such as clear, cloudy, rainy), different environment types (such as city, nature), and other textures of elements that may affect the game scene. As an example, the texture of daytime is 'path_to_daytime_texture.jpg', the texture of nighttime is 'path_to_nighttime_texture.jpg', the texture of sunny is 'path_to_sunny_texture.jpg', the texture of cloudy is 'path_to_cloudy_texture.jpg', the texture of rainy is 'path_to_rainy_texture.jpg', the texture of urban is 'path_to_urban_texture.jpg', and the texture of forest is 'path_to_natural_texture.jpg'. The selectTexture function is used to select the most suitable texture from the preset texture library according to the real-time scene characteristics.
[0056] The organization structure of the preset texture library should be clear, efficient, easy to manage and retrieve. Each texture resource in the preset texture library can be classified and marked according to the corresponding scene characteristics, such as using tags or keywords to describe the scene to which it is applicable. In addition, a retrieval mechanism needs to be implemented to quickly find suitable textures based on real-time scene characteristics, and to add or delete texture resources in the preset texture library, making maintenance and updating easier, while facilitating the expansion of new functions and texture resources according to future needs.
[0057] S104, performing texture rendering on the three-dimensional scene model of the game scene to be rendered according to the target scene texture, and generating and displaying a game screen of the game scene to be rendered.
[0058] Among them, the three-dimensional scene model of the game scene to be rendered is a three-dimensional scene model created for the game scene to be rendered. The three-dimensional scene model is texture rendered according to the target scene texture to generate the game scene to be rendered, and the game screen of the game scene to be rendered is displayed.
[0059] It is worth noting that, based on the real-time environment characteristics and the real-time game characteristics, the target scene texture corresponding to the real-time environment characteristics and the target scene texture corresponding to the real-time game characteristics are determined respectively, at least two target scene textures are superimposed to obtain a superimposed scene texture, and based on the superimposed scene texture, the three-dimensional scene model of the game scene to be rendered is texture rendered to generate the game scene to be rendered, and the game screen of the game scene to be rendered is displayed.
[0060] In an optional implementation, the applyTexture function is used to apply the selected target scene texture to the three-dimensional scene model of the game scene to be rendered. This dynamic texture adaptation algorithm can ensure that the texture of the three-dimensional game model of the web game is consistent with the game scene to be rendered, thereby providing a richer and more realistic gaming experience. By using the JavaScript AI library, this process can be efficiently implemented while simplifying the development workload.
[0061] In this embodiment, by adapting the scene texture according to the real-time changes of the game scene, no manual intervention is required, thereby improving the immersion, intelligence and authenticity of the game, and being able to provide a dynamic and realistic scene background while maintaining high performance, easy integration, user-friendliness, and cross-platform compatibility. It can adapt to various environmental conditions and game styles, and provide a wide range of application possibilities for different types of web games. The simplified integration process and user interface design lower the technical threshold and reduce development time and cost.
[0062] Figure 2 Schematic diagram of the process of the game scene rendering method provided in the embodiment of the present application Figure 2 In an optional embodiment, in the above step S104, before texture rendering is performed on the three-dimensional scene model of the game scene to be rendered according to the target scene texture and the game screen of the game scene to be rendered is generated and displayed, the method may further include:
[0063] S201. Determine a target position according to a preset screen observation point and a first distance parameter.
[0064] Among them, the position parameter (perspective-origin attribute) of the preset screen observation point and the first distance parameter (perspective attribute) are extracted from the rendering code of the preset web game, wherein the first distance parameter is used to characterize the distance between the preset screen observation point and the target position in the three-dimensional virtual space to be created, and the specified position can be, for example, the center of the three-dimensional virtual space.
[0065] The preset screen observation point is a designated observation point on the display screen. The target position in the three-dimensional virtual space to be created can be determined based on the preset screen observation point and the first distance parameter. The width direction of the screen is the x-axis, the height direction is the y-axis, and the depth direction is the z-axis. The target position in the three-dimensional virtual space to be created is the position on the z-axis.
[0066] For example, the first distance parameter is 800px, which means that the distance between the three-dimensional virtual space to be created and the preset screen observation point on the z-axis is 800 pixels.
[0067] It is worth mentioning that in order to implement a 3D scene model in a web game, you can use CSS3D technology to create a container that can represent the 3D scene model. This container will serve as the "stage" of the 3D scene model (sky box), allowing 3D objects to be added and transformed. The element defines a container, uses the perspective attribute to specify the distance between the preset screen observation point and the specified position in the three-dimensional virtual space to be created, and uses the perspective-origin attribute to determine the position of the preset observation point to create the stage.
[0068] S202: Create a three-dimensional virtual space according to the target position, and create multiple two-dimensional planes in the three-dimensional virtual space.
[0069] According to the target position, a three-dimensional virtual space is created, and multiple two-dimensional planes are created in the three-dimensional virtual space. The number of two-dimensional planes can be six, for example, that is, the three-dimensional scene model to be generated is a hexahedron, and the multiple two-dimensional planes in the three-dimensional virtual space can be superimposed and displayed, that is, the front, back, left, right, top and bottom six faces are superimposed and displayed in sequence, and the final presentation is as follows.
[0070] S203: transform multiple two-dimensional planes according to preset transformation configuration parameters to generate a three-dimensional scene model.
[0071] Preset transformation configuration parameters are extracted from the rendering code of the preset web game, and multiple two-dimensional planes are transformed according to the preset transformation configuration parameters to generate a three-dimensional scene model composed of the multiple two-dimensional planes.
[0072] The preset transformation parameters include the transformation type attribute (transform-style attribute) and the second distance attribute (preserve-3d attribute). You can use CSS3D technology to create a new The element acts as a three-dimensional virtual space. It uses the transform-style attribute and the preserve-3d attribute to ensure the performance of the created two-dimensional plane in the three-dimensional virtual space. The transform-style attribute is used to characterize the transformation type, that is, the three-dimensional transformation, and the preserve-3d attribute is used to characterize that the two-dimensional plane is placed in the three-dimensional virtual space, ensuring that the two-dimensional plane can be correctly positioned and transformed in the three-dimensional virtual space.
[0073] The preset transformation parameters may also include translation attributes and rotation attributes, wherein the rotation attributes include rotation attributes on the x-axis, y-axis, and z-axis, respectively represented as rotateX(), rotateY(), and rotateZ(), and the translation attribute is a translation attribute on the z-axis, represented as translateZ().
[0074] The three-dimensional scene model can be a sky box. The basic structure of the sky box is usually composed of six faces: front, back, left, right, top and bottom. Each face is a two-dimensional plane. They are arranged around a center point in the three-dimensional virtual space to form a closed box.
[0075] It is worth noting that for each face of the skybox, element, and use CSS translation and rotation attributes to position the two-dimensional plane in the three-dimensional virtual space. For example, the translation attribute of the front is: translateZ(-512px), which means that the superimposed front surface is translated 512 pixels in the negative direction of the z-axis.
[0076] The translation property of the back is: translateZ(-512px), which means that the superimposed back is translated 512 pixels in the negative direction of the z-axis. The rotation property of the back is: rotateY(180deg), which means that the back is rotated 180° along the Y-axis.
[0077] The translation parameter of the left side (left) is: translateZ(-512px), which means that the superimposed left side is translated 512 pixels in the negative direction of the z-axis. The rotation attribute of the left side (left) is: rotateY(90deg), which means that the left side is rotated 90 degrees along the Y axis.
[0078] The translation parameter of the right side (right) is: translateZ(-512px), which means that the superimposed right side is translated 512 pixels in the negative direction of the z-axis. The rotation attribute of the right side (right) is: rotateY(-90deg), which means that the right side is rotated -90 degrees along the Y axis.
[0079] The translation parameter of the bottom is: translateZ(-512px), which means that the superimposed bottom is translated 512 pixels in the negative direction of the z-axis. The rotation attribute of the bottom is: rotateX(90deg), which means that the bottom is rotated 90 degrees along the X-axis.
[0080] The translation parameter of the top surface (top) is: translateZ(-512px), which means that the superimposed top surfaces are translated 512 pixels in the negative direction of the z-axis. The rotation attribute of the top surface (top) is: rotateX(90deg), which means that the top surface is rotated -90 degrees along the X-axis.
[0081] In this embodiment, if the transform-style attribute indicates that the transformation type is a three-dimensional transformation, multiple two-dimensional planes are transformed according to the second distance attribute, the translation parameter, and the rotation parameter to generate a three-dimensional scene model.
[0082] It can be seen that by using CSS3D technology to build a three-dimensional virtual space for web games, a method for achieving 3D effects on web pages is provided, using the transform-style attribute and perspective-3d attribute in CSS3 to create a 3D scene with depth. In web games, CSS3D can be used to build dynamic 3D environment backgrounds to enhance the visual experience of the game, and through CSS3D technology, high-performance 3D rendering effects can be achieved while maintaining lightweight and cross-platform compatibility, ensuring smooth operation on various devices and ensuring that the solution can provide consistent high-quality visual effects on different operating systems and browsers.
[0083] In an optional implementation, an overflow prevention attribute (overflow attribute) may be extracted from the rendering code of a preset web game, and multiple two-dimensional planes may be transformed according to the overflow prevention attribute and preset transformation configuration parameters to generate a three-dimensional scene model, wherein the overflow prevention attribute is used to prevent the size of the three-dimensional scene model from changing during the rendering process. For example, the width of the three-dimensional scene model is 1000px and the height is 1000px. During the rendering process, due to the influence of other factors, the width of the three-dimensional scene model may become 2000px and the height may become 2000px. This situation can be avoided by using the overflow prevention attribute.
[0084] In this embodiment, a dynamic 3D environment background is constructed by using CSS3D technology to add depth and realism to the web game. This method not only improves the visual quality of the game, but also takes advantage of the performance of CSS3D to ensure a smooth experience on various devices.
[0085] In an optional implementation, the real-time scene features include: real-time environment features and real-time game features. Figure 3 Schematic diagram of the process of the game scene rendering method provided in the embodiment of the present application Figure 3 ,like Figure 3 As shown, in an optional implementation, the method may further include:
[0086] S301, respectively selecting target environment features and target game features of a target sub-scene in a game scene to be rendered from real-time environment features and real-time game features.
[0087] Among them, the game scene to be rendered includes multiple sub-game scenes. For example, the game scene to be rendered is a game level scene, and the multiple sub-game scenes are the game scene of level 1, the game scene of level 2, and the game scene of level 3. The target sub-scene is any sub-game scene to be rendered under the game scene to be rendered, such as the game scene of level 1.
[0088] It is worth noting that the real-time environmental features of the game scene to be rendered include the environmental features of multiple sub-game scenes under the game scene to be rendered, and the real-time game features of the game scene to be rendered include the game features of multiple sub-game scenes under the game scene to be rendered.
[0089] The real-time game features are screened according to the game progress of the target sub-scene to obtain the game features of the target sub-scene, wherein the game features under different game progress may be different, and the real-time environment features are screened according to the scene time of the target sub-scene to obtain the environment features of the target sub-scene, wherein the environment features under different scene times may be different.
[0090] It is worth noting that the environmental features and game features of the target sub-scene are useful features. Useful features refer to features that can make meaningful distinctions in the game environment. These features are essential for understanding the scene context, player behavior, or game progress. For example, when deciding which skybox texture to use, the time feature (day or night) may be a useful feature because it directly affects the lighting and atmosphere of the scene.
[0091] S302: Screen the environment features and game features of the target sub-scene to obtain target environment features and target game features.
[0092] According to the task execution information of the target sub-scene, the environmental characteristics and game characteristics of the target sub-scene are screened respectively to obtain the target environmental characteristics and target game characteristics (i.e., key characteristics), wherein the task execution information includes: task execution progress and task type. The task execution progress may, for example, be an executed game level, an unexecuted game level, or an executing game level. The task type may, for example, be a puzzle level or a survival mode level.
[0093] Among them, the environmental characteristics of the target sub-scene include the environmental characteristics corresponding to each task execution information under the target sub-scene, and the game characteristics of the target sub-scene include the game characteristics corresponding to each task execution information under the target sub-scene. The key characteristics corresponding to different task execution information have a certain mapping relationship. For example, for the target sub-scene, when the game level has been executed, the target environmental characteristics and target game characteristics corresponding to the executed game level are respectively filtered out from the environmental characteristics and game characteristics of the target sub-scene; when the game level is not executed, the target environmental characteristics and target game characteristics corresponding to the unexecuted game level are respectively filtered out from the environmental characteristics and game characteristics of the target sub-scene.
[0094] The above step S103, determining the target scene texture matching the real-time scene feature according to the real-time scene feature, includes:
[0095] S303: Determine a target scene texture of a target subscene according to target environment characteristics and target game characteristics.
[0096] According to the target environment characteristics and the target game characteristics, the preset texture library is queried respectively to determine the target scene texture corresponding to the target environment characteristics and the target scene texture corresponding to the target game characteristics. For at least two target scene textures, a superimposed scene texture is obtained by superposition, and based on the superimposed scene texture, texture rendering is performed on the three-dimensional scene model of the game scene to be rendered, a target sub-scene under the game scene to be rendered is generated, and a game screen of the target sub-scene under the game scene to be rendered is displayed.
[0097] For example, in the case of an executed game level, the texture of the sky box is determined by screening out the target environment features and target game features corresponding to the executed game level. The texture can reflect the player's progress. For example, after the virtual character unlocks a new area, the sky box displays the sky scene unique to the area, for example, from the morning mist in a dense forest to the sunset on an open plain.
[0098] For another example, in the case of an unexecuted game level, the texture of the sky box is determined by screening out the target environment features and target game features corresponding to the unexecuted game level. The texture can reflect the player's progress. The sky box may display a foggy or hazy texture, symbolizing an unknown and unexplored area, increasing the sense of mystery and the appeal of exploration.
[0099] For another example, in the case of a puzzle level, the target environment features and target game features corresponding to the puzzle level are screened out, and then the texture of the sky box is determined. The texture may contain clues related to the puzzle, or display new visual elements after the puzzle is solved, such as the arrangement of constellations in the sky that hint at the answer to the puzzle.
[0100] In this embodiment, the target scene texture of the sub-game scene is screened and determined, and scene rendering is performed on the target sub-scene in real time, thereby improving the precision of scene rendering.
[0101] In an optional implementation, the above step S104, determining the target scene texture matching the real-time scene feature according to the real-time scene feature, includes:
[0102] The target scene texture is determined according to the real-time viewing angle and real-time scene characteristics of the game scene to be rendered.
[0103] Among them, the real-time perspective of the game scene to be rendered is the game perspective of the preset web game for the game scene to be rendered (that is, the perspective of the virtual camera). Different perspectives present different game scene pictures. The real-time scene features include: scene features under all perspectives of the game scene to be rendered. The scene features under different perspectives may be different. Therefore, according to the real-time perspective, the scene features under the real-time perspective can be determined from the real-time scene features, and according to the scene features under the real-time perspective, the target scene texture matching the scene features under the real-time perspective is determined, and then the three-dimensional scene model is texture rendered based on the real-time perspective, and the game screen of the game scene to be rendered under the real-time perspective is generated and displayed.
[0104] Among them, different viewing angles have a mapping relationship with the scene features under the viewing angles. For example, the real-time scene features include: daytime, sunny, outdoor, light direction 1, light intensity 1, and light color temperature 1. The game scene to be rendered under viewing angle 1 has no sunlight. It can be determined from the real-time scene features that the scene features under viewing angle 1 include: daytime, sunny, and outdoor.
[0105] In this embodiment, the matching target scene texture is determined by considering the viewing angle, thereby improving the accuracy of texture determination, making the rendered game screen more realistic, and improving the immersion, intelligence, and authenticity of the game.
[0106] Figure 4 Schematic diagram of the process of the game scene rendering method provided in the embodiment of the present application Figure 4 In an optional implementation, determining the target scene texture according to the real-time viewing angle and real-time scene characteristics of the game scene to be rendered may include:
[0107] S401, determining the target scene texture of each surface in the three-dimensional scene model according to the real-time viewing angle and real-time scene characteristics of the game scene to be rendered.
[0108] In 3D rendering, the real-time perspective is critical to determining the scene texture, because it determines which textures will be seen by the player and how they will be seen. In a three-dimensional scene model, different faces may display different textures depending on the change in perspective. Therefore, the real-time perspective is related to the target scene texture of each face.
[0109] Among them, the real-time perspective determines the part of the scene that the observer sees. For a 3D scene model, although it is usually used to provide environmental background, changes in the real-time perspective (such as the movement of the player or the rotation of the camera) will affect the visible surface, that is, which side of the 3D scene model faces the user.
[0110] When the virtual character or camera moves (i.e., real-time perspective changes), different faces of the 3D scene model may enter or leave the field of view. Therefore, dynamically adjusting the texture according to the real-time perspective can enhance the visual effect and realism. In more complex implementations, the texture of the 3D scene model can reflect changes in the environment according to the real-time perspective, such as reflecting or refracting the light and shadow of the surrounding environment.
[0111] By analyzing the real-time viewing angle and real-time scene features of the game scene to be rendered, the scene features of each surface in the three-dimensional scene model under the real-time viewing angle are determined, and the target scene texture of each surface is determined according to the scene features of each surface, wherein the real-time scene features of the game scene to be rendered include: scene features of all surfaces under all viewing angles of the game scene to be rendered, for example including: daytime, sunny, outdoors, light direction 1, light intensity 1, light color temperature 1, the real-time viewing angle is viewing angle 1, and the front of the three-dimensional scene model under viewing angle 1 faces the sun, while the other surfaces do not face the sun. The scene features of the front include: daytime, sunny, outdoors, light direction 1, light intensity 1, light color temperature 1, and the scene features of other surfaces include: daytime, sunny, outdoors.
[0112] For example, if the avatar is facing east and it is morning, the side of the skybox facing east may need to show a sunrise texture, while the other sides do not.
[0113] Accordingly, texture rendering is performed on the three-dimensional scene model of the game scene to be rendered according to the target scene texture, and a game screen of the game scene to be rendered is generated and displayed, which may include:
[0114] S402, performing texture rendering on each surface according to the target scene texture of each surface, generating and displaying a game screen.
[0115] The target scene textures of different faces may be different. Texture rendering is performed on each face according to the target scene texture of each face, and the game screen of the game scene to be rendered is generated and displayed, thereby changing the background image of the CSS3D skybox to reflect the new texture. In this way, when the player triggers the real-time perspective switch of the game scene to be rendered, the game screen of the corresponding face of the three-dimensional virtual model can be presented, which improves the immersion, intelligence and authenticity of the game.
[0116] In an optional embodiment, a transition animation (such as CSS animation or JavaScript animation) can also be extracted from the rendering code of a preset web game. When rendering a three-dimensional scene model, in order to avoid abrupt and not smooth texture rendering transitions on different surfaces of the three-dimensional scene model, when switching the game perspective, the game screen presented by the game scene switches from one surface of the three-dimensional scene model to another surface, and rotation or other dynamic effects are achieved by playing a transition animation, making the visual transition more natural.
[0117] In an optional implementation, the above step S402, performing texture rendering on each surface according to the target scene texture of each surface, generating and displaying the game screen, may include:
[0118] According to the document object model elements of the three-dimensional scene model and the target scene texture of each face, texture rendering is performed on each face to generate and display the game screen.
[0119] The Document Object Model (DOM) element is used to indicate the structural framework of the three-dimensional scene model, that is, the hexahedral structure.
[0120] It is worth noting that DOM elements (usually or The tag defines the geometry and layout of the skybox. A typical skybox consists of six faces: front, back, left, right, top, and bottom. Each face is represented by a DOM element. Through the CSS transform-style: preserve-3d property, these DOM elements are positioned in 3D space to form a closed box structure.
[0121] Target scene textures are images applied to the faces of the skybox, defining the appearance and scene of the box. Textures can be panoramic images, star maps, environmental maps, or any other suitable images. The quality, resolution, and visual effects of the target scene texture directly affect the final rendering of the skybox, thereby affecting the atmosphere and realism of the entire 3D virtual model. Textures can be dynamically changed according to the needs of the game or application, such as updating the texture of the skybox according to changes in time, weather, or player position.
[0122] Each DOM element corresponds to a face of the skybox, and each face is mapped (via the CSS background-image property or as a The source of the tag) a specific texture, the DOM element provides the structural framework of the sky box, and the target scene texture fills the visual content of this frame. Without the DOM element, the target scene texture has no place to attach, and without the target scene texture, the DOM element is just a blank frame.
[0123] In this embodiment, texture rendering is performed on each surface according to the document object model elements of the three-dimensional scene model and the target scene texture of each surface to generate and display the game screen, wherein the DOM elements can also be used to monitor and respond to user interactions, such as clicks, touches or mouse movements, so as to adjust the game perspective.
[0124] It is worth noting that the Skybox class can be used to manage the DOM elements of the skybox and the target scene texture. The TextureAdapter class integrates the scene recognition and texture selection logic, and uses the Skybox class method to update the texture. The GameEngine class is the main rendering loop of the game, which calls TextureAdapter to update the texture of the skybox according to the real-time scene characteristics. In this way, the adaptive texture adaptation technology can be combined with the CSS3D skybox to achieve dynamic texture replacement to adapt to different game scenes.
[0125] Figure 5 Schematic diagram of the process of the game scene rendering method provided in the embodiment of the present application Figure 5 ,like Figure 5 As shown, in an optional implementation, determining the target scene texture matching the real-time scene feature according to the real-time scene feature may include:
[0126] The method may further include:
[0127] S501. When a preset web game is started, or a game scene to be rendered is loaded, a target scene texture is determined from a plurality of pre-generated scene textures according to real-time scene characteristics, and the target scene texture is loaded into a preset texture library.
[0128] S502: Acquire a target scene texture from a preset texture library.
[0129] Among them, the pre-generated multiple scene textures are textures generated according to scene characteristics of game scenes at different times (such as daytime, night), different weather (such as sunny, cloudy, rainy days), and different environment types (such as city, nature).
[0130] The scene environment of the game scene to be rendered is used to indicate the time (day or night), weather (sunny or rainy or snowy), location (city or forest or desert), etc. of the game scene to be rendered. The game status of the game scene to be rendered may include the task progress of the virtual character, the level, completed tasks, and unlocked game areas.
[0131] When the preset web game is started, or the game scene to be rendered is loaded, the target scene texture of the game scene to be rendered is determined from multiple scene textures according to the real-time scene characteristics of the game scene to be rendered, and the target scene texture is loaded into the preset texture library to initialize the preset texture library. Then, when rendering the scene, the target scene texture is directly obtained from the preset texture library.
[0132] In this embodiment, by preloading the target scene textures into the preset texture library on demand, delays can be reduced. Only necessary texture resources need to be loaded, which reduces unnecessary resource occupation and waste, improves the overall performance and response speed of the game, and the loaded textures can also be cached. When the same texture needs to be used again, it can be directly obtained from the cache, reducing loading time.
[0133] It is worth mentioning that the textures in the preset texture library can be compressed textures to reduce memory usage and increase loading speed while maintaining acceptable image quality.
[0134] In an optional implementation, texture loading and AI model processing can be placed in an asynchronous thread to avoid blocking the main rendering thread.
[0135] Figure 6 Schematic diagram of the process of the game scene rendering method provided in the embodiment of the present application Figure 6 ,like Figure 6 As shown, in an optional implementation, the above step S104, performing texture rendering on the three-dimensional scene model of the game scene to be rendered according to the target scene texture, generating and displaying the game screen of the game scene to be rendered, may include:
[0136] S601. Perform image processing on a target scene texture according to device performance to obtain a processed target scene texture.
[0137] Among them, the device performance refers to the performance of the electronic device on which the game screen of the game scene to be rendered is presented, including but not limited to processor performance, memory size, and display performance.
[0138] According to the device performance, image processing is performed on the target scene texture, such as adjusting the resolution, detail level, and compression rate of the target scene texture. The higher the resolution of the processed target scene texture corresponding to the high-performance device, the higher the detail level; the lower the resolution of the processed target scene texture corresponding to the low-performance device, the lower the detail level, wherein the detail level includes but is not limited to shadow details, reflection details, ambient occlusion details, etc. The lower the compression rate of the processed target scene texture corresponding to the high-performance device, the higher the compression rate of the processed target scene texture corresponding to the low-performance device.
[0139] It is worth noting that there is a mapping relationship between device performance and specific image processing methods, which is not particularly limited in this embodiment.
[0140] S602: Perform texture rendering on the three-dimensional scene model according to the processed target scene texture, and generate and display a game screen.
[0141] According to the processed target scene texture, the three-dimensional scene model is texture rendered to generate and display the game screen of the game scene to be rendered. This allows the game screen displayed on the electronic device to match the performance of the electronic device, ensuring the efficiency of the texture adaptation process and avoiding negative impacts on game performance.
[0142] In an optional embodiment, after the game screen is generated and displayed, the game performance, such as frame rate (FPS) and loading time, can be monitored in real time to ensure that they are within an acceptable range. If not, custom events can be executed, such as reducing the resolution of the scene texture to re-render and generate and display the game screen.
[0143] It is worth mentioning that the PerformanceMonitor class can be used to monitor the game's frame rate and frame time to understand the game's performance. The TextureAdapter class integrates methods for asynchronously loading textures, caching textures, and adjusting texture quality based on performance. The GameEngine class integrates performance monitoring in the main loop to ensure that performance factors are taken into account during the rendering process. These performance optimization strategies ensure that the texture adaptation process does not negatively affect the game's performance, while providing a smooth and engaging gaming experience.
[0144] In this embodiment, the introduction of performance optimization strategies ensures the efficiency of the texture adaptation process and avoids negative impacts on game performance. Resource preloading, intelligent caching, on-demand loading, texture compression, asynchronous processing, and performance monitoring together form a comprehensive optimization framework to ensure that the game can provide a smooth experience on various devices. By monitoring the frame rate and loading time in real time, the system can dynamically adjust the texture quality to ensure that performance requirements are met while maintaining high visual standards.
[0145] Based on the same inventive concept, the embodiment of the present application also provides a game scene rendering device corresponding to the game scene rendering method. Since the principle of solving the problem by the device in the embodiment of the present application is similar to the above-mentioned game scene method in the embodiment of the present application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0146] Figure 7 This is a structural schematic diagram of a game scene rendering device provided in an embodiment of the present application, which can be integrated into an electronic device.
[0147] like Figure 7 As shown, the device may include:
[0148] The acquisition module 701 is used to acquire real-time scene data of a game scene to be rendered of a preset web game;
[0149] The processing module 702 is used to analyze the real-time scene data to obtain the real-time scene features of the game scene to be rendered;
[0150] The processing module 702 is further used to determine the target scene texture matching the real-time scene feature according to the real-time scene feature;
[0151] The rendering module 703 is used to perform texture rendering on the three-dimensional scene model of the game scene to be rendered according to the target scene texture, and generate and display the game screen of the game scene to be rendered.
[0152] In an optional implementation, the processing module 702 is further configured to:
[0153] Determine the target position according to the preset screen observation point and the first distance parameter;
[0154] According to the target position, a three-dimensional virtual space is created, and multiple two-dimensional planes are created in the three-dimensional virtual space;
[0155] According to preset transformation configuration parameters, multiple two-dimensional planes are transformed to generate a three-dimensional scene model.
[0156] In an optional implementation, the real-time scene features include: real-time environment features and real-time game features, and the processing module 702 is further used to:
[0157] Selecting environment features and game features of a target sub-scene in a game scene to be rendered from real-time environment features and real-time game features respectively;
[0158] Screening the environment features and game features of the target sub-scene to obtain target environment features and target game features;
[0159] According to the target environment characteristics and the target game characteristics, the target scene texture of the target subscene is determined.
[0160] In an optional implementation, the processing module 702 is specifically configured to:
[0161] The target scene texture is determined according to the real-time viewing angle and real-time scene characteristics of the game scene to be rendered.
[0162] In an optional implementation, the processing module 702 is specifically configured to:
[0163] According to the real-time viewing angle and real-time scene characteristics of the game scene to be rendered, the target scene texture of each surface in the three-dimensional scene model is determined respectively;
[0164] The rendering module 703 is specifically used for:
[0165] According to the target scene texture of each face, texture rendering is performed on each face to generate and display the game screen.
[0166] In an optional implementation, the processing module 702 is specifically configured to:
[0167] When a preset web game is started, or a game scene to be rendered is loaded, a target scene texture is determined from a plurality of pre-generated scene textures according to real-time scene characteristics, and the target scene texture is loaded into a preset texture library;
[0168] Get the target scene texture from the preset texture library.
[0169] In an optional implementation, the processing module 702 is specifically configured to:
[0170] According to the document object model elements of the 3D scene model and the target scene texture of each face, texture rendering is performed on each face to generate and display the game screen. The document object model elements are used to indicate the structural framework of the 3D scene model.
[0171] In an optional implementation, the rendering module 703 is specifically configured to:
[0172] According to the device performance, image processing is performed on the target scene texture to obtain a processed target scene texture;
[0173] According to the processed target scene texture, the 3D scene model is texture rendered to generate and display the game screen.
[0174] In this embodiment, the acquisition module is used to obtain the real-time scene data of the game scene to be rendered of the preset web game, the processing module is used to analyze the real-time scene data to obtain the real-time scene features of the game scene to be rendered, and the processing module is also used to determine the target scene texture that matches the real-time scene features according to the real-time scene features, and the rendering module is used to perform texture rendering on the three-dimensional scene model of the game scene to be rendered according to the target scene texture, and generate and display the game screen of the game scene to be rendered. By adapting the scene texture according to the real-time changes of the game scene, no manual intervention is required, which improves the immersion, intelligence and authenticity of the game.
[0175] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application, such as Figure 8 As shown, the device may include: a processor 801, a memory 802 and a bus 803, the memory 802 stores machine-readable instructions executable by the processor 801, when the electronic device is running, the processor 801 communicates with the memory 802 through the bus 803, and the processor 801 executes the machine-readable instructions to perform the following steps:
[0176] Obtaining real-time scene data of a game scene to be rendered of a preset web game;
[0177] Analyze the real-time scene data to obtain the real-time scene features of the game scene to be rendered;
[0178] According to the real-time scene features, determining the target scene texture matching the real-time scene features;
[0179] The three-dimensional scene model of the game scene to be rendered is texture rendered according to the target scene texture, and the game screen of the game scene to be rendered is generated and displayed.
[0180] In an optional embodiment, before texture rendering is performed on the three-dimensional scene model of the game scene to be rendered according to the target scene texture and a game screen of the game scene to be rendered is generated and displayed, the method further comprises:
[0181] Determine the target position according to the preset screen observation point and the first distance parameter;
[0182] According to the target position, a three-dimensional virtual space is created, and multiple two-dimensional planes are created in the three-dimensional virtual space;
[0183] According to preset transformation configuration parameters, multiple two-dimensional planes are transformed to generate a three-dimensional scene model.
[0184] In an optional implementation, the real-time scene features include: real-time environment features and real-time game features, and the method further includes:
[0185] Selecting environment features and game features of a target sub-scene in a game scene to be rendered from real-time environment features and real-time game features respectively;
[0186] Screening the environment features and game features of the target sub-scene to obtain target environment features and target game features;
[0187] According to the real-time scene features, a target scene texture matching the real-time scene features is determined, including:
[0188] According to the target environment characteristics and the target game characteristics, the target scene texture of the target subscene is determined.
[0189] In an optional implementation, determining a target scene texture matching the real-time scene feature according to the real-time scene feature includes:
[0190] The target scene texture is determined according to the real-time viewing angle and real-time scene characteristics of the game scene to be rendered.
[0191] In an optional implementation, determining the target scene texture according to the real-time viewing angle and real-time scene characteristics of the game scene to be rendered includes:
[0192] According to the real-time viewing angle and real-time scene characteristics of the game scene to be rendered, the target scene texture of each surface in the three-dimensional scene model is determined respectively;
[0193] The 3D scene model of the game scene to be rendered is texture rendered according to the target scene texture, and the game screen of the game scene to be rendered is generated and displayed, including:
[0194] According to the target scene texture of each face, texture rendering is performed on each face to generate and display the game screen.
[0195] In an optional implementation, determining a target scene texture matching the real-time scene feature according to the real-time scene feature includes:
[0196] When a preset web game is started, or a game scene to be rendered is loaded, a target scene texture is determined from a plurality of pre-generated scene textures according to real-time scene characteristics, and the target scene texture is loaded into a preset texture library;
[0197] Get the target scene texture from the preset texture library.
[0198] In an optional implementation, texture rendering is performed on each surface according to the target scene texture of each surface to generate and display a game screen, including:
[0199] According to the document object model elements of the 3D scene model and the target scene texture of each face, texture rendering is performed on each face to generate and display the game screen. The document object model elements are used to indicate the structural framework of the 3D scene model.
[0200] In an optional implementation, texture rendering is performed on a three-dimensional scene model of a game scene to be rendered according to a target scene texture, and a game screen of the game scene to be rendered is generated and displayed, including:
[0201] According to the device performance, image processing is performed on the target scene texture to obtain a processed target scene texture;
[0202] According to the processed target scene texture, the 3D scene model is texture rendered to generate and display the game screen.
[0203] In this embodiment, the processor executes machine-readable instructions to obtain real-time scene data of a game scene to be rendered of a preset web game, analyze the real-time scene data, obtain real-time scene features of the game scene to be rendered, determine a target scene texture matching the real-time scene features according to the real-time scene features, perform texture rendering on a three-dimensional scene model of the game scene to be rendered according to the target scene texture, and generate and display a game screen of the game scene to be rendered. By adapting the scene texture according to the real-time changes of the game scene, no manual intervention is required, thereby improving the immersion, intelligence and authenticity of the game.
[0204] The embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and the computer program is executed by a processor to perform the following steps:
[0205] Obtaining real-time scene data of a game scene to be rendered of a preset web game;
[0206] Analyze the real-time scene data to obtain the real-time scene features of the game scene to be rendered;
[0207] According to the real-time scene features, determining the target scene texture matching the real-time scene features;
[0208] The three-dimensional scene model of the game scene to be rendered is texture rendered according to the target scene texture, and the game screen of the game scene to be rendered is generated and displayed.
[0209] In an optional embodiment, before texture rendering is performed on the three-dimensional scene model of the game scene to be rendered according to the target scene texture and a game screen of the game scene to be rendered is generated and displayed, the method further comprises:
[0210] Determine the target position according to the preset screen observation point and the first distance parameter;
[0211] According to the target position, a three-dimensional virtual space is created, and multiple two-dimensional planes are created in the three-dimensional virtual space;
[0212] According to preset transformation configuration parameters, multiple two-dimensional planes are transformed to generate a three-dimensional scene model.
[0213] In an optional implementation, the real-time scene features include: real-time environment features and real-time game features, and the method further includes:
[0214] Selecting environment features and game features of a target sub-scene in a game scene to be rendered from real-time environment features and real-time game features respectively;
[0215] Screening the environment features and game features of the target sub-scene to obtain target environment features and target game features;
[0216] According to the real-time scene features, a target scene texture matching the real-time scene features is determined, including:
[0217] According to the target environment characteristics and the target game characteristics, the target scene texture of the target subscene is determined.
[0218] In an optional implementation, determining a target scene texture matching the real-time scene feature according to the real-time scene feature includes:
[0219] The target scene texture is determined according to the real-time viewing angle and real-time scene characteristics of the game scene to be rendered.
[0220] In an optional implementation, determining the target scene texture according to the real-time viewing angle and real-time scene characteristics of the game scene to be rendered includes:
[0221] According to the real-time viewing angle and real-time scene characteristics of the game scene to be rendered, the target scene texture of each surface in the three-dimensional scene model is determined respectively;
[0222] The 3D scene model of the game scene to be rendered is texture rendered according to the target scene texture, and the game screen of the game scene to be rendered is generated and displayed, including:
[0223] According to the target scene texture of each face, texture rendering is performed on each face to generate and display the game screen.
[0224] In an optional implementation, determining a target scene texture matching the real-time scene feature according to the real-time scene feature includes:
[0225] When a preset web game is started, or a game scene to be rendered is loaded, a target scene texture is determined from a plurality of pre-generated scene textures according to real-time scene characteristics, and the target scene texture is loaded into a preset texture library;
[0226] Get the target scene texture from the preset texture library.
[0227] In an optional implementation, texture rendering is performed on each surface according to the target scene texture of each surface to generate and display a game screen, including:
[0228] According to the document object model elements of the 3D scene model and the target scene texture of each face, texture rendering is performed on each face to generate and display the game screen. The document object model elements are used to indicate the structural framework of the 3D scene model.
[0229] In an optional implementation, texture rendering is performed on a three-dimensional scene model of a game scene to be rendered according to a target scene texture, and a game screen of the game scene to be rendered is generated and displayed, including:
[0230] According to the device performance, image processing is performed on the target scene texture to obtain a processed target scene texture;
[0231] According to the processed target scene texture, the 3D scene model is texture rendered to generate and display the game screen.
[0232] In this embodiment, the computer program is executed by the processor when it is running to obtain the real-time scene data of the game scene to be rendered of the preset web game, analyze the real-time scene data, obtain the real-time scene features of the game scene to be rendered, determine the target scene texture matching the real-time scene features according to the real-time scene features, perform texture rendering on the three-dimensional scene model of the game scene to be rendered according to the target scene texture, and generate and display the game screen of the game scene to be rendered. By adapting the scene texture according to the real-time changes of the game scene, no manual intervention is required, which improves the immersion, intelligence and authenticity of the game.
[0233] In the embodiment of the present application, the computer program can also execute other machine-readable instructions when run by the processor to execute other methods described in the embodiment. For the specific execution method steps and principles, please refer to the description of the embodiment, which will not be repeated here.
[0234] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0235] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0236] In addition, each functional unit in the embodiments provided in the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0237] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store 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.
[0238] It should be noted that similar numbers and letters represent similar items in the following figures. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. In addition, the terms "first", "second", "third", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0239] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solutions of the present application, rather than to limit them. The protection scope of the present application is not limited thereto. Although the present application is described in detail with reference to the above-mentioned embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-mentioned embodiments within the technical scope disclosed in the present application, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application. They should all be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A game scene rendering method, characterized in that: include: Obtaining real-time scene data of a game scene to be rendered of a preset web game; Analyze the real-time scene data to obtain real-time scene features of the game scene to be rendered; Determining a target scene texture matching the real-time scene feature according to the real-time scene feature; The three-dimensional scene model of the game scene to be rendered is texture rendered according to the target scene texture, and a game screen of the game scene to be rendered is generated and displayed.
2. The method according to claim 1, characterized in that Before texture rendering is performed on the three-dimensional scene model of the game scene to be rendered according to the target scene texture, and a game screen of the game scene to be rendered is generated and displayed, the method further comprises: Determine the target position according to the preset screen observation point and the first distance parameter; Creating a three-dimensional virtual space according to the target position, and creating a plurality of two-dimensional planes in the three-dimensional virtual space; The multiple two-dimensional planes are transformed according to preset transformation configuration parameters to generate the three-dimensional scene model.
3. The method according to claim 1, characterized in that The real-time scene features include: real-time environment features and real-time game features, and the method further includes: Filter the environment characteristics and game characteristics of the target sub-scene under the game scene to be rendered from the real-time environment characteristics and the real-time game characteristics respectively; Screening the environment features and game features of the target sub-scene to obtain target environment features and target game features; The step of determining a target scene texture matching the real-time scene feature according to the real-time scene feature comprises: A target scene texture of the target subscene is determined according to the target environment characteristics and the target game characteristics.
4. The method according to claim 1, characterized in that: The step of determining a target scene texture matching the real-time scene feature according to the real-time scene feature comprises: The target scene texture is determined according to the real-time viewing angle of the game scene to be rendered and the real-time scene characteristics.
5. The method according to claim 4, characterized in that The step of determining the target scene texture according to the real-time viewing angle of the game scene to be rendered and the real-time scene features includes: Determining the target scene texture of each surface in the three-dimensional scene model respectively according to the real-time viewing angle of the game scene to be rendered and the real-time scene characteristics; The step of performing texture rendering on the three-dimensional scene model of the game scene to be rendered according to the target scene texture, and generating and displaying a game screen of the game scene to be rendered, comprises: According to the target scene texture of each surface, texture rendering is performed on each surface to generate and display the game screen.
6. The method according to claim 1, characterized in that The step of determining a target scene texture matching the real-time scene feature according to the real-time scene feature comprises: When the preset web game is started, or when the game scene to be rendered is loaded, the target scene texture is determined from a plurality of pre-generated scene textures according to the real-time scene characteristics, and the target scene texture is loaded into a preset texture library; The target scene texture is acquired from the preset texture library.
7. The method according to claim 5, characterized in that The step of performing texture rendering on each surface according to the target scene texture of each surface to generate and display the game screen includes: According to the document object model elements of the three-dimensional scene model and the target scene textures of the respective faces, texture rendering is performed on the respective faces to generate and display the game screen, wherein the document object model elements are used to indicate the structural framework of the three-dimensional scene model.
8. The method according to claim 1, characterized in that The step of performing texture rendering on the three-dimensional scene model of the game scene to be rendered according to the target scene texture, and generating and displaying a game screen of the game scene to be rendered, comprises: According to the device performance, performing image processing on the target scene texture to obtain a processed target scene texture; According to the processed target scene texture, texture rendering is performed on the three-dimensional scene model to generate and display the game screen.
9. A game scene rendering device, characterized in that: include: An acquisition module is used to acquire real-time scene data of a game scene to be rendered of a preset web game; A processing module, used for analyzing the real-time scene data to obtain the real-time scene features of the game scene to be rendered; The processing module is further used to determine a target scene texture matching the real-time scene feature according to the real-time scene feature; A rendering module is used to perform texture rendering on the three-dimensional scene model of the game scene to be rendered according to the target scene texture, and to generate and display the game screen of the game scene to be rendered.
10. An electronic device, characterized in that: include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate via the bus, and the processor executes the machine-readable instructions to perform the method described in any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 8 is executed.
Citation Information
Cited By
Cloud rendering method and system based on computer
CN120459629A
Computer-based cloud rendering methods and systems
CN120459629B
Game scene optimization method and system based on dynamic rendering
CN120586387A
Dynamic rendering method and system of virtual scene based on virtual game
CN121029041A