Game Sound Reverberation Processing Method, Device, Computer Equipment and Storage Medium
By detecting rays and hit points, the reverb parameters of the game scene are determined, which solves the problems of high resource consumption and low efficiency in the existing technology, and achieves more efficient and accurate game sound reverb processing.
Patent Information
- Application Number
- CN202210956538.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-10
- Publication Date
- 2025-05-27
- Estimated Expiration
- 2042-08-10
AI Technical Summary
The reverb processing methods of existing game scenes have problems such as high resource consumption, low efficiency and poor accuracy, especially in complex environments and real-time changes.
By acquiring multiple detection rays, launching outward from the game character, the first reverb parameters and the second reverb parameters are determined according to the position and number of hit points, combined with the current position of the game character, to characterize the structural characteristics and spatial enclosure of the game scene, and to determine the target reverb value based on these parameters for sound processing.
This method can reduce the number of times the user performs game scene transformation operations, improve the smoothness of game operations, and still perform game operations when the game screen changes, improving the accuracy and efficiency of reverb processing.
Smart Images

Figure CN115282601B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of game technologies, and particularly to a method and apparatus for processing game sound reverberation, a computer device, and a storage medium. Background Art
[0002] With the development of game technologies, in order to enhance the sound effects and immersion of game sounds, reverberation processing is performed on the sounds of game scenes. Generally, the environment of the game scene is first divided into regions, and then different reverberation processing is performed on the game scenes in different regions.
[0003] However, the environments of most game scenes are relatively complex, and the details within the game scene may change in real time as the game progresses, making it defective in terms of large resource consumption, low efficiency, and high inaccuracy to calculate the reverberation data of the game scene in a region-based manner, thus affecting the subsequent reverberation processing effect of game sounds. Summary of the Invention
[0004] Embodiments of this application provide a method and apparatus for processing game sound reverberation, a computer device, and a storage medium, which can reduce the number of times a user performs game scene transformation operations and enable the user to still perform game operations during the process of the game screen changing, so as to improve the fluency of the user in playing the game.
[0005] Embodiments of this application provide a method for processing game sound reverberation. The method includes:
[0006] Obtaining a plurality of detection rays emitted outward from the game character;
[0007] Determining a first reverberation parameter and a second reverberation parameter according to the hit positions and quantities of the hit points and the current position of the game character, where the hit point is the intersection point generated when the detection ray projects onto a first object in the game scene, the first reverberation parameter is used to characterize the structural characteristics of the game scene, and the second reverberation parameter is used to characterize the spatial enclosure of the game scene;
[0008] Determining a target reverberation value according to the first reverberation parameter and the second reverberation parameter;
[0009] Performing reverberation processing on game sounds based on the target reverberation value.
[0010] Embodiments of this application also provide a device for processing game sound reverberation. The device includes:
[0011] A detection ray acquisition module, configured to obtain a plurality of detection rays emitted outward from the game character;
[0012] The reverberation parameter determination module is used to determine a first reverberation parameter and a second reverberation parameter based on the hit position and quantity of the hit points, and the current position of the game character, where the hit point is the intersection point generated when the detection ray projects onto the first object in the game scene, the first reverberation parameter is used to characterize the structural characteristics of the game scene, and the second reverberation parameter is used to characterize the spatial enclosure of the game scene;
[0013] The target reverberation value determination module is used to determine a target reverberation value based on the first reverberation parameter and the second reverberation parameter;
[0014] The reverberation processing module is used to perform reverberation processing on the game sound based on the target reverberation value.
[0015] Optionally, the device further includes:
[0016] The first target reverberation value determination module is used to use the first reverberation value corresponding to the preset area as the target reverberation value if the game character is completely within the preset area;
[0017] The second target reverberation value determination module is used to determine a target reverberation value based on the first reverberation parameter and the second reverberation parameter if the game character is not completely within the preset area.
[0018] Optionally, the detection ray acquisition module further includes:
[0019] The first ray set acquisition sub-module is used to acquire a first ray set, the first ray set includes two first rays, and the two first rays are respectively emitted along the directly above and directly below of the game character;
[0020] The second ray set acquisition sub-module is used to acquire a second ray set, the second ray set includes multiple second rays, the multiple second rays are parallel to the horizontal plane of the game scene, the first of the multiple second rays is emitted along the directly in front of the game character, and each of the other second rays is set at a first preset angular interval;
[0021] The third ray set acquisition sub-module is used to acquire a third ray set, the third ray set includes multiple third rays, the multiple third rays are emitted obliquely above the game character, and the spatial angle between each third ray and the second ray is the first preset angle.
[0022] Optionally, the first reverberation parameter includes the first volume, the first surface area, and the first sound absorption coefficient of the game scene, and the reverberation parameter determination module further includes:
[0023] The first hit point acquisition sub-module is used to acquire the first hit point, where the first hit point is the hit point generated by the first ray;
[0024] The second hit point acquisition sub-module is used to acquire the second hit point, where the second hit point is the hit point generated by the second ray;
[0025] The third hit point acquisition sub-module is used to acquire the third hit point, where the third hit point is the hit point generated by the third ray;
[0026] The first area determination sub-module is used to determine the first area according to the position and quantity of the second hit points. The first area is the area of the polygon formed by multiple first hit points and the first starting point, and the first starting point is the coordinate point of the current position;
[0027] The maximum height determination sub-module is used to determine the maximum height of the game scene according to the position and quantity of the first hit point and the third hit point;
[0028] The first volume and surface area determination sub-module calculates the first volume and the first surface area according to the first area and the maximum height;
[0029] The first sound absorption coefficient determination sub-module determines the first sound absorption coefficient according to the material of the first object corresponding to the hit point.
[0030] Optionally, the first area determination sub-module is specifically used for:
[0031] If the second hit count is not less than the first preset threshold, then acquire the first area of the polygon formed by multiple second hit points and the first starting point, where the second hit count is the quantity of the second hit points, and the first starting point is the central position of the game character;
[0032] If the second hit count is less than the first preset threshold, record the first volume as 0 and record the first surface area as 1;
[0033] If the first hit count, the second hit count, and the third hit count are all 0, then set the first sound absorption coefficient to the default value, where the second hit count and the third hit count are respectively the quantities of the second hit points and the third hit points.
[0034] Optionally, the maximum height determination sub-module further includes:
[0035] A first height acquisition sub-module for acquiring a first height, where the first height represents the maximum vertical height from the hit point generated by the first upper ray and the third ray to the game character. The first upper ray is the first ray emitted directly above the game character. If the hit counts of both the first upper ray and the third ray are 0, then the maximum detection length of the first upper ray and the third ray is used as the first height;
[0036] A second height acquisition sub-module for acquiring a second height, where the second height represents the vertical height from the hit point generated by the first lower ray to the game character. The first lower ray is the first ray emitted directly below the game character. If the hit count of the first lower ray is 0, then the maximum detection length of the first lower ray is used as the second height;
[0037] A difference acquisition sub-module for acquiring the difference between the first height and the second height, and using the difference as the maximum height.
[0038] Optionally, the second reverberation parameter is used to characterize the spatial enclosure of the game scene, and the reverberation parameter acquisition module further includes:
[0039] A first determination module for the second reverberation parameter, which is used to set the second reverberation parameter to 0 if the sum of the number of hit points of the first upper ray and the third ray is less than a second preset threshold and the hit count of the first upper radiation ray is zero;
[0040] A second determination module for the second reverberation parameter, which is used to calculate the second reverberation parameter in a first calculation method or a second calculation method if the sum of the number of hit points of the first upper ray and the third ray is not less than the second preset threshold and the hit count of the first upper radiation ray is not zero.
[0041] Optionally, the second determination module for the second reverberation parameter further includes:
[0042] A first value acquisition sub-module for acquiring a first value, where the first value is the number of second rays that do not hit the first object;
[0043] A second value acquisition sub-module for acquiring a second value, where the second value is the product of the first value and a third value;
[0044] A third determination sub-module for the second reverberation parameter, which is used to use the difference between the default value of the second reverberation parameter and the second value as the second reverberation parameter.
[0045] Optionally, the second determination module for the second reverberation parameter further includes:
[0046] A second ray group acquisition sub-module, configured to acquire a plurality of second ray groups, each of the second ray groups including three adjacent second rays;
[0047] A fourth value acquisition sub-module, configured to acquire a fourth value, where the fourth value is the number of second ray groups that meet a first preset condition, and wherein the first preset condition includes that all the second rays in the second ray group hit the first object, and the value of the second area is greater than the first product, the second area being the area of the shape enclosed by the hit points of the second rays and the center position of the virtual character, and the first product being the product of the sum detection lengths of the two outer second rays in the second ray group;
[0048] A fifth value acquisition sub-module, configured to acquire a fifth value, where the fifth value is the product of the fourth value and a sixth value;
[0049] A second reverberation parameter fourth determination sub-module, configured to use the difference between the default value of the second reverberation parameter and the fifth value as the second reverberation parameter;
[0050] A second reverberation parameter fifth determination sub-module, if the number of second ray groups that meet a second preset condition is not less than a second preset threshold, then configured to set the second reverberation parameter to 0, where the second preset condition includes that all the second rays in the second ray group do not hit the first object.
[0051] Optionally, the target reverberation value includes a reverberation time and a reverberation delay, and the reverberation parameter determination module includes:
[0052] A first reverberation parameter determination sub-module, substituting the first volume, the first surface area, and the sound absorption coefficient into the Sabine formula to calculate a first reverberation parameter;
[0053] A reverberation time determination sub-module, configured to calculate the product of the first reverberation parameter and the second reverberation parameter as the reverberation time;
[0054] A reverberation delay determination sub-module, calculating a second product of a first radius and the second reverberation parameter, and using the quotient of the second product and the speed of sound as the reverberation delay, where the first radius is the radius of a first sphere, and the volume of the first sphere is equal to the first volume.
[0055] Optionally, the target reverberation value first determination module is further specifically configured to:
[0056] If the game character is completely within a plurality of the preset areas, then acquire the priorities of the plurality of preset areas;
[0057] Determine the target reverberation value according to the priorities of the plurality of preset areas.
[0058] An embodiment of the present application further provides a computer device, including a processor and a memory. The memory stores multiple instructions. The processor loads the instructions from the memory to execute the steps in the game sound reverberation processing method described in any of the above embodiments.
[0059] An embodiment of the present application further provides a computer-readable storage medium. The computer-readable storage medium stores multiple instructions, and the instructions are suitable for being loaded by a processor to execute the steps in the game sound reverberation processing method described in any of the above embodiments:
[0060] Obtain a plurality of detection rays, and the plurality of detection rays are emitted outward from the game character.
[0061] Determine a first reverberation parameter and a second reverberation parameter according to the hit position and quantity of the hit points, and the current position of the game character, where the hit point is the intersection point generated when the detection ray projects onto the first object in the game scene, the first reverberation parameter is used to characterize the structural characteristics of the game scene, and the second reverberation parameter is used to characterize the spatial enclosure of the game scene.
[0062] Determine a target reverberation value according to the first reverberation parameter and the second reverberation parameter.
[0063] Perform reverberation processing on the game sound based on the target reverberation value.
[0064] As can be seen from the above, the embodiments of the present application can set a variety of simple and efficient reverberation calculation methods corresponding to the current game scene according to the environmental changes of the game scene, so as to quickly and accurately obtain the reverberation parameters of each position in the game scene, without consuming a large amount of manpower and computing resources for reverberation processing of the game scene. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present application. For those skilled in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0066] Figure 1 It is a system schematic diagram of the game sound reverberation processing device provided by the embodiment of the present application;
[0067] Figure 2 It is a flowchart of the game sound reverberation processing method provided by the embodiment of the present application;
[0068] Figure 3Another schematic flowchart of the game sound reverberation processing method provided by the embodiments of the present application;
[0069] Figure 4 A schematic diagram of detecting the distribution of rays in the game scene provided by the embodiments of the present application;
[0070] Figure 5 A schematic diagram of the second ray distribution provided by the embodiments of the present application;
[0071] Figure 6 A schematic diagram of calculating the second reverberation parameter by the second calculation method provided by the embodiments of the present application;
[0072] Figure 7 A schematic diagram of the game character being completely within the preset area provided by the embodiments of the present application;
[0073] Figure 8 A schematic structural diagram of the game sound reverberation processing device provided by the embodiments of the present application;
[0074] Figure 9 A schematic structural diagram of the computer device provided by the embodiments of the present application;
[0075] Figure 10 A program product applying the game sound reverberation processing method provided by the embodiments of the present application. Detailed implementation manners
[0076] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative efforts belong to the scope of protection of the present application.
[0077] The terms "first", "second", and "third" in this application are for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, features defined with "first", "second", and "third" may explicitly or implicitly include at least one of such features. In the description of this application, the meaning of "a plurality of" is at least two, such as two, three, etc., unless otherwise specifically defined. In the embodiments of this application, all directional indications (such as up, down, left, right, front, back...) are only used to explain the relative positional relationship and movement conditions between components in a specific posture (as shown in the drawings). If the specific posture changes, the directional indications will also change accordingly. In addition, the terms "comprise" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but optionally further includes steps or units not listed, or optionally further includes other steps or units inherent to these processes, methods, products, or devices.
[0078] The embodiments of this application provide a game sound reverberation processing method, apparatus, storage medium, and computer device. Specifically, the game sound reverberation processing method of the embodiments of this application can be executed by a computer device, where the computer device can be a terminal or a server, etc. The terminal can be a smart phone, a tablet computer, a laptop computer, a touch screen, a game console, a personal computer (PC), a personal digital assistant (PDA), etc. The terminal device can also include a client, and the client can be a game application client, a browser client with a game program, or an instant messaging client, etc. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.
[0079] For example, when the game sound reverberation processing method runs on a terminal, the terminal device stores a game application and presents some game scenes in the game through a display component. The terminal device is used to interact with the user through a graphical user interface. For example, the game application is downloaded and installed on the terminal device and run. The ways for the terminal device to provide the graphical user interface to the user can include various methods. For example, it can be rendered and displayed on the display screen of the terminal device, or the graphical user interface can be presented through holographic projection. For example, the terminal device can include a touch display screen and a processor. The touch display screen is used to present the graphical user interface and receive operation instructions generated by the user acting on the graphical user interface. The graphical user interface includes a game screen. The processor is used to run the game, generate the graphical user interface, respond to operation instructions, and control the display of the graphical user interface on the touch display screen.
[0080] For example, when the game sound reverberation processing method runs on a server, it can be a cloud game. A cloud game refers to a game mode based on cloud computing. In the operating mode of a cloud game, the running entity of the game application and the entity presenting the game screen are separated. The storage and running of the game sound reverberation processing method are completed on the cloud game server. The presentation of the game screen is completed on the cloud game client. The cloud game client is mainly used for receiving and sending game data and presenting the game screen. For example, the cloud game client can be a display device with data transmission function near the user side, such as a mobile terminal, a television, a computer, a palm computer, a personal digital assistant, etc. However, the terminal device executing the game sound reverberation processing method is the cloud game server in the cloud. When playing a game, the user operates the cloud game client to send operation instructions to the cloud game server. The cloud game server runs the game according to the operation instructions, encodes and compresses data such as the game screen, returns it to the cloud game client through the network. Finally, the game screen is decoded and output through the cloud game client.
[0081] Please refer to Figure 1 , Figure 1Schematic diagram of the system of the display control device in the game provided by the embodiments of the present application. The system may include at least one terminal 1000, at least one server 2000, at least one database 3000, and a network 4000. The terminal 1000 held by the user can be connected to the servers of different games through the network 4000. The terminal 1000 is any device with computing hardware that can support and execute software products corresponding to the games. In addition, the terminal 1000 has one or more multi-touch sensitive screens for sensing and obtaining inputs of touch or swipe operations performed by the user at multiple points on one or more touch display screens. In addition, when the system includes multiple terminals 1000, multiple servers 2000, and multiple networks 4000, different terminals 1000 can be connected to each other through different networks 4000 and through different servers 2000. The network 4000 can be a wireless network or a wired network. For example, the wireless network can be a wireless local area network (WLAN), a local area network (LAN), a cellular network, a 2G network, a 3G network, a 4G network, a 5G network, etc. In addition, different terminals 1000 can also use their own Bluetooth networks or hotspot networks to connect to other terminals or to the server, etc. For example, multiple users can go online through different terminals 1000, connect through an appropriate network, and synchronize with each other to support multi-player games. In addition, the system may include multiple databases 3000. The multiple databases 3000 are coupled to different servers 2000, and information related to the game environment can be continuously stored in the database 3000 when different users are online for multi-player games.
[0082] Embodiments of the present application provide a method for processing game sound reverberation, which can be executed by a terminal or a server. Embodiments of the present application will be described by taking the method for processing game sound reverberation being executed by a terminal as an example. Among them, the terminal includes a display component and a processor. The display component is used to present a graphical user interface and receive operation instructions generated by a user acting on the display component. When the user operates on the graphical user interface through the display component, the graphical user interface can control the content on the local terminal in response to the received operation instructions, or can control the content of the peer server in response to the received operation instructions. For example, the operation instructions generated by the user acting on the graphical user interface include instructions for starting a game application. The processor is configured to start the game application after receiving the instruction for starting the game application provided by the user. In addition, the processor is configured to render and draw a graphical user interface associated with the game on the touch display screen. The touch display screen is a multi-touch sensitive screen capable of sensing touch or swipe operations performed simultaneously by multiple points on the screen. When the user uses a finger to perform a touch operation on the graphical user interface, when the graphical user interface detects the touch operation, it controls different game characters in the graphical user interface of the game to perform actions corresponding to the touch operation. For example, the game can be any one of casual games, action games, role-playing games, strategy games, sports games, puzzle games, first-person shooting games (FPS), etc. Among them, the game can include a game scene drawn on the graphical user interface. In addition, the game scene of the game can include one or more game characters controlled by the user (or player), such as game characters. Additionally, the game scene of the game can also include one or more obstacles, such as railings, ditches, walls, etc., to restrict the movement of the game characters, for example, restricting the movement of one or more objects to a specific area within the game scene. Optionally, the game scene of the game further includes one or more elements, such as skills, scores, character health status, energy, etc., to provide assistance to the player, provide virtual services, increase scores related to the player's performance, etc. In addition, the graphical user interface can also present one or more indicators to provide indication information to the player. For example, the game can include a game character controlled by the player and one or more other game characters (such as enemy characters). In one embodiment, one or more other game characters are controlled by other players of the game. For example, one or more other game characters can be controlled by a computer, such as a robot using an artificial intelligence (AI) algorithm, to implement a human-computer battle mode. For example, the game character has various skills or abilities used by the game player to achieve goals. For example, the game character has one or more weapons, props, tools, etc. that can be used to eliminate other objects in the game. Such skills or abilities can be activated by the game player using one of multiple preset touch operations on the touch display screen of the terminal.The processor can be configured to present a corresponding game screen in response to an operation instruction generated by a user's touch operation.
[0083] It should be noted that Figure 1 The system schematic diagram of the game sound reverberation processing device shown is only an example. The game sound reverberation processing device and the scenario described in the embodiments of the present application are for more clearly explaining the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. Those of ordinary skill in the art know that with the evolution of the game sound reverberation processing device and the emergence of new business scenarios, the technical solutions provided by the embodiments of the present application are equally applicable to similar technical problems.
[0084] In this embodiment, a description will be made from the perspective of the display control device in the game. The display control device in the game can specifically be integrated in a computer device with a storage unit and installed with a microprocessor and having computing capabilities.
[0085] Please refer to Figure 2 , Figure 2 which is a flowchart of the game sound reverberation processing method provided by the embodiments of the present application. The game sound reverberation processing method includes the following steps:
[0086] Step 201, obtain a plurality of detection rays.
[0087] Among them, the detection ray refers to a virtual divergent ray used to measure game scene related parameters. Specifically, the detection ray can be generated through preset ray parameters. Among them, the ray parameters can include the emission source of the ray, the emission source position, the ray direction, the ray length, the ray, etc. After setting the above ray parameters, the client or server of the target game can control the emission source to emit one or more detection rays.
[0088] Taking game scene detection as an example, the emission source can be a virtual camera, and the position of the virtual camera can be the internal center of the game character. In the game running environment, the virtual camera can emit at least one detection ray, and the system or server can then calculate the relevant parameters in the game scene according to the detection ray. For example, the distance between the game character and the obstacle can be detected according to the detection ray.
[0089] Optionally, step 201 may further include the following steps:
[0090] Obtain a first ray set, the first ray set includes two first rays, and the two first rays are respectively emitted along the directly above and directly below of the game character;
[0091] Obtain a second set of rays, where the second set of rays includes a plurality of second rays that are parallel to the horizontal plane of the game scene. The first of the plurality of second rays is emitted along the front of the game character, and each of the other second rays is set at a first preset angular interval;
[0092] Obtain a third set of rays, where the third set of rays includes a plurality of third rays that are emitted obliquely upward from the game character, and the spatial angle between each third ray and the second ray is the first preset angle.
[0093] Please refer to Figure 4 , Figure 4 which is a schematic diagram of the distribution of detection rays provided by the embodiments of the present application in the game scene.
[0094] In the game sound reverberation processing method of the embodiments of the present application, the reverberation parameters at each position in the game scene are first obtained, and then the sound in the game scene is reverberation-processed based on the obtained reverberation parameters. Therefore, the game character or the virtual camera can be used as the emission source of the detection rays, and the position of the detection rays can be changed by changing the position of the game character or the virtual camera to detect the reverberation parameters at each position in the game scene. It can be understood that in order to ensure the accuracy and efficiency of calculating the reverberation parameters while consuming less computing resources, the parameters of the detection rays need to be set reasonably.
[0095] As Figure 4 shown, assuming that the emission source of the detection rays is the game character or the virtual camera located at the center inside the game character, a first set of rays, a second set of rays, and a third set of rays can be emitted outward with the emission source as the center. It can be understood that since the principle of reverberation is that when sound propagates, it will be reflected and absorbed by obstacles, so that after the sound source stops emitting sound, the sound will still continue for a period of time. Therefore, the parameters such as the emission position, quantity, and direction of the detection rays should be set based on the principle of accurately measuring the obstacles and the size of the game scene in the game scene.
[0096] It should be noted that the obstacles mentioned in this application refer to virtual objects that impede the propagation of game sounds, rather than necessarily virtual objects that serve an obstructive function in the game scene. For example, the obstacles can be any virtual resources in the game scene. The virtual resources can be specific objects in the game scene, such as mountains, rocks, buildings, and walls, etc., which generally refer to objects with a certain area / volume and that affect the sound propagation in the game scene. The virtual resources can be pre-set by developers at a specific location in the game scene, or, according to the game type, for example, in the construction mode of the game, be built by the player controlling the game character in the game. And the virtual resources can be a certain face (the smallest unit of construction) of a house or the entire house. The embodiments of this application do not limit the types of objects in the game scene.
[0097] It should also be noted that the starting emission position of the detection ray in the embodiments of this application, that is, the starting point of the detection ray, is not limited to the center of the game character. For example, the starting emission position can also be the ear position, the head position, etc. of the game character. The embodiments of this application do not limit the starting emission position of the detection ray.
[0098] Among them, the first ray set can include two first rays, and the two first rays are respectively emitted along the directly above and directly below of the game character. It can be understood that the first rays can be used to detect the real-time vertical height of the obstacles in the game scene relative to the game character. For example, in some scenes, when the game character moves from one room to another in the game scene, if the ceiling heights of the two rooms are different, the detection length of the first ray directly above will change. Another example is that in some other scenes, when the game character jumps in the room, the detection lengths of the first rays directly above and directly below will both change. Therefore, by setting two detection rays emitted along the directly above and directly below of the game character, the vertical height of most objects in the game scene relative to the game character can be accurately calculated to improve the accuracy of subsequent reverberation parameter calculation.
[0099] Among them, the second ray set can include multiple second rays, and the multiple second rays can be parallel to the horizontal plane of the game scene. It can be understood that in most game scenes, there are many objects around the game character, such as buildings, walls, bunkers, canyons, etc. in the game scene. Since the starting point of the detection ray is located at the center or other parts of the game character, the emission direction of the detection ray can be set to be parallel to the horizontal plane of the game scene to effectively detect the positions of the objects around the game character in the game scene, so as to accurately calculate the relative distance between the detected object and the game character.
[0100] Among them, the first second ray can be emitted along the due front of the game character, and each of the other second rays can be set at a first preset angular interval. It can be understood that multiple second rays can be set to detect objects around multiple game characters. However, in order not to consume too much computing resources, the number of second rays needs to be set reasonably.
[0101] Please refer to Figure 5 , Figure 5 which is a schematic diagram of the second ray distribution provided by the embodiment of the present application. As Figure 5 shown, the number of second rays can be 8, and the first preset angle can be 45°. In the game scene detection, the game character moving in real time can emit 8 second rays along the due front, due back, due left, due right, front left obliquely, front right obliquely, and back obliquely, so as to be able to detect objects such as walls, canyons, and trees in most game scenes. It should be noted that the purpose of setting multiple second rays at the first preset angular interval is to ensure the uniformity of the second ray distribution. The number of second rays and the first preset angle can both be set flexibly. For example, 10 second rays can be set at an interval of 36°. The embodiment of the present application does not limit the number and the size of the first preset angle of the second rays.
[0102] Among them, the third ray set includes multiple third rays, and the multiple third rays can be emitted along the obliquely upper direction of the game character. According to the previous description, the relative vertical height between the object and the game character in the game scene depends on the objects above and below the game character. It can be understood that in most game scenes, the objects located below the game character are usually objects and terrains with relatively single positions such as the ground or rivers, while due to the diversity of rooms or terrains, setting only the first first ray directly above may not be sufficient to accurately detect the relative vertical height between the object and the game character, or may not be able to detect the objects located above the game character at all. Therefore, multiple third rays can be set, which can not only assist the first ray to detect the relative height between the object and the game character in the game scene, but also cooperate with the first ray to detect the material distribution of more objects in the game scene.
[0103] Optionally, the spatial angle between each third ray and the second ray can be the first preset angle. As Figure 4 shown, the spatial angle between each third ray and any second ray is 45°. To ensure the uniformity of the third ray distribution, the angle between every two adjacent third rays can be set at 90°, so as to accurately detect the objects in the game scene as the game character swims.
[0104] It should be noted that the detection rays of this application are not limited to those from the first ray set, the second ray set, and the third ray set, and parameters such as the number, position, and direction of the first ray, the second ray, and the third ray can also be flexibly set according to the detection requirements for different game scenarios. The embodiments of this application do not limit this.
[0105] From this, it can be seen that in the embodiments of this application, by reasonably setting various parameters of the detection rays, such as the number, position, emission starting point, emission direction, etc. of the detection rays, during the subsequent detection of the game scenario, the detection rays can quickly, accurately, and with low consumption detect the objects in the game scenario as the game character moves in real time, so as to improve the efficiency and accuracy of calculating the reverberation parameters subsequently.
[0106] Step 202: Determine a first reverberation parameter and a second reverberation parameter according to the hit position and number of the hit points, and the current position of the game character.
[0107] Among them, the hit point can be the intersection point generated when the detection ray projects onto the first object in the game scenario. The first reverberation parameter is used to characterize the structural characteristics of the game scenario, and the second reverberation parameter is used to characterize the spatial enclosure of the game scenario. For example, the hit point generated when the second ray shown in Figure 4 projects onto the first object. It should be noted that in order to accurately calculate the reverberation parameter, the hit point does not consider the intersection point generated by reflection.
[0108] Among them, the first reverberation parameter may include the first volume, the first surface area, and the first sound absorption coefficient of the game scenario. It can be understood that when calculating reverberation values such as reverberation time and reverberation delay, the object volume, surface area, and sound absorption coefficient of the material in the current environment are required. Therefore, in the scenario of game sound reverberation processing in the embodiments of this application, the above reverberation parameters of the game scenario also need to be calculated.
[0109] Optionally, step 202 may further include the following steps:
[0110] Obtain a first hit point, where the first hit point is the hit point generated by the first ray;
[0111] Obtain a second hit point, where the second hit point is the hit point generated by the second ray;
[0112] Obtain a third hit point, where the third hit point is the hit point generated by the third ray;
[0113] Determine a first area according to the position and number of the second hit points. The first area is the area of the polygon formed by multiple first hit points and the first starting point, and the first starting point is the coordinate point of the current position;
[0114] Determine the maximum height of the game scene according to the positions and quantities of the first hit point and the third hit point;
[0115] Calculate the first volume and the first surface area according to the first area and the maximum height;
[0116] Determine the first sound absorption coefficient according to the material of the first object corresponding to the hit point.
[0117] It can be understood that when calculating the reverberation of the game scene, the game character can be controlled to move to different positions in the game scene. Since the reverberation is different at different positions, the volume, surface area, sound absorption coefficient and other parameters related to the reverberation can be obtained according to the positions and quantities of the hit points corresponding to the detection rays at different positions.
[0118] Optionally, the first sound absorption coefficient can be determined according to the material of the first object corresponding to the hit point. In some scenarios, when multiple detection rays only project onto the same first object, multiple objects of the same material, or only one detection ray projects onto the first object to generate one hit point. Then the first sound absorption coefficient corresponding to the game character at the current position is the sound absorption coefficient corresponding to the material of the first object.
[0119] In some scenarios, when multiple detection rays project onto multiple first objects, the first sound absorption coefficient α can be expressed as:
[0120] α = (a 1 + 2 … + a n ) / n (1)
[0121] Where 1, 2, and n in formula (1) represent the numbers of the first objects corresponding to the hit points, and n represents the total number of hit points.
[0122] It can be understood that the first sound absorption coefficient can be the average sound absorption coefficient of multiple first objects corresponding to the hit point. That is, after obtaining multiple first objects corresponding to the hit point, the average value of the sound absorption coefficients of the materials of the above multiple first objects can be calculated, and this average value is used as the first sound absorption coefficient of the current position of the game scene. For the calculation methods of the first area, the first volume, and the first surface area, please refer to the descriptions of the following steps.
[0123] Optionally, the step of "determine the first area according to the position and quantity of the second hit point" may include:
[0124] If the second hit number is not less than the first preset threshold, obtain the first area of the polygon formed by multiple second hit points and the first starting point, where the second hit number is the quantity of the second hit points, and the first starting point is the central position of the game character;
[0125] If the second hit count is less than the first preset threshold, set the first volume to 0 and the first surface area to 1;
[0126] If the first hit count, the second hit count, and the third hit count are all 0, set the first sound absorption coefficient to the default value, where the second hit count and the third hit count are the numbers of the second hit point and the third hit point, respectively.
[0127] It can be understood that since the environment of the game scene changes in real time as the game character moves, it has a great impact on the number and position of the hit points of the detection ray. For example, when the game character is inside a house in the game scene, multiple detection rays may be projected onto the walls, ceiling, floor, and objects inside the house. When the game character moves from inside the house to outside the house, the number of objects such as mountains, rivers, and trees outside the house may be less and their position distribution may be more scattered, resulting in a large change in the number and position of the hit points compared to inside the house, and even the number of hit points being 0, making it difficult or impossible to calculate the first reverberation parameter. Therefore, to solve this problem, the first reverberation parameter can be calculated according to the calculation rule set between the hit points and the reverberation parameter.
[0128] For the situation where it is difficult to calculate the first reverberation parameter due to fewer hit points, a first preset threshold related to the second hit count can be set. If the second hit count is less than this first preset threshold, set the first volume to 0 and the first surface area to 1. For example, the first preset threshold can be 3. If the second hit count is less than 3, it means that the detection rays emitted by the game character at the current position hardly hit any objects in the game scene, indicating that there are no or only a few objects affecting reverberation at this position of the game scene. For example, game scenes such as empty valleys and grasslands make it difficult to calculate the first reverberation parameter at this position. Therefore, in this case, the pre-set first volume of 0 and first surface area of 1 can be directly obtained to overcome the game scene environment where the detection rays cannot detect, facilitating the subsequent calculation of the target reverberation value.
[0129] Among them, if the first hit count, the second hit count, and the third hit count are all 0, set the sound absorption coefficient to the default value. It can be understood that similar to the above situation where it is difficult to calculate the first volume and the first surface area, if the hit point is 0, it means that the detection rays emitted by the game character at the current position do not hit any objects, and thus the first sound absorption coefficient of the objects around the game character at the current position cannot be calculated. Then, the default value of the first sound absorption coefficient set in advance can be directly obtained as the first sound absorption coefficient at the current position, so as to also achieve the subsequent calculation of the target reverberation value.
[0130] For the case where there are enough hit points to calculate the first reverberation parameter, the first area can be calculated based on the number and positions of the second hit points and the current position of the game character. Specifically, if the number of second hits is not less than the first preset threshold, the first area of the polygon formed by multiple second hit points and the first starting point is obtained, where the first starting point is the central position of the game character.
[0131] As Figure 5 and Figure 6 shown, assuming that the first preset threshold is 3, and rays 1, 2, and 3 in the second ray project onto the first object to produce three hit points, satisfying the condition that the number of second hits is not less than the first preset threshold. Then, the first area of the polygon formed by multiple second hit points and the first starting point can be further calculated. For example, Figure 6 the first area of the polygon in 1 can be the area S 2 and the sum of the area S.
[0132] Optionally, the step of "determining the maximum height of the game scene according to the positions and numbers of the first hit point and the third hit point" may include:
[0133] Obtain a first height, where the first height represents the maximum vertical height from the hit points generated by the first upper ray and the third ray to the game character. The first upper ray is the first ray emitted directly above the game character. If the number of hits of both the first upper ray and the third ray is 0, then the maximum detection length of the first upper ray and the third ray is taken as the first height;
[0134] Obtain a second height, where the second height represents the vertical height from the hit points generated by the first lower ray to the game character. The first lower ray is the first ray emitted directly below the game character. If the number of hits of the first lower ray is 0, then the maximum detection length of the first lower ray is taken as the second height;
[0135] Obtain the difference between the first height and the second height, and take the difference as the maximum height.
[0136] Optionally, the maximum height h can be expressed as:
[0137] h = h 1 - h 2 (2)
[0138] Where, h 1 in formula (2) represents the first height, and h 2 represents the second height.
[0139] According to the previous description, the third ray can be used as an auxiliary ray for the first upper ray to assist the first upper ray in detecting objects located above the game character. In this way, when calculating the maximum height, since the maximum height is the difference between the first height and the second height, the maximum height is proportional to the value of the first height, and the first height takes the maximum vertical height of the first upper ray and the third ray from the ray starting point (such as the first starting point, the center position point of the game character, etc.).
[0140] Optionally, if the hit counts of both the first upper ray and the third ray are 0, then take the maximum detection length of the first upper ray and the third ray as the first height; if the hit count of the first lower ray is 0, then take the maximum detection length of the first lower ray as the second height.
[0141] It should be noted that when h 1 = h 2 , it can be obtained that the maximum height is 0; when h 1 < h 2 , it can be obtained that the maximum height is negative. Neither of the above two cases affects the subsequent calculation of the target reverberation value.
[0142] It can be understood that when the above situation where the hit point is 0 occurs, it means that the detection rays emitted by the game character in a specific direction at the current position do not hit any objects. For example, when the game character is located in an outdoor game scene, the first upper ray and the third ray may be emitted into the sky and do not hit any objects, so the first height cannot be calculated. Another example is that when the game character performs a parachuting action in the game scene, the first lower ray may not hit any objects, so the second height cannot be calculated. To avoid the situation where the maximum height cannot be calculated due to the inability to calculate the first height and / or the second height, the maximum detection length of the detection rays can be directly used as the first height and the second height to overcome the game scene environment where the detection rays cannot detect, facilitating the subsequent calculation of the target reverberation value.
[0143] Optionally, after calculating the first area and the maximum height, the first volume V can be expressed as:
[0144] V = s × h (3)
[0145] where s in formula (3) is the first area.
[0146] Optionally, the first surface area S can be expressed as:
[0147] S = s × 2 + h × l (4)
[0148] where l in formula (4) is the perimeter of the polygon corresponding to the first area.
[0149] It can be seen from this that the embodiments of the present application can set corresponding ray detection methods according to different situations corresponding to changes in the game scene environment, so as to cope with the environmental changes of the game scene through this ray detection method, so as to quickly and accurately calculate the reverberation parameters of the game scene in a game scene where it is difficult or impossible to calculate the reverberation parameters through ray calculation.
[0150] Among them, the second reverberation parameter can be used to characterize the spatial enclosure of the game scene. The spatial enclosure of the current game scene is inversely proportional to its degree of spatial openness. For example, if the current game scene is inside a house, even if all the doors and windows of the house are open, due to the existence of walls in the house itself and the presence of many objects, the spatial enclosure of this game scene is necessarily greater than the corresponding game scene outside the house. Since reverberation is greatly affected by two factors: object emission and absorption, and the size of the spatial enclosure can reflect whether more reflections and absorptions occur during the sound propagation process, introducing the second reverberation parameter can improve the accuracy of calculating the target reverberation value.
[0151] Optionally, step 202 may further include the following steps:
[0152] If the sum of the number of hit points of the first upper ray and the third ray is less than a second preset threshold, and the number of hits of the first upper radiation line is zero, then record the second reverberation parameter as 0;
[0153] If the sum of the number of hit points of the first upper ray and the third ray is not less than a second preset threshold, and the number of hits of the first upper radiation line is not zero, then calculate the second reverberation parameter by the first calculation method or the second calculation method.
[0154] It can be understood that since the first upper ray and the third ray are detection rays emitted along the upper and obliquely upper directions of the game character, in order to balance saving computing resources and accurately calculating the reverberation parameters, the spatial enclosure of the current game scene can be measured only by judging the number of hit points of the first upper ray and the third ray. For example, if the number of hit points of the first upper ray and the third ray is large, it means that the game character may currently be in an indoor game scene with a ceiling and the spatial enclosure is large; correspondingly, if the number of hit points of the first upper ray and the third ray is small, it means that the game character may currently be in an outdoor and relatively open game scene with a small spatial enclosure.
[0155] Optionally, if the sum of the number of hit points of the first upper ray and the third ray is less than the second preset threshold, and the number of hits of the first upper ray is zero, then the second reverberation parameter is recorded as 0. It can be understood that when the number of hits of the first upper ray is zero, even if there is a third hit point, since the direct upward ray of the game character does not hit any object, it is highly likely that the game character is currently in an outdoor game scene. In order to improve the calculation efficiency without affecting the calculation result of the reverberation parameter, the value of the spatial enclosure in this case can be directly set to 0. Correspondingly, if the sum of the number of hit points of the first upper ray and the third ray is not less than the second preset threshold, and the number of hits of the first upper ray is not zero, then the second reverberation parameter can be calculated by the first calculation method or the second calculation method.
[0156] It should be noted that the first preset threshold and the second preset threshold can be set according to requirements, and the two can be equal or not equal. The specific values corresponding to the first preset threshold and the second preset threshold are not limited in the embodiments of the present application.
[0157] Optionally, the step of "calculating the second reverberation parameter by the first calculation method" may include:
[0158] Obtain a first value, where the first value is the number of second rays that do not hit the first object;
[0159] Obtain a second value, where the second value is the product of the first value and a third value;
[0160] Take the difference between the default value of the second reverberation parameter and the second value as the second reverberation parameter.
[0161] Among them, the default value of the second reverberation parameter is the default value of the spatial enclosure. Preferably, the default value of the spatial enclosure can be set to 1. Among them, the third value can also be set according to experience or requirements. For example, the third value can be set to 1 / 18. Then, calculating the spatial enclosure c by the first calculation method can be expressed as:
[0162] c = 1 - a×1 / 18 (5)
[0163] Among them, a in formula (5) is the first value.
[0164] Optionally, the step of "calculating the second reverberation parameter by the second calculation method" may include:
[0165] Obtain a plurality of second ray groups, and each second ray group includes three adjacent second rays;
[0166] Obtain a fourth value, where the fourth value is the number of second ray groups that meet a first preset condition. The first preset condition includes that all second rays in the second ray group hit the first object, and the value of the second area is greater than the first product. The second area is the area of the shape enclosed by the hit points of the second rays and the center position of the virtual character, and the first product is the product of the sum detection lengths of the two outermost second rays in the second ray group;
[0167] Obtain a fifth value, where the fifth value is the product of the fourth value and a sixth value;
[0168] Use the difference between the default value of the second reverberation parameter and the fifth value as the second reverberation parameter;
[0169] If the number of second ray groups that meet a second preset condition is not less than a second preset threshold, set the second reverberation parameter to 0. The second preset condition includes that all second rays in the second ray group do not hit the first object.
[0170] Please refer to Figure 5 and Figure 6 , Figure 6 which is a schematic diagram of calculating the second reverberation parameter by the second calculation method provided in the embodiment of the present application. As Figure 5 shown, the second rays may include rays 1 to 8 and are divided into 4 second ray groups. For example, the 4 second ray groups may be {ray 1, ray 2, ray 3}, {ray 3, ray 4, ray 5}, {ray 5, ray 6, ray 7}, and {ray 7, ray 8, ray 1}. Such a setting can make the 4 second ray groups located in the front, back, left, and right directions of the game character, so as to better calculate the spatial enclosure through the second ray groups in each direction.
[0171] Furthermore, as Figure 6 shown, assuming that rays 1, 2, and 3 all generate second hit points, meeting the first preset condition can be expressed as:
[0172] S 1 +S 2 >l 1 ×l 2 (6)
[0173] where, in formula (6), S 1 +S 2 is the second area, and l 1 , l 2 are the hit distances of the two outermost rays in this ray group. Taking Figure 6 as an example, l 1 , l 2It can be Ray 1 and Ray 3.
[0174] Then, calculating the spatial enclosure c in the second way can be expressed as:
[0175] c = 1 - p×q (7)
[0176] Wherein, p and q in formula (7) can be the fourth value and the sixth value respectively. The sixth value can be set according to experience and requirements. For example, the sixth value can be set to 1 / 18, and p×q is the fifth value.
[0177] Optionally, if the number of the second ray groups that meet the second preset condition is not less than the second preset threshold, then set the second reverberation parameter to 0. Wherein, the second preset condition may include: all the second rays in the second ray group do not hit the first object. Assuming that the second preset threshold is 2, it can be understood that when there are at least 2 second ray groups in which all the second rays do not generate hit points, it means that there are no objects in at least 2 directions at the current position of the game character, which is sufficient to reflect that the airborne enclosure at the current position of the game scene is poor and the value of the spatial enclosure is low.
[0178] It should be noted that the first calculation method and the second calculation method can coexist without conflict, and which calculation method to use to calculate the spatial enclosure can be selected according to specific requirements.
[0179] As can be seen from the above, on the basis of introducing the spatial enclosure to improve the calculation accuracy of the reverberation parameter, the embodiments of the present application further set multiple calculation methods for the spatial enclosure to quickly and accurately calculate the size of the spatial enclosure in a real-time changing game scene, so as to improve the accuracy of calculating the target reverberation value subsequently.
[0180] Step 203: Determine the target reverberation value according to the first reverberation parameter and the second reverberation parameter.
[0181] Wherein, the target reverberation value may include the reverberation time and the reverberation delay.
[0182] Optionally, step 203 may further include the following steps:
[0183] Substitute the first volume, the first surface area, and the sound absorption coefficient into the Sabine formula to calculate the first reverberation parameter;
[0184] Calculate the product of the first reverberation parameter and the second reverberation parameter as the reverberation time;
[0185] Calculate the second product of the first radius and the second reverberation parameter, and use the quotient of the second product and the speed of sound as the reverberation delay, wherein the first radius is the radius of the first sphere, and the volume of the first sphere is equal to the first volume.
[0186] Among them, the reverberation time can be T60, which represents the time required for the sound pressure level to decrease by 60 decibels. The reverberation delay can be TFR, which represents the time expected for the first-order reflected sound to reach the listener's position.
[0187] Optionally, the reverberation time T60 can be expressed as:
[0188]
[0189] Optionally, the reverberation delay TFR can be expressed as:
[0190]
[0191] Among them, r in formula (9) is the first radius, and v is the speed of sound.
[0192] Optionally, the method of the embodiment of the present application may further include the following steps:
[0193] If the game character is completely within the preset area, then use the first reverberation value corresponding to the preset area as the target reverberation value;
[0194] If the game character is not completely within the preset area, then determine the target reverberation value according to the first reverberation parameter and the second reverberation parameter.
[0195] It can be understood that in order to obtain a personalized customized reverberation processing effect in the game scene, one or more preset areas can be divided at each position in some game scenes. Among them, the preset area can be a closed or semi-closed shape, such as a cube, a cuboid, a polygon, etc. In the game test scene, each preset area has a corresponding first reverberation value. It can be understood that the preset area can be pre-set with corresponding volume, surface area, and sound absorption coefficient so that the preset area has a corresponding first reverberation value.
[0196] Optionally, if the game character is completely within the preset area, then use the first reverberation value corresponding to the preset area as the target reverberation value. If the game character is not completely within the preset area, then after calculating the reverberation parameter according to the detection ray, determine the target reverberation value according to the calculated reverberation parameter.
[0197] Among them, the step "If the game character is completely within the preset area, then use the first reverberation value corresponding to the preset area as the target reverberation value" may include:
[0198] If the game character is completely within multiple preset areas, then obtain the priorities of the multiple preset areas;
[0199] Determine the target reverberation value according to the priorities of the multiple preset areas.
[0200] Please refer to Figure 7 , Figure 7 , which is a schematic diagram showing that the game character provided by the embodiment of the present application is completely within the preset area. As Figure 7 shown, when the game character is completely within the first preset area and the second preset area, the first reverberation value of the preset area with a higher priority can be used as the target reverberation value of the current position. It can be understood that if the first preset area and the second preset area have equal priorities, a first reverberation value can be determined by random selection or manual selection as the final target reverberation value.
[0201] As can be seen from the above, when calculating the reverberation value of the game scene, a preset area with a first reverberation value can be set first. When the game character completely enters this preset area, the first reverberation value can be used as the reverberation value of the current position of this game scene, so as to obtain the reverberation value that meets the personalized customization requirements. And when the game character is not completely within this preset area, the target reverberation value is still calculated by the method of detecting rays to calculate the reverberation parameters, so that there is no need to set too many preset areas, and on the basis of consuming less computing resources, the target reverberation value of the game scene can be calculated accurately and quickly.
[0202] Step 204, perform reverberation processing on the game sound based on the target reverberation value.
[0203] After determining the target reverberation value, the scene sound effect can be set according to the target reverberation value of the game character at the current position. By performing reverberation processing on the sound effect of the game scene and making the game character use different target reverberation values to process the scene sound effect at different positions, the user of this game can obtain a sound effect closer to the real scene.
[0204] As can be seen from the above, the embodiment of the present application can set a variety of simple and efficient reverberation calculation methods corresponding to the current game scene according to the environmental changes of the game scene, so as to quickly and accurately obtain the reverberation parameters of each position in the game scene without consuming a large amount of manpower and computing resources for reverberation processing of the game scene. In addition, since a variety of reverberation parameter calculation methods matching the changes of the game scene can be set according to the real-time changes of the environment in the game scene in the embodiment of the present application, not only can the reverberation parameters be accurately and efficiently calculated in a game scene where it is difficult or impossible to calculate the reverberation parameters, but also a certain dynamic change situation of the game scene can be detected through this method. For example, when a wall is destroyed in the game scene, the detection distance and the hit point of the detection ray will change instantaneously, causing the reverberation parameters to change, so as to obtain the dynamic reverberation processing effect of the game sound.
[0205] Please refer to Figure 3 , Figure 3Another schematic flowchart of the game sound reverberation processing method provided by the embodiments of the present application. The specific process of this method can be as follows:
[0206] Step 301: Obtain a preset area in the game scene. If the game character is completely within the preset area, use the first reverberation value corresponding to the preset area as the target reverberation value.
[0207] Step 302: If the game character is not completely within the preset area, obtain the first ray set, the second ray set, and the third ray set.
[0208] Step 303: Obtain the first hit point, the second hit point, and the third hit point.
[0209] Step 304: Determine the first area according to the position and quantity of the second hit point.
[0210] Step 305: Determine the maximum height of the game scene according to the position and quantity of the first hit point and the third hit point.
[0211] Step 306: Calculate the first volume and the first surface area according to the first area and the maximum height.
[0212] Step 307: Determine the first sound absorption coefficient according to the material of the first object corresponding to the hit point.
[0213] Step 308: Determine the second reverberation parameter.
[0214] Step 309: Substitute the first volume, the first surface area, and the sound absorption coefficient into the Sabine formula to calculate the first reverberation parameter.
[0215] Step 310: Calculate the product of the first reverberation parameter and the second reverberation parameter as the reverberation time.
[0216] Step 311: Calculate the second product of the first radius and the second reverberation parameter, and use the quotient of the second product and the speed of sound as the reverberation delay.
[0217] To better implement the above method, the embodiments of the present application also provide a game sound reverberation processing device. Please refer to Figure 8 , Figure 8 which is a schematic structural diagram of the game sound reverberation processing device provided by the embodiments of the present application. The device is applied to the graphical user interface of the target game, and the graphical user interface displays the first game scene. The device includes:
[0218] A detection ray acquisition module 401, configured to acquire a plurality of detection rays, and the plurality of detection rays are emitted outward from the game character;
[0219] The reverberation parameter determination module 402 is configured to determine a first reverberation parameter and a second reverberation parameter according to the hit positions and quantities of the hit points and the current position of the game character, where the hit points are the intersection points generated when the detection rays are projected onto a first object in the game scene, the first reverberation parameter is used to characterize the structural characteristics of the game scene, and the second reverberation parameter is used to characterize the spatial enclosure of the game scene;
[0220] The target reverberation value determination module 403 is configured to determine a target reverberation value according to the first reverberation parameter and the second reverberation parameter;
[0221] The reverberation processing module 404 is configured to perform reverberation processing on the game sound based on the target reverberation value.
[0222] Optionally, the device further includes:
[0223] The first target reverberation value determination module is configured to use the first reverberation value corresponding to the preset area as the target reverberation value if the game character is completely within the preset area;
[0224] The second target reverberation value determination module is configured to determine a target reverberation value according to the first reverberation parameter and the second reverberation parameter if the game character is not completely within the preset area.
[0225] Optionally, the detection ray acquisition module further includes:
[0226] The first ray set acquisition sub-module is configured to acquire a first ray set, where the first ray set includes two first rays that are respectively emitted along the directly above and directly below of the game character;
[0227] The second ray set acquisition sub-module is configured to acquire a second ray set, where the second ray set includes a plurality of second rays that are parallel to the horizontal plane of the game scene, the first of the plurality of second rays is emitted along the directly in front of the game character, and each of the other second rays is set at a first preset angular interval;
[0228] The third ray set acquisition sub-module is configured to acquire a third ray set, where the third ray set includes a plurality of third rays that are emitted along the obliquely above of the game character, and the spatial angle between each third ray and the second ray is the first preset angle.
[0229] Optionally, the first reverberation parameter includes the first volume, the first surface area, and the first sound absorption coefficient of the game scene, and the reverberation parameter determination module further includes:
[0230] The first hit point acquisition sub-module is used to acquire the first hit point, where the first hit point is the hit point generated by the first ray;
[0231] The second hit point acquisition sub-module is used to acquire the second hit point, where the second hit point is the hit point generated by the second ray;
[0232] The third hit point acquisition sub-module is used to acquire the third hit point, where the third hit point is the hit point generated by the third ray;
[0233] The first area determination sub-module is used to determine the first area according to the position and quantity of the second hit points. The first area is the area of the polygon formed by multiple first hit points and the first starting point, and the first starting point is the coordinate point of the current position;
[0234] The maximum height determination sub-module is used to determine the maximum height of the game scene according to the positions and quantities of the first hit point and the third hit point;
[0235] The first volume and surface area determination sub-module calculates the first volume and the first surface area according to the first area and the maximum height;
[0236] The first sound absorption coefficient determination sub-module determines the first sound absorption coefficient according to the material of the first object corresponding to the hit point.
[0237] Optionally, the first area determination sub-module is specifically used for:
[0238] If the second hit count is not less than the first preset threshold, acquire the first area of the polygon formed by multiple second hit points and the first starting point, where the second hit count is the quantity of the second hit points, and the first starting point is the central position of the game character;
[0239] If the second hit count is less than the first preset threshold, record the first volume as 0 and the first surface area as 1;
[0240] If the first hit count, the second hit count, and the third hit count are all 0, set the first sound absorption coefficient to the default value, where the second hit count and the third hit count are respectively the quantities of the second hit point and the third hit point.
[0241] Optionally, the maximum height determination sub-module further includes:
[0242] The first height acquisition sub-module is used to acquire a first height, where the first height represents the maximum vertical height from the hit point generated by the first upper ray and the third ray to the game character. The first upper ray is the first ray emitted directly above the game character. If the hit counts of both the first upper ray and the third ray are 0, then the maximum detection length of the first upper ray and the third ray is used as the first height;
[0243] The second height acquisition sub-module is used to acquire a second height, where the second height represents the vertical height from the hit point generated by the first lower ray to the game character. The first lower ray is the first ray emitted directly below the game character. If the hit count of the first lower ray is 0, then the maximum detection length of the first lower ray is used as the second height;
[0244] The difference acquisition sub-module is used to acquire the difference between the first height and the second height, and use the difference as the maximum height.
[0245] Optionally, the second reverberation parameter is used to characterize the spatial enclosure of the game scene, and the reverberation parameter acquisition module further includes:
[0246] The first determination module for the second reverberation parameter, if the sum of the number of hit points of the first upper ray and the third ray is less than a second preset threshold, and the hit count of the first upper radiation ray is zero, is used to record the second reverberation parameter as 0;
[0247] The second determination module for the second reverberation parameter, if the sum of the number of hit points of the first upper ray and the third ray is not less than the second preset threshold, and the hit count of the first upper radiation ray is not zero, is used to calculate the second reverberation parameter in a first calculation method or a second calculation method.
[0248] Optionally, the second determination module for the second reverberation parameter further includes:
[0249] The first value acquisition sub-module is used to acquire a first value, where the first value is the number of second rays that do not hit the first object;
[0250] The second value acquisition sub-module is used to acquire a second value, where the second value is the product of the first value and a third value;
[0251] The third determination sub-module for the second reverberation parameter is used to use the difference between the default value of the second reverberation parameter and the second value as the second reverberation parameter.
[0252] Optionally, the second determination module for the second reverberation parameter further includes:
[0253] A second ray group acquisition sub-module, configured to acquire a plurality of second ray groups, each of the second ray groups including three adjacent second rays;
[0254] A fourth value acquisition sub-module, configured to acquire a fourth value, where the fourth value is the number of second ray groups that meet a first preset condition. The first preset condition includes that all the second rays in the second ray group hit the first object, and the value of the second area is greater than the first product. The second area is the area of the shape formed by the hit points of the second rays and the center position of the virtual character, and the first product is the product of the sum detection lengths of the two outer second rays in the second ray group;
[0255] A fifth value acquisition sub-module, configured to acquire a fifth value, where the fifth value is the product of the fourth value and a sixth value;
[0256] A second reverberation parameter fourth determination sub-module, configured to use the difference between the default value of the second reverberation parameter and the fifth value as the second reverberation parameter;
[0257] A second reverberation parameter fifth determination sub-module, if the number of second ray groups that meet a second preset condition is not less than a second preset threshold, then configured to set the second reverberation parameter to 0. The second preset condition includes that all the second rays in the second ray group do not hit the first object.
[0258] Optionally, the target reverberation value includes reverberation time and reverberation delay, and the reverberation parameter determination module includes:
[0259] A first reverberation parameter determination sub-module, substituting the first volume, the first surface area, and the sound absorption coefficient into the Sabine formula to calculate a first reverberation parameter;
[0260] A reverberation time determination sub-module, configured to calculate the product of the first reverberation parameter and the second reverberation parameter as the reverberation time;
[0261] A reverberation delay determination sub-module, calculating a second product of a first radius and the second reverberation parameter, and using the quotient of the second product and the speed of sound as the reverberation delay. The first radius is the radius of a first sphere, and the volume of the first sphere is equal to the first volume.
[0262] Optionally, the target reverberation value first determination module is further specifically configured to:
[0263] If the game character is completely within a plurality of the preset regions, then acquire the priorities of the plurality of preset regions;
[0264] Determine the target reverberation value according to the priorities of the plurality of preset regions.
[0265] An embodiment of the present application further provides a computer device, including a processor and a memory. The memory stores multiple instructions. The processor loads the instructions from the memory to execute the steps in the game sound reverberation processing method described in any of the foregoing embodiments.
[0266] An embodiment of the present application further provides a computer-readable storage medium. The computer-readable storage medium stores multiple instructions, and the instructions are suitable for being loaded by a processor to execute the steps in the game sound reverberation processing method described in any of the foregoing embodiments:
[0267] Obtain a plurality of detection rays, and the plurality of detection rays are emitted outward from the game character.
[0268] Determine a first reverberation parameter and a second reverberation parameter according to the hit position and quantity of the hit points, and the current position of the game character. Wherein, the hit point is the intersection point generated when the detection ray projects onto the first object in the game scene. The first reverberation parameter is used to characterize the structural characteristics of the game scene, and the second reverberation parameter is used to characterize the spatial enclosure of the game scene.
[0269] Determine a target reverberation value according to the first reverberation parameter and the second reverberation parameter.
[0270] Perform reverberation processing on the game sound based on the target reverberation value.
[0271] In specific implementation, each of the above units can be implemented as an independent entity, or can be combined arbitrarily to be implemented as the same or several entities. For the specific implementation of each of the above units, reference can be made to the foregoing method embodiments, which will not be elaborated here.
[0272] The game sound reverberation processing device provided by the embodiment of the present application obtains a plurality of detection rays, and the plurality of detection rays are emitted outward from the game character. Then, according to the hit position and quantity of the hit points, and the current position of the game character, a first reverberation parameter and a second reverberation parameter are determined. Wherein, the hit point is the intersection point generated when the detection ray projects onto the first object in the game scene. The first reverberation parameter is used to characterize the structural characteristics of the game scene, and the second reverberation parameter is used to characterize the spatial enclosure of the game scene. Then, a target reverberation value is determined according to the first reverberation parameter and the second reverberation parameter. Finally, reverberation processing is performed on the game sound based on the target reverberation value.
[0273] As described above, the embodiments of the present application can set a variety of simple and efficient reverberation calculation methods corresponding to the current game scene according to the environmental changes of the game scene, so as to quickly and accurately obtain the reverberation parameters of each position in the game scene, without consuming a large amount of manpower and computing resources for reverberation processing of the game scene. In addition, since the embodiments of the present application can set a variety of reverberation parameter calculation methods matching the changes of the game scene according to the real-time changes of the environment in the game scene, it can not only accurately and efficiently calculate the reverberation parameters in game scenes where it is difficult or impossible to calculate the reverberation parameters, but also detect certain dynamic changes in the game scene through this method. For example, when a wall is destroyed in the game scene, the detection distance and hit point of the detection ray will change instantaneously, causing the reverberation parameters to change, so as to obtain the dynamic reverberation processing effect of the game sound.
[0274] Correspondingly, the embodiments of the present application further provide a computer device, which can be a terminal or a server. The terminal can be a terminal device such as a smart phone, a tablet computer, a notebook computer, a touch screen, a game console, a personal computer, a personal digital assistant (Personal Digital Assistant, PDA), etc.
[0275] As Figure 9 shown, Figure 9 is a schematic structural diagram of the computer device provided by the embodiments of the present application. The computer device 500 includes a processor 501 with one or more processing cores, a memory 502 with one or more computer-readable storage media, and a computer program stored on the memory 502 and executable on the processor. Among them, the processor 501 is electrically connected to the memory 502. Those skilled in the art can understand that the structural diagram of the computer device shown in the figure does not constitute a limitation on the computer device, and it may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.
[0276] The processor 501 is the control center of the computer device 500, connecting various parts of the entire computer device 500 through various interfaces and lines. By running or loading software programs and / or modules stored in the memory 502, and calling data stored in the memory 502, it executes various functions of the computer device 500 and processes data, thereby monitoring the entire computer device 500.
[0277] In the embodiments of the present application, the processor 501 in the computer device 500 will load the instructions corresponding to the processes of one or more application programs into the memory 502 according to the following steps, and the processor 501 will run the application programs stored in the memory 502 to implement various functions:
[0278] Obtain a plurality of detection rays that are emitted outward from the game character;
[0279] Determine a first reverberation parameter and a second reverberation parameter based on the hit positions and quantities of the hit points, and the current position of the game character, where the hit points are the intersection points generated when the detection rays are projected onto a first object within the game scene, the first reverberation parameter is used to characterize the structural characteristics of the game scene, and the second reverberation parameter is used to characterize the spatial enclosure of the game scene;
[0280] Determine a target reverberation value according to the first reverberation parameter and the second reverberation parameter;
[0281] Perform reverberation processing on the game sound based on the target reverberation value.
[0282] It can be seen from this that the embodiments of the present application can set a variety of simple and efficient reverberation calculation methods corresponding to the current game scene according to the environmental changes of the game scene, so as to quickly and accurately obtain the reverberation parameters of each position in the game scene, without consuming a large amount of manpower and computing resources for reverberation processing of the game scene. In addition, since the embodiments of the present application can set a variety of reverberation parameter calculation methods matching the changes of the game scene according to the real-time changes of the environment in the game scene, it can not only accurately and efficiently calculate the reverberation parameters in game scenes where it is difficult or impossible to calculate the reverberation parameters, but also detect certain dynamic changes in the game scene through this method. For example, when a wall is destroyed in the game scene, the detection distance and hit points of the detection rays will change instantaneously, causing the reverberation parameters to change, so as to obtain the dynamic reverberation processing effect of the game sound.
[0283] For the specific implementation of each of the above operations, reference may be made to the previous embodiments, and details are not described herein again.
[0284] Optionally, as Figure 9 shown, the computer device 500 further includes: a touch display screen 503, a radio frequency circuit 504, an audio circuit 505, an input unit 506, and a power supply 507. Among them, the processor 501 is electrically connected to the touch display screen 503, the radio frequency circuit 504, the audio circuit 505, the input unit 506, and the power supply 507 respectively. Those skilled in the art can understand that Figure 9 the computer device structure shown in
[0285] The touch display screen 503 can be used to display a graphical user interface and receive operation instructions generated by a user acting on the graphical user interface. The touch display screen 503 may include a display panel and a touch panel. Among them, the display panel can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces of the computer device. These graphical user interfaces can be composed of graphics, text, icons, videos, and any combination thereof. Optionally, the display panel can be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc. The touch panel can be used to collect touch operations of the user on or near it (such as operations of the user using a finger, a stylus, or any suitable object or accessory on or near the touch panel), and generate corresponding operation instructions, and the operation instructions execute the corresponding program. Optionally, the touch panel can include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the touch orientation of the user, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into contact coordinates, and then sends it to the processor 501, and can receive and execute the commands sent by the processor 501. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it is transmitted to the processor 501 to determine the type of touch event. Subsequently, the processor 501 provides a corresponding visual output on the display panel according to the type of touch event. In the embodiments of the present application, the touch panel and the display panel can be integrated into the touch display screen 503 to implement input and output functions. However, in some embodiments, the touch panel and the touch panel can be implemented as two independent components to implement input and output functions. That is, the touch display screen 503 can also be used as a part of the input unit 506 to implement the input function.
[0286] In the embodiments of the present application, by executing a game application program by the processor 501, a graphical user interface is generated on the touch display screen 503. At least one skill control area is included in the game scene on the graphical user interface, and at least one skill control is included in the skill control area. The touch display screen 503 is used to present the graphical user interface and receive operation instructions generated by a user acting on the graphical user interface.
[0287] The radio frequency circuit 504 can be used to transmit and receive radio frequency signals to establish wireless communication with a network device or other computer devices through wireless communication, and transmit and receive signals with the network device or other computer devices.
[0288] The audio circuit 505 can be used to provide an audio interface between the user and the computer device through a speaker and a microphone. The audio circuit 505 can convert the received audio data into an electrical signal and transmit it to the speaker, which converts it into a sound signal for output. On the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 505, converted into audio data, and then the audio data is output to the processor 501 for processing. After that, it is sent through the radio frequency circuit 504 to, for example, another computer device, or the audio data is output to the memory 502 for further processing. The audio circuit 505 may also include an earphone jack to provide communication between the peripheral earphone and the computer device.
[0289] The input unit 506 can be used to receive input digital, character information or user feature information (such as fingerprint, iris, face information, etc.), and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function controls.
[0290] The power supply 507 is used to supply power to each component of the computer device 500. Optionally, the power supply 507 can be logically connected to the processor 501 through a power management system, so as to realize functions such as management of charging, discharging, and power consumption management through the power management system. The power supply 507 may also include any components such as one or more DC or AC power supplies, a recharge system, a power failure detection circuit, a power converter or inverter, and a power status indicator.
[0291] Although Figure 9 not shown in the figure, the computer device 500 may also include a camera, a sensor, a Wi-Fi module, a Bluetooth module, etc., which will not be elaborated here.
[0292] In the above embodiments, the descriptions of the various embodiments have their own emphases. For the parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0293] As can be seen from the above, in the embodiments of the present application, by dividing the graphical user interface of the game into multiple sub-interfaces, when the user performs a target operation in a certain sub-interface and the game scene displayed in this sub-interface changes, the user can still perform game operations in other sub-interfaces to reduce unnecessary target operations and the number of game scene changes. Thus, it can effectively improve the fluency of user operations and reduce the running overhead of the game server.
[0294] Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructions, or by controlling relevant hardware through instructions. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0295] To this end, an embodiment of the present application provides a computer-readable storage medium, which stores multiple computer programs that can be loaded by a processor to execute the steps in any one of the game sound reverberation processing methods provided by the embodiments of the present application. For example, the computer program can execute the following steps:
[0296] Obtain a plurality of detection rays that are emitted outward from the game character;
[0297] Determine a first reverberation parameter and a second reverberation parameter according to the hit position and quantity of the hit points, and the current position of the game character, where the hit point is the intersection point generated when the detection ray projects onto the first object in the game scene, the first reverberation parameter is used to characterize the structural characteristics of the game scene, and the second reverberation parameter is used to characterize the spatial enclosure of the game scene;
[0298] Determine a target reverberation value according to the first reverberation parameter and the second reverberation parameter;
[0299] Perform reverberation processing on the game sound based on the target reverberation value.
[0300] For the specific implementation of each of the above operations, reference can be made to the previous embodiments, which will not be elaborated here.
[0301] Among them, the storage medium may include: read-only memory (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disc, etc.
[0302] Since the computer program stored in the storage medium can execute the steps in any one of the game sound reverberation processing methods provided by the embodiments of the present application, the beneficial effects that can be achieved by any one of the game sound reverberation processing methods provided by the embodiments of the present application can be realized. For details, reference can be made to the previous embodiments, which will not be elaborated here.
[0303] Reference Figure 10 As shown, a program product 61 for implementing the above method according to an embodiment of the present invention is described. It can use a portable compact disc read-only memory (CD-ROM) and include program code, and can run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, the readable storage medium can be any tangible medium that contains or stores a program, and the program can be used by or in combination with an instruction execution system, device, or device.
[0304] The program product may employ any combination of one or more readable media. The readable media may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0305] The computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which the readable program code is carried. Such a propagated data signal may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. The readable signal medium may also be any readable medium other than the readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device.
[0306] The program code contained on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0307] The program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and also including conventional procedural programming languages such as the "C" language or similar programming languages. The program code may execute entirely on the user computing device, partially on the user device, as a stand-alone software package, partially on the user computing device and partially on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
[0308] The above has introduced in detail a method, device, storage medium, and computer device for processing game sound reverberation provided by the embodiments of the present application. Specific examples are used in this article to elaborate on the principle and implementation manner of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application; at the same time, for those skilled in the art, according to the idea of the present application, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation to the present application.
Claims
1. A method for reverberation processing of game sounds, characterized in that, the method includes: Obtaining a plurality of detection rays, which are emitted outward from a game character; Determining a first reverberation parameter and a second reverberation parameter according to the hit positions and quantities of the hit points, and the current position of the game character, wherein the hit point is the intersection point generated when the detection ray projects onto a first object in the game scene, the first reverberation parameter is used to characterize the structural characteristics of the game scene, the second reverberation parameter is used to characterize the spatial enclosure of the game scene, and the first reverberation parameter includes the first volume, the first surface area, and the first sound absorption coefficient of the game scene; Determining a target reverberation value according to the first reverberation parameter and the second reverberation parameter; Performing reverberation processing on the game sound based on the target reverberation value; Wherein, the determining of the first reverberation parameter according to the hit positions and quantities of the hit points, and the current position of the game character, includes: Obtaining a first hit point, which is the hit point generated by a first ray, and the first ray includes rays emitted respectively directly above and directly below the game character; Obtaining a second hit point, which is the hit point generated by a second ray, and the second ray is a ray parallel to the horizontal plane of the game scene, the first of the second rays is emitted directly in front of the game character, and each of the other second rays is set at a first preset angular interval; Obtaining a third hit point, which is the hit point generated by a third ray, and a plurality of third rays are emitted obliquely above the game character, and the spatial angle between each third ray and the second ray is the first preset angle; Determining a first area according to the positions and quantities of the second hit points, and the first area is the area of the polygon formed by a plurality of the first hit points and a first starting point, and the first starting point is the coordinate point of the current position; Determining the maximum height of the game scene according to the positions and quantities of the first hit point and the third hit point; Calculating the first volume and the first surface area according to the first area and the maximum height; Determining the first sound absorption coefficient according to the material of the first object corresponding to the hit point.
2. The method according to claim 1, characterized in that, the method further includes: If the game character is completely within a preset area, then using the first reverberation value corresponding to the preset area as the target reverberation value, wherein, by presetting the corresponding volume, surface area, and sound absorption coefficient for the preset area, so that the preset area has a corresponding first reverberation value; If the game character is not completely within the preset area, then determining the target reverberation value according to the first reverberation parameter and the second reverberation parameter.
3. The method according to claim 1, characterized in that, the obtaining of the plurality of detection rays includes: Obtaining a first ray set, and the first ray set includes two first rays; Obtaining a second ray set, and the second ray set includes a plurality of second rays; Obtain a third ray set, where the third ray set includes a plurality of third rays.
4. The method according to claim 1, wherein, determining the first area according to the position and quantity of the second hit points includes: If the second hit count is not less than a first preset threshold, obtain the first area of the polygon formed by a plurality of the second hit points and the first starting point, where the second hit count is the quantity of the second hit points, and the first starting point is the central position of the game character; If the second hit count is less than the first preset threshold, record the first volume as 0 and the first surface area as 1; If the first hit count, the second hit count, and the third hit count are all 0, set the first sound absorption coefficient to a default value, where the second hit count and the third hit count are respectively the quantities of the second hit points and the third hit points.
5. The method according to claim 1, wherein, determining the maximum height of the game scene according to the positions and quantities of the first hit points and the third hit points includes: Obtain a first height, where the first height represents the maximum vertical height from the hit points generated by the first upper ray and the third ray to the game character. The first upper ray is the first ray emitted directly above the game character. If the hit counts of the first upper ray and the third ray are both 0, then use the maximum detection length among the first upper ray and the third ray as the first height; Obtain a second height, where the second height represents the vertical height from the hit points generated by the first lower ray to the game character. The first lower ray is the first ray emitted directly below the game character. If the hit count of the first lower ray is 0, then use the maximum detection length of the first lower ray as the second height; Obtain the difference between the first height and the second height, and use the difference as the maximum height.
6. The method according to claim 5, wherein, determining the second reverberation parameter includes: If the sum of the quantities of the hit points of the first upper ray and the third ray is less than a second preset threshold, and the hit count of the first upper radiation ray is zero, then record the second reverberation parameter as 0; If the sum of the quantities of the hit points of the first upper ray and the third ray is not less than the second preset threshold, and the hit count of the first upper radiation ray is not zero, obtain a first value, where the first value is the number of second rays that do not hit the first object; Obtain a second value, where the second value is the product of the first value and a third value; Use the difference between the default value of the second reverberation parameter and the second value as the second reverberation parameter.
7. The method according to claim 5, wherein, determining the second reverberation parameter includes: If the sum of the quantities of the hit points of the first upper ray and the third ray is less than a second preset threshold, and the hit count of the first upper radiation ray is zero, then record the second reverberation parameter as 0; If the sum of the number of hit points of the first upper ray and the third ray is not less than a second preset threshold, and the number of hits of the first upper radiation line is not zero, then obtain a plurality of second ray groups, each of the second ray groups including three adjacent second rays; Obtain a fourth value, where the fourth value is the number of second ray groups that meet a first preset condition, and the first preset condition includes that all the second rays in the second ray group hit the first object, and the value of the second area is greater than the first product, where the second area is the area of the shape enclosed by the hit points of the second ray and the center position of the game character, and the first product is the product of the sum detection lengths of the two outer second rays in the second ray group; Obtain a fifth value, where the fifth value is the product of the fourth value and a sixth value; Use the difference between the default value of the second reverberation parameter and the fifth value as the second reverberation parameter; If the number of second ray groups that meet a second preset condition is not less than a second preset threshold, then set the second reverberation parameter to 0, where the second preset condition includes that all the second rays in the second ray group do not hit the first object.
8. The method according to claim 6 or 7, wherein, the target reverberation value includes reverberation time and reverberation delay, and determining the target reverberation value according to the first reverberation parameter and the second reverberation parameter includes: Substitute the first volume, the first surface area, and the first absorption coefficient into the Sabine formula to calculate the first reverberation parameter; Calculate the product of the first reverberation parameter and the second reverberation parameter as the reverberation time; Calculate a second product of the first radius and the second reverberation parameter, and use the quotient of the second product and the speed of sound as the reverberation delay, where the first radius is the radius of the first sphere, and the volume of the first sphere is equal to the first volume.
9. The method according to claim 2, wherein, the step of if the game character is completely within a preset area, then using the first reverberation value corresponding to the preset area as the target reverberation value includes: If the game character is completely within a plurality of the preset areas, then obtain the priorities of the plurality of preset areas; Determine the target reverberation value according to the priorities of the plurality of preset areas.
10. A game sound reverberation processing device, wherein, the device includes: A detection ray acquisition module, configured to acquire a plurality of detection rays, and the plurality of detection rays are emitted outward from the game character; A reverberation parameter determination module, configured to determine a first reverberation parameter and a second reverberation parameter according to the hit positions and quantities of the hit points, and the current position of the game character, where the hit point is the intersection point generated when the detection ray projects onto a first object in the game scene, the first reverberation parameter is used to characterize the structural characteristics of the game scene, the second reverberation parameter is used to characterize the spatial enclosure of the game scene, and the first reverberation parameter includes the first volume, the first surface area, and the first absorption coefficient of the game scene; A target reverberation value determination module, configured to determine a target reverberation value according to the first reverberation parameter and the second reverberation parameter; A reverberation processing module, configured to perform reverberation processing on game sounds based on the target reverberation value; Wherein, determining the first reverberation parameter according to the hit position and quantity of the hit points, and the current position of the game character is used for: Obtain a first hit point, where the first hit point is a hit point generated by a first ray, and the first ray includes rays emitted respectively directly above and directly below the game character; Obtain a second hit point, where the second hit point is a hit point generated by a second ray, and the second ray is a ray parallel to the horizontal plane of the game scene. The first second ray is emitted directly in front of the game character, and each of the other second rays is set at a first preset angular interval; Obtain a third hit point, where the third hit point is a hit point generated by a third ray, and multiple third rays are emitted obliquely above the game character, and the spatial angle between each third ray and the second ray is the first preset angle; Determine a first area according to the position and quantity of the second hit points, where the first area is the area of a polygon formed by multiple first hit points and a first starting point, and the first starting point is the coordinate point of the current position; Determine the maximum height of the game scene according to the positions and quantities of the first hit points and the third hit points; Calculate the first volume and the first surface area according to the first area and the maximum height; Determine the first sound absorption coefficient according to the material of the first object corresponding to the hit point.
11. A computer device, Characterized in that It includes a processor and a memory, and the memory stores multiple instructions; the processor loads the instructions from the memory to execute the steps in the game sound reverberation processing method according to any one of claims 1 to 9.
12. A computer-readable storage medium, Characterized in that The computer-readable storage medium stores multiple instructions, and the instructions are suitable for being loaded by a processor to execute the steps in the game sound reverberation processing method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Scene sound effect reverberation control method and device, storage medium and electronic equipment
CN107281753A
Processing method, device, storage medium and electronic equipment for game sound reverberation
CN108465241A