CN114511686A - Memory processing method for visual scene - Google Patents

Memory processing method for visual scene Download PDF

Info

Publication number
CN114511686A
CN114511686A CN202210068041.9A CN202210068041A CN114511686A CN 114511686 A CN114511686 A CN 114511686A CN 202210068041 A CN202210068041 A CN 202210068041A CN 114511686 A CN114511686 A CN 114511686A
Authority
CN
China
Prior art keywords
point
scene
memory
texture
memory pool
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210068041.9A
Other languages
Chinese (zh)
Inventor
李超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Judian Digital Technology Co ltd
Original Assignee
Shenzhen Judian Digital Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Judian Digital Technology Co ltd filed Critical Shenzhen Judian Digital Technology Co ltd
Priority to CN202210068041.9A priority Critical patent/CN114511686A/en
Publication of CN114511686A publication Critical patent/CN114511686A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T19/00Manipulating 3D models or images for computer graphics
    • G06T19/003Navigation within 3D models or images
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/005General purpose rendering architectures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/04Texture mapping
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5011Pool

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Computer Graphics (AREA)
  • General Engineering & Computer Science (AREA)
  • Radar, Positioning & Navigation (AREA)
  • Remote Sensing (AREA)
  • Computer Hardware Design (AREA)
  • Image Generation (AREA)

Abstract

The invention discloses a memory processing method for a visual scene, which aims to solve the technical problems that the existing visual scene occupies a large memory and is easy to cause blockage. The method comprises the steps of setting a memory pool, storing texture objects at the current position of a visual scene in the memory pool, and loading texture objects increased at the next position and clearing reduced texture objects when the visual scene walks to the next position. The method calculates the movable scenic spots in the visual window of the camera, and automatically adds and deletes textures; and calculating the position of the movable panoramic point by using an automatic path finding method, and automatically adding and deleting textures. The invention has the beneficial technical effects that: unnecessary textures are cached and released in time, the model texture loading speed is increased, and the memory occupation of the browser is reduced.

Description

Memory processing method for visual scene
Technical Field
The invention relates to the technical field of visual scene construction, in particular to a visual scene memory processing method.
Background
When advertising commodities, 3D visual scenes can be adopted for displaying, and the display is more intuitive. When a visualization scene based on threejs is developed, any created texture, model and mapping occupy the memory. Particularly, in the case of dynamically adding and modifying models and textures, new texture resources need to be added to the memory after each change, the resources can be accumulated in the memory of the device machine, and the occupation of the resources can cause program jam or direct crash when the occupation is too large. Therefore, a memory processing method is needed to ensure smooth display of the visual scene.
The information disclosed in this background section is only for enhancement of understanding of the general background of the invention and should not be taken as an acknowledgement or any form of suggestion that this information forms the prior art that is known to a person skilled in the art.
Disclosure of Invention
The invention provides a memory processing method for a visual scene, which aims to solve the technical problems that the existing visual scene occupies a large memory and is easy to cause blockage.
In order to solve the technical problems, the invention adopts the following technical scheme:
designing a memory processing method for a visual scene, setting a memory pool, wherein texture objects at the current position of the visual scene are stored in the memory pool, and when the visual scene walks to the next position, loading the texture objects increased at the next position and simultaneously removing the decreased texture objects.
Furthermore, the number of the buffer amount is set in the memory pool so as not to influence the execution of the computer.
Furthermore, firstly, all panoramic point positions in the visual scene are traversed to calculate the panoramic point positions in the viewport and the panoramic point positions not in the viewport in the current visual scene, whether the texture object of the scene in the viewport is included in the memory pool is judged, and if the texture object of the point does not exist, the texture object of the point is loaded and added into the memory pool.
Furthermore, when the visual scene walks to the next position, the positions of the panoramic points which are not in the view port are traversed, and texture objects of the positions which are not in the view port in the memory pool are cleared.
Further, the position of the panoramic point in the viewport comprises a movable point and an immovable point, and a texture object of the movable point is loaded.
Further, the position of the movable panoramic point is calculated by using an automatic path searching method, and the texture objects in the memory pool are automatically added and deleted, wherein the method comprises the following steps: the method comprises the steps of using a current camera point as a first panorama point to emit rays to other panorama points in a visual scene, finding a second panorama point with the closest distance, using the second panorama point as a starting point to emit rays to other panorama points except the first panorama point in the scene, finding a third panorama point with the closest distance again, repeating the actions until all the panorama points in the scene are traversed or the rays cannot pick up a point with the shortest distance, obtaining a movable point path, loading texture objects which are present in the path and not present in a memory pool into the memory pool, and deleting texture objects which are present in the path and not present in the memory pool.
Furthermore, when the visual scene walks to the next position, new path data is obtained, the new path data is compared with data stored in a memory pool at the previous position, texture objects which are not in the memory pool are loaded, and redundant texture objects in the memory pool are deleted.
Compared with the prior art, the invention has the main beneficial technical effects that:
the invention provides a memory pool in a visual scene, which is used for caching model textures in advance, solving the problem of loading speed of the model textures, eliminating unnecessary textures after use is finished and solving the problem of memory occupation of the model textures. Under the condition of complex service, the rays are used for calculating the movable scene of the panoramic scenery spot, the memory processing method is executed after the movement, rotation and zooming actions are completed each time, the caching and releasing of the texture under the scene are automatically carried out, the unneeded texture is cached and released in time, the model texture loading speed is improved, and the memory occupation of a browser is reduced.
Drawings
Fig. 1 is a flowchart of a visualized scene memory processing method according to embodiment 1 of the present invention.
Fig. 2 is a flowchart of a visualized scene memory processing method according to embodiment 2 of the present invention.
Fig. 3 is a flowchart of a visualized scene memory processing method according to embodiment 3 of the present invention.
Detailed Description
The following examples are intended to illustrate the present invention in detail and should not be construed as limiting the scope of the present invention in any way.
The programs referred to or relied on in the following embodiments are all conventional programs or simple programs in the art, and those skilled in the art can make routine selection or adaptation according to specific application scenarios.
The first embodiment is as follows: a visual scene memory processing method is disclosed, referring to fig. 1, when a visual scene based on threjs walks, the texture of the current scene needs to be frequently updated, and a memory pool is set to remove memory occupation aiming at the texture of the scene. The memory pool is an array cube maps [ ], the texture objects of the current scene and the texture objects left after walking are stored, the cache number of the memory pool can be set, if the cache number is set to 3, only 3 texture objects exist in the memory pool, and the cache number is kept to be not accumulated so as not to influence the program operation and avoid the problems of jamming and the like.
When walking in a visual scene, the texture object is firstly obtained from the memory pool, and if the texture object exists, the texture object in the memory pool is directly used without loading a new texture. If not, then a new texture needs to be loaded and the first cached texture object is purged.
When walking, the texture is cached in the memory pool, such as: the memory pool cubeMaps = [ a, B, C ], the number of caches is set to 3, and [ a, B, C ] indicates that the user walks from the position a to the position B and from the position B to the position C, 3 scene texture objects are cached, if the user returns from the position C to the position C at the moment, the walking method finds the position B in the cubeMaps, the texture of the position B does not need to be generated again, and the walking method can be executed by directly using the texture of the position B.
When walking, the memory pool has no cache texture, such as: the memory pool cubeMaps = [ a, B, C ], and then goes from C to D, at this time, the memory pool has no texture of D, the memory mechanism will firstly clear the texture of a, which is cached first, and call the dispose () method of threjs texture object to clear the texture of a, a. Then load D's texture object, after loading succeeds, put D in A's position, cube Maps becomes [ D, B, C ], executes move. If the user walks to E, the memory pool cleans the memory of B, B is changed into E, cubesMaps is changed into [ D, E, C ], the cache is cleaned firstly, and then the cache is cleaned later.
Example two: and automatically adding and deleting texture objects in the memory pool according to the orientation of the camera and the position obtained by automatically searching the path. The memory processing method is executed after the movement, rotation and scaling actions are completed.
Calculating movable full scenic spots in a camera visual window, and automatically adding and deleting textures: firstly, all panoramic point positions are traversed to calculate the positions of the panoramic points in the viewport and the positions of the panoramic points not in the viewport in the current visual scene, and the obtained positions of the panoramic points in the viewport comprise movable and immovable panoramic points. Then traversing the part of the whole scenic spots, calculating a movable point by using a ray, judging whether the point exists in the memory pool, if so, not adding the point to the memory pool, and if not, loading a texture object of the point and adding the texture object to the memory pool. And traversing the positions of the panoramic points which are not in the view port after the movement, the rotation and the zooming are finished, and clearing texture objects of the positions which are not in the view port if the texture objects exist in the memory pool.
Specifically, all the scenic spots in the scene are allcube maps which are an array [ ], the scenic spots are obtained from a model when the scene is initialized, the allcube maps = [ A, B, C, D, E, F and G ], and A-G are three-dimensional vectors; a panoramic point inviwportcupemaps, also an array, within the viewport, default to no data inviwportcupemaps = [ ]; panorama point outviewport CubeMaps not in the viewport, default is empty array outviewport CubeMaps = [ ]; the memory pool cubesMaps, array, default is also empty array, cubesMaps = [ ]; and when the visual scene is initialized, inViewportCubeMaps, outViewportCubeMaps and cubesMaps are assigned.
1. Traversing all CubeMaps [ A, B, C, D, E, F, G ], judging whether the positions of A-G are in the view port or not has two methods:
the method comprises the following steps: converting the three-dimensional vector into standard equipment coordinate system coordinates M, new THEE.Vector2 (x, y), judging the absolute value of x and y when the x and y values of the standard equipment coordinate system coordinates are between-1 and 1, and judging whether one of the values of Math.abs (M.x) or Math.abs (M.y) is greater than 1, so that the point is out of the view port of the screen.
The second method comprises the following steps: and converting the three-dimensional vector into a normalized three-dimensional vector M by using a camera matrix, and judging the absolute values of x, y and z of the M, wherein if the absolute values are larger than 1, the point is the point outside the view port of the screen.
After performing method one or method two, panorama point set inviwportCubeMaps [ A, B, C, D ] in the view port and panorama point set outViewortCubeMaps [ E, F, G ] not in the view port are obtained.
2. Traversing inviwport cube maps, converting the values of A, B, C and D into coordinates of a standard equipment coordinate system, transmitting rays from a camera to the coordinates of the standard equipment coordinate system after conversion of A, B, C and D by using rays, judging whether a wall body exists between indication models from the camera to A, B, C and D in a returned model, if the wall body exists in the middle, the position cannot be moved, and if the wall body does not exist in the middle (namely only furniture and the position indication model), the point is a movable point. After the movable point is obtained, whether the movable point exists in the memory pool cubesMaps or not is judged, if the movable point does not exist, the texture of the point is loaded and added into the memory pool, and if the movable point exists, the texture of the point is not added. In this embodiment, all of a, B, C, and D do not exist in the memory pool, so cubesMaps = [ a, B, C, and D ].
3. And traversing outViewportCubeMaps [ E, F, G ], judging E, F, G whether the CubeMaps exist, and if the CubeMaps exist, executing a dispose () method of the texture object to clear the occupied memory from the machine memory and delete the memory from the CubesMaps.
Example three: calculating the position of a movable panoramic point by using an automatic path finding method, and automatically adding and deleting textures: and (3) transmitting rays to other panoramic points in the scene by using the current camera point A, searching a point B which is closest to the current camera position in the movable points, and storing the point B. And next, taking B as a starting point to emit rays to other panoramic points except A in the scene, searching the shortest distance movable point C which is found by taking B as the starting point again, and storing the shortest distance movable point C together with B. And then repeating the action until all the panoramic points in the scene are traversed or the ray cannot pick the point with the shortest distance, and obtaining a movable point path after the completion. The method only needs to be executed when the scene initialization and the movement are finished, is more flexible than a memory texture processing method based on the visualization window calculation, and can find movable points outside a screen. And obtaining path data after each movement is finished, comparing the path data with the data stored in the memory pool, wherein the path data exists in the memory pool, namely when the secondary path and the last path pass through the position, the texture object is not processed. If the texture exists in the memory pool and the path does not exist, deleting the texture from the machine memory by using a dispose () method, and removing the texture from the memory pool; and loading the texture object of the point and adding the texture object into the memory pool.
Specifically, all the scenic spots in the scene are allcube maps which are an array [ ], the scenic spots are obtained from a model when the scene is initialized, the allcube maps = [ A, B, C, D, E, F and G ], and A-G are three-dimensional vectors; trackcube maps = [ ], found path. Memory pool cubeMaps = [ ], and the default camera position is at the position of a.
A emits rays to B, C, D, E, F and G respectively, judging that no wall exists between A and B, C, D according to an object returned by the rays, namely that A can move to B, C, D, judging the distance attribute distance from the rays to B, C, D, calculating the point with the shortest distance to A as B, and storing the point into a trackCubeMaps, wherein the trackCubeMaps = [ B ].
B respectively emitting rays to C, D, E, F and G, repeating the condition judgment of the first step to obtain a point with the shortest distance to B as F, and storing the point into a trackCubeMaps, wherein the trackCubeMaps = [ B, F ]; each time the ray is emitted, the point where the ray has been emitted is excluded, and the next step is that the ray is emitted to C, D, E and G, and A and B are excluded. The end condition of this step is that the scene point is traversed, or a wall exists between a ray at a certain position and other positions, so that the scene point cannot be moved, and the traversal is ended, wherein the trackCubeMaps = [ B, F, D, G ].
Comparing the trackCubeMaps = [ B, F, D, G ] with the cubeMaps = [ ], and simultaneously performing treatment in the trackCubeMaps and cubeMaps; adding texture objects to the cubeMaps if there are trackCubeMaps and not cubeMaps; there are no trackCubeMaps, there are cubeMaps, dispose clears machine memory usage and removes them from cubeMaps.
Such as:
(1) trackCubeMaps = [ B, F, D, G ], CubeMaps = [ ]; and loading texture objects of B, F, D and G into the memory pool.
(2) trackcube maps = [ B, F, D, G ], cube maps = [ B, F, D ]; and adding the texture object of G into the memory pool.
(3) trackcube maps = [ B, F, D ], cube maps = [ B, F, D, G ]; clearing the memory of G and removing G from the cubeMaps.
While the invention has been described in detail with reference to the drawings and examples, it will be understood by those skilled in the art that various changes in the form and details may be made therein without departing from the spirit and scope of the invention.

Claims (7)

1.A visual scene memory processing method is characterized in that a memory pool is set, texture objects of the current position of a visual scene are stored in the memory pool, and when the visual scene walks to the next position, the texture objects added at the next position are loaded and the texture objects reduced at the same time are removed.
2. The visualization scene memory processing method according to claim 1, wherein the memory pool sets the number of the buffer amount so as not to affect the computer execution.
3. A visualized scene memory processing method according to claim 1, characterized in that, first, all the panoramic point positions in the visualized scene are traversed to calculate the panoramic point positions in the viewport and out of the viewport in the current visualized scene, and whether the memory pool includes the texture object of the scene in the viewport is judged, and if not, the texture object of the point is loaded and added to the memory pool.
4. A visual scene memory processing method according to claim 3, wherein when the visual scene walks to the next position, the positions of the panoramic points not in the viewport are traversed, and texture objects of the positions not in the viewport in the memory pool are cleared.
5. A visual scene memory processing method according to claim 3, wherein the positions of the panoramic point in the viewport include a movable point and an immovable point, and the texture object of the movable point is loaded.
6. The visual scene memory processing method according to claim 1, wherein the position of the movable panoramic point is calculated by using an automatic routing method, and the texture objects in the memory pool are automatically added or deleted, and the steps are as follows:
the method comprises the steps of using a current camera point as a first panorama point to emit rays to other panorama points in a visual scene, finding a second panorama point with the closest distance, using the second panorama point as a starting point to emit rays to other panorama points except the first panorama point in the scene, finding a third panorama point with the closest distance again, repeating the actions until all the panorama points in the scene are traversed or the rays cannot pick up a point with the shortest distance, obtaining a movable point path, loading texture objects which are present in the path and not present in a memory pool into the memory pool, and deleting texture objects which are present in the path and not present in the memory pool.
7. A visual scene memory processing method according to claim 6, wherein a new path data is obtained when the visual scene walks to the next position, and compared with the data stored in the memory pool of the previous position, the texture objects not present in the memory pool are loaded and the redundant texture objects in the memory pool are deleted.
CN202210068041.9A 2022-01-20 2022-01-20 Memory processing method for visual scene Pending CN114511686A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210068041.9A CN114511686A (en) 2022-01-20 2022-01-20 Memory processing method for visual scene

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210068041.9A CN114511686A (en) 2022-01-20 2022-01-20 Memory processing method for visual scene

Publications (1)

Publication Number Publication Date
CN114511686A true CN114511686A (en) 2022-05-17

Family

ID=81549463

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210068041.9A Pending CN114511686A (en) 2022-01-20 2022-01-20 Memory processing method for visual scene

Country Status (1)

Country Link
CN (1) CN114511686A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116627580A (en) * 2023-07-25 2023-08-22 江苏正泰泰杰赛智能科技有限公司 Multi-level cache three-dimensional model loading method for webpage end

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116627580A (en) * 2023-07-25 2023-08-22 江苏正泰泰杰赛智能科技有限公司 Multi-level cache three-dimensional model loading method for webpage end
CN116627580B (en) * 2023-07-25 2023-09-22 江苏正泰泰杰赛智能科技有限公司 Multi-level cache three-dimensional model loading method for webpage end

Similar Documents

Publication Publication Date Title
CN109701273B (en) Game data processing method and device, electronic equipment and readable storage medium
CN105144245B (en) The device and method sampled for the radiative transfer of Augmented Reality
US9754405B1 (en) System, method and computer-readable medium for organizing and rendering 3D voxel models in a tree structure
CN101615191B (en) Storage and real-time visualization implementation method of mass cloud data
Nießner et al. Real-time 3D reconstruction at scale using voxel hashing
JP4503073B2 (en) Image resource loading system and image resource loading method for loading object for updating game screen
CN101496066B (en) Graphics processing unit with extended vertex cache
US7808514B2 (en) Multiplanar reformatting visualization with multiple scrolling speeds
US7315301B1 (en) Computer graphics processing system, computer memory, and method of use with computer graphics processing system utilizing hierarchical image depth buffer
US6933946B1 (en) Method for out-of core rendering of large 3D models
US10257456B2 (en) Hardware friendly virtual frame buffer
US8502819B1 (en) System and method for performing ray tracing node traversal in image rendering
CN112184603B (en) Point cloud fusion method and device, electronic equipment and computer storage medium
US7478098B2 (en) Data transfer system and computer-readable recording medium recording a data transfer server program
JP6864495B2 (en) Drawing Global Illumination in 3D scenes
JP5695746B2 (en) Mipmap level selection method and texture mapping system using the same
CN110533694A (en) Image processing method, device, terminal and storage medium
CN114511686A (en) Memory processing method for visual scene
KR101100650B1 (en) A system for indirect lighting and multi-layered displacement mapping using map data and its method
US7570271B1 (en) High speed display of high resolution image
JP2021152724A (en) Information processing apparatus, information processing method, and program
CN103578130B (en) Method and apparatus for ray trace
US20060109275A1 (en) Method and apparatus for accumulative vector drawing using buffering
US8576238B1 (en) High speed display of high resolution image
Deng et al. Interactive panoramic map-like views for 3D mountain navigation

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination