CN115359164A - Method, system, electronic device and storage medium for presenting object in screen center - Google Patents

Method, system, electronic device and storage medium for presenting object in screen center Download PDF

Info

Publication number
CN115359164A
CN115359164A CN202210979549.4A CN202210979549A CN115359164A CN 115359164 A CN115359164 A CN 115359164A CN 202210979549 A CN202210979549 A CN 202210979549A CN 115359164 A CN115359164 A CN 115359164A
Authority
CN
China
Prior art keywords
camera
center
box
point
screen
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
CN202210979549.4A
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.)
Antiy Technology Group Co Ltd
Original Assignee
Antiy Technology Group 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 Antiy Technology Group Co Ltd filed Critical Antiy Technology Group Co Ltd
Priority to CN202210979549.4A priority Critical patent/CN115359164A/en
Publication of CN115359164A publication Critical patent/CN115359164A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/004Artificial life, i.e. computing arrangements simulating life
    • G06N3/006Artificial life, i.e. computing arrangements simulating life based on simulated virtual individual or collective life forms, e.g. social simulations or particle swarm optimisation [PSO]

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Artificial Intelligence (AREA)
  • Biomedical Technology (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Computer Graphics (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The embodiment of the invention discloses a method, a system, electronic equipment and a storage medium for presenting an object in a screen center, and relates to the technical field of page rendering. The method comprises the following steps: building a first bounding box in a three-dimensional scene; carrying out reverse transformation on the first wrapping box around the first central point to obtain a second wrapping box; calculating the setting position of the camera in the three-dimensional scene according to the central point of the second packing box and the camera parameters; carrying out forward transformation on the central point of the second parcel box and the setting position of the camera around the first central point to obtain a target view point and a target focus point of the camera; wherein the viewpoint is used to represent a set position of the camera in the three-dimensional scene. The method and the device are convenient for displaying the object in the center of the screen, and are suitable for application interface rendering scenes such as Web development, user interface development, game development and the like.

Description

Method, system, electronic device and storage medium for presenting object in screen center
Technical Field
The present invention relates to the field of page rendering technologies, and in particular, to a method, a system, an electronic device, and a storage medium for presenting an object in a screen center.
Background
Three-dimensional scene rendering is an important implementation mode for presenting three-dimensional visualization effect in numerous fields such as Web development and game development. In the related art, a known object is presented at the center of a screen, and a common scheme is to wrap the object in a sphere, as shown in fig. 1; then, simulation calculation is performed according to the radius of the sphere, and the position of the sphere (the representative object) presented in the screen is obtained.
However, the inventor of the present application finds in the course of realizing the invention: since most objects cannot fit well with their wrapped balls, the centers of the obtained balls and objects in the screen are deviated, as shown in fig. 1, resulting in that the final effect presented on the screen is also deviated from the center of the screen.
Disclosure of Invention
Embodiments of the present invention provide a method, a system, an electronic device, and a storage medium for presenting an object in a center of a screen, which facilitates presenting the object in the center of the screen.
In order to achieve the purpose of the invention, the following technical scheme is adopted:
in a first aspect, an embodiment of the present invention provides a method for presenting an object in a screen center, where the method includes: constructing a first parcel box in a three-dimensional scene according to a user trigger instruction; the first packing box is used for containing a particle swarm formed by objects to be presented; carrying out reverse transformation on the first wrapping box around a first central point to obtain a second wrapping box; the first center point is a center point of the first parcel box; calculating the setting position of the camera in the three-dimensional scene according to the central point of the second wrapping box and the camera parameters; the camera is a virtual camera tool; carrying out forward transformation on the central point of the second parcel box and the setting position of the camera around the first central point to obtain a target view point and a target focus point of the camera; wherein, the viewpoint is used for representing the setting position of the camera in the three-dimensional scene; and projecting the object to be presented to the center of the screen for presentation according to the target viewpoint and the target focus of the camera.
Optionally, said building a first parcel box in a three-dimensional scene comprises: converting an object to be presented into a particle swarm; if the object to be presented is a single object, selecting boundary points of the corresponding object to form a particle swarm; if the objects to be presented are a plurality of objects and are within a first preset quantity, selecting boundary points of each object to form a particle swarm; if the objects to be presented are a plurality of objects and exceed the first preset number, regarding each object as a particle swarm formed by particles; building a packing box around the population of particles.
Optionally, the inversely transforming the first parcel box around the first center point to obtain a second parcel box comprises: reversely rotating a first packing box containing a particle swarm around the first central point; the first central point is the origin of a three-axis coordinate system, and each particle rotates around the first central point by a first preset angle from the positive direction of a z axis to the negative direction of an x axis and rotates by a second preset angle from the xz plane to the negative direction of a y axis; and calculating a second wrapping box corresponding to the rotated particle swarm and a central point of the second wrapping box.
Optionally, calculating a setting position of the camera in the three-dimensional scene according to the central point of the second parcel box and the camera parameters includes: taking the central point of the second parcel box as the current camera focus; controlling a camera to shoot towards the current camera focus along the positive direction of the z axis; and when the second parcel box is projected in the center of the screen, determining to obtain the setting position of the camera in the three-dimensional scene according to the camera parameters.
Optionally, the forward transformation of the central point of the second parcel box and the setting position of the camera according to the first central point to obtain the target view point and the target focus point of the camera includes: rotating the central point of the second packing box around the first central point in a forward direction according to a first preset angle and a second preset angle to obtain a target focus of the camera; and rotating the set position of the camera around the first central point in a forward direction according to a first preset angle and a second preset angle to obtain a target viewpoint of the camera.
In a second aspect, an embodiment of the present invention further provides a system for presenting an object in a center of a screen, including: the building program module is used for building a first parcel box in a three-dimensional scene according to a user trigger instruction; the first packing box is used for containing a particle swarm formed by objects to be presented; the reverse transformation program module carries out reverse transformation on the first wrapping box around a first central point to obtain a second wrapping box; the first center point is a center point of the first parcel box; the calculation program module is used for calculating the setting position of the camera in the three-dimensional scene according to the central point of the second wrapping box and the camera parameters; the camera is a virtual camera tool; the forward transformation program module is used for performing forward transformation on the central point of the second parcel box and the setting position of the camera around the first central point to obtain a target view point and a target focus point of the camera; wherein, the viewpoint is used for representing the setting position of the camera in the three-dimensional scene; and the presentation program module is used for projecting the object to be presented to the center of the screen for presentation according to the target view point and the target focus point of the camera.
Optionally, the builder module comprises: the conversion program unit is used for converting the object to be presented into a particle swarm; if the object to be presented is a single object, selecting boundary points of the corresponding object to form a particle swarm; if the objects to be presented are a plurality of objects and are within a first preset quantity, selecting boundary points of each object to form a particle swarm; if the objects to be presented are a plurality of objects and exceed the first preset number, regarding each object as a particle swarm formed by particles; a building program unit for building a parcel box around the population of particles.
Optionally, the computer program module is specifically configured to: taking a center point of the second parcel box as a current camera focus; controlling the camera to shoot towards the current camera focus along the positive direction of the z axis; and when the second parcel box is projected in the center of the screen, determining to obtain the setting position of the camera in the three-dimensional scene according to the camera parameters.
In a third aspect, an embodiment of the present invention provides an electronic device, including: one or more processors; a memory; the memory stores one or more executable programs, and the one or more processors read the executable program codes stored in the memory and run programs corresponding to the executable program codes so as to execute the method for presenting the object in the center of the screen according to any one of the first aspect.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium storing one or more programs, which are executable by one or more processors to implement the method for presenting an object in a center of a screen according to any one of the first aspect.
According to the method, the system, the electronic equipment and the storage medium for presenting the object in the center of the screen, which are provided by the embodiment of the invention, the first wrapping box is constructed in the three-dimensional scene, the particle swarm is wrapped, then the first wrapping box is reversely transformed to obtain the second wrapping box, and the setting position of the camera in the three-dimensional scene is calculated according to the central point of the second wrapping box and the camera parameters; carrying out forward transformation on the central point of the second parcel box and the setting position of the camera according to the first central point to obtain a target view point and a target focus point of the camera; therefore, the particle swarm for containing the object to be presented is wrapped by the wrapping box, the reverse and forward transformation is carried out, when the view angle of the object to be presented is transformed, the target viewpoint and the target focus of the camera can still be determined, and therefore the object can be presented at the center of the screen conveniently.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a schematic diagram illustrating a camera and a viewpoint position calculated by wrapping an object to be presented in a sphere according to an embodiment of the related art
FIG. 2 is a flowchart illustrating a method for rendering an object in the center of a screen according to an embodiment of the present invention;
FIG. 3 is a schematic view of a camera viewpoint and a focal point position according to an embodiment of the present invention;
FIG. 4 is a flowchart illustrating a method for rendering an object in the center of a screen according to another embodiment of the present invention;
FIG. 5 is a block diagram of a system architecture for rendering objects in the center of a screen according to yet another embodiment of the present invention;
FIG. 6 is a block diagram illustrating an architecture of an electronic device according to an embodiment of the present invention.
Detailed Description
Embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
It should be understood that the described embodiments are only some embodiments of the invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The method for presenting the object in the center of the screen can be applied to application interface rendering scenes such as Web development, user interface development, game development and the like, and the object can be conveniently presented in the center of the screen.
It should be noted that the method may be solidified in a certain manufactured physical product in the form of software, and when a user uses the product, the method flow of the present application may be reproduced.
Before describing embodiments of the present invention in detail, the following technical terms or terms used in one or more embodiments of the present invention are to be interpreted as follows: scene: a space in which the object is presented; a camera: a tool in the rendering software for viewing the object; a renderer: the scene observed by the camera is rendered on the screen.
FIG. 2 is a flowchart illustrating a method for presenting an object in a center of a screen according to an embodiment of the present invention; referring to fig. 2, the method for presenting an object in the center of a screen includes the steps of:
and S110, constructing a first parcel box in the three-dimensional scene according to the user trigger instruction.
The first wrapping box (Axis-aligned bounding box) is used for containing a particle swarm formed by objects to be presented.
And S120, reversely converting the first wrapping box according to the first central point to obtain a second wrapping box.
The first center point is a center point of a first parcel box; and calculating a central point O of the first wrapping box of the particle swarm, wherein the central point O can be obtained by taking the median of three dimensions in a three-axis coordinate system.
And S130, calculating the setting position of the camera in the three-dimensional scene according to the central point of the second packing box and the camera parameters.
The camera is a virtual camera tool, and is a projection tool from 3D to 2D (three-dimensional to two-dimensional); js, a camera button is arranged, and when a camera of a corresponding type is selected, the camera is created in a canvas, and the camera is used for continuously shooting the created scene and then is rendered into a screen through a renderer (Render), and if the scene is watched through different angles, the position of the camera needs to be modified to shoot the scene; the camera in this embodiment is mainly a perspective camera (perspective camera).
Known camera parameters mainly include: the FOV camera viewing cone is perpendicular to the view angle; aspect camera view cone length-width ratio; near camera view cone proximal face; far camera viewing cone distal end face.
And S140, carrying out forward transformation on the central point of the second parcel box and the setting position (the position in a three-axis coordinate system) of the camera according to the first central point to obtain a target view point and a target focus of the camera.
Referring to fig. 3, the viewpoint is used to represent a setting position of the camera in the three-dimensional scene, the focus represents a position of an object observed by the camera, and the default focus position is generally an origin in a world coordinate system, but the focus position may be additionally set through control.
During the process of observing the target (target), the camera control orbitontrol can control the angle of the camera rotating around a certain axis relative to the focus, so that the object can be observed from multiple angles; where OribitControls are controllers around the target.
S150, projecting the object to be presented to the center of a screen for presentation according to the target view point and the target focus of the camera.
Using perspective projection, all content in the view Frustum (Frustum, used to determine what is in the camera's field of view) is projected in a straight line to the viewpoint; wherein the viewing pyramid is the area in 3D space that is to be projected onto the screen. Anything outside this area will not appear on the screen. Either because it is too close or too far, or because the camera is not pointing at (hook at) it.
In this embodiment, the content that the camera needs to be rendered in real time is shown by switching the camera parameters transmitted by the renderer, and is displayed in the center of the screen.
In the embodiment, a first wrapping box is constructed in a three-dimensional scene, a particle swarm is wrapped, then the first wrapping box is reversely transformed to obtain a second wrapping box, and the setting position of a camera in the three-dimensional scene is calculated according to the central point of the second wrapping box and camera parameters; carrying out forward transformation on the central point of the second parcel box and the setting position of the camera according to the first central point to obtain a target view point and a target focus point of the camera; therefore, the particle swarm for containing the object to be presented is wrapped by the wrapping box, the reverse and forward transformation is carried out, when the view angle of the object to be presented is transformed, the target viewpoint and the target focus of the camera can still be determined, and therefore the object can be presented at the center of the screen conveniently.
Therefore, the embodiment of the invention can be presented at the central position of the screen under various angles, and the viewpoint and focus calculation mode is simple and efficient.
Referring to fig. 4, in some embodiments, the constructing the first parcel box in the three-dimensional scene in step S110 includes:
and S111, converting the object to be presented into a particle swarm.
If the object to be presented is a single object, selecting boundary points of the corresponding object to form a particle swarm; if the objects to be presented are a plurality of objects and are within a first preset quantity, selecting boundary points of each object to form a particle swarm; and if the objects to be presented are a plurality of objects and the number of the objects exceeds the first preset number, regarding each object as a particle group formed by particles.
S113, constructing a packaging box around the particle swarm.
According to the technical scheme provided by the embodiment of the invention, all objects, whether single objects or multiple objects are regarded as particle swarms, and the parcel boxes are constructed around the objects, so that the follow-up efficient calculation is facilitated.
Referring to fig. 4, in some embodiments, the inversely transforming the first parcel box according to the first center point to obtain a second parcel box (S120) includes: reversely rotating a first packing box containing a particle swarm around the first central point; the first central point is an original point O of an xyz three-axis coordinate system, each particle rotates around the first central point by a first preset angle alpha (left rotation included angle) from the positive direction of a z axis to the negative direction of an x axis, and rotates by a second preset angle beta (lower rotation included angle) from the xz plane to the negative direction of a y axis, and the first preset angle alpha and the second preset angle beta are camera observation angles; and calculating a second wrapping box corresponding to the rotated particle swarm and a central point of the second wrapping box.
The first preset Angle is a predefined horizontal view Angle (Polar Angle) of the camera view cone, and the second preset Angle is a predefined vertical view Angle (Azimuthal Angle) of the camera view cone. In brief, the viewing angles in two directions are the same.
According to the requirement of an observation angle, a first preset angle and a second preset angle can be set automatically.
In the embodiment, different preset angles can be preset, and the object to be presented can be accurately presented at the center of the screen at each angle.
In some embodiments, calculating the set position of the camera in the three-dimensional scene according to the center point of the second parcel box and the camera parameters (step S130) comprises: taking a center point of the second parcel box as a current camera focus; controlling the camera to shoot towards the current camera focus along the positive direction of the z axis, and controlling the camera by using a camera control OrbitControl; and when the second parcel box is projected in the center of the screen, determining to obtain the setting position of the camera in the three-dimensional scene according to the camera parameters.
In this embodiment, the front view of the second casing obtained after transformation is calculated according to known camera parameters, that is, when the camera looks at the focal point in the z-axis forward direction and projects on the center of the screen with the new central point Q as the focal point, the position P of the camera is taken as the viewpoint. The camera is arranged at the position, so that the projection can be ensured to present an object in the center of the screen.
The determination of the setting position of the camera in the three-dimensional scene according to the camera parameters is well known to those skilled in the art, and for brevity, will not be described herein again.
In some embodiments, said forward transforming the center point of the second parcel box and the setting position of the camera around the first center point, obtaining the target viewpoint and the target focus of the camera comprises: rotating the central point of the second parcel box around the first central point in a forward direction according to a first preset angle and a second preset angle to obtain a target focus of the camera; and rotating the set position of the camera around the first central point in a forward direction according to a first preset angle and a second preset angle to obtain a target viewpoint of the camera.
In this embodiment, the final focus and viewpoint position is obtained by rotating the focus Q and the viewpoint P around the first center point O again by the first preset angle and the second preset angle, i.e., rotating the focus Q and the viewpoint P by the right angle α and the upward angle β.
In the present embodiment, all objects, whether a single object or a plurality of objects, are regarded as a particle group. Calculating an original central point of the particle swarm, then carrying out reverse transformation of a visual field angle on the particle swarm with the original central point, and then calculating a second wrapping box and the central point of the second wrapping box of the transformed particle swarm. Under the forward view, the camera position, namely the viewpoint, is calculated according to the second wrapping box and the center point thereof and the camera parameters. Finally, the center point of the second packing box and the camera position are changed back according to the original direction with the original center point to obtain the final focus and viewpoint position, namely the visual field position; the view field position is transmitted into the renderer, and the object can be guaranteed to be projected to the center of the screen to be displayed.
Example two
Fig. 5 is a schematic block diagram of a system architecture for presenting an object in a screen center according to an embodiment of the present invention, and please refer to fig. 5, based on the same technical concept as that in the first embodiment, a system for presenting an object in a screen center is further provided, including: a building program module 210, configured to build a first parcel box in a three-dimensional scene according to a user trigger instruction; the first packing box is used for containing a particle swarm formed by objects to be presented; a reverse transformation program module 220, configured to perform reverse transformation on the first parcel box around the first central point to obtain a second parcel box; the first center point is a center point of a first parcel box; the calculation program module 230 calculates the setting position of the camera in the three-dimensional scene according to the central point of the second packing box and the camera parameters; the camera is a virtual camera tool; a forward transformation program module 240, configured to perform forward transformation on the central point of the second parcel box and the setting position of the camera around the first central point to obtain a target view point and a target focus point of the camera; wherein, the viewpoint is used for representing the setting position of the camera in the three-dimensional scene; and the presentation program module 260 is configured to project the object to be presented to the center of the screen for presentation according to the target viewpoint and the target focus of the camera.
The system of this embodiment may be used to implement the technical solution of the method embodiment shown in fig. 1, and the implementation principle and technical effects are similar to those of the embodiment, which are not described herein again and can be referred to each other.
In some embodiments, the builder module 210 includes: the conversion program unit is used for converting the object to be presented into a particle swarm; if the object to be presented is a single object, selecting boundary points of the corresponding object to form a particle swarm; if the objects to be presented are a plurality of objects and are within a first preset quantity, selecting boundary points of each object to form a particle swarm; if the objects to be presented are a plurality of objects and exceed the first preset number, regarding each object as a particle swarm formed by particles; a building program unit for building a parcel box around the population of particles.
In some embodiments, the computer program module is specifically configured to: taking a center point of the second parcel box as a current camera focus; controlling the camera to shoot towards the current camera focus along the positive direction of the z axis; and when the second parcel box is projected in the center of the screen, determining to obtain the setting position of the camera in the three-dimensional scene according to the camera parameters.
In addition, it is understood that the system shown in fig. 5 is also applicable to the step flow executed in other embodiments in the first embodiment, and specific reference may be made to the related description in the first embodiment, which is not repeated herein.
According to the system for presenting the object in the center of the screen, provided by the embodiment of the invention, the particle swarm for containing the object to be presented is wrapped by the wrapping box, and the reverse and forward conversion is carried out, so that the target viewpoint and the target focus of the camera can still be determined when the view angle of the object to be presented is converted, and the object can be conveniently presented in the center of the screen.
EXAMPLE III
Another embodiment of the present invention provides an electronic device, including: one or more processors; a memory; the memory stores one or more executable programs, and the one or more processors read the executable program codes stored in the memory and run programs corresponding to the executable program codes so as to execute the method for presenting the object in the center of the screen according to any one of the embodiments.
Fig. 6 is a schematic structural diagram of an embodiment of an electronic device according to the present invention, which may implement the method according to any one of the embodiments of the present invention, as shown in fig. 6, as an alternative embodiment, the electronic device may include: a housing 41, a processor 42, a memory 43, a circuit board 44 and a power circuit 45, wherein the circuit board 44 is disposed inside a space enclosed by the housing 41, and the processor 42 and the memory 43 are disposed on the circuit board 44; a power supply circuit 45 for supplying power to each circuit or device of the electronic apparatus; the memory 43 is used for storing executable program codes; the processor 42 runs a program corresponding to the executable program code by reading the executable program code stored in the memory 43, and is configured to execute the method for presenting the object in the center of the screen according to any one of the foregoing embodiments.
For the specific execution process of the above steps by the processor 42 and the further steps executed by the processor 42 by running the executable program code, reference may be made to the description of the first embodiment of the method for presenting an object in the center of the screen in the present invention, which is not described herein again.
The electronic device exists in a variety of forms, including but not limited to: (1) a mobile communication device: such devices are characterized by mobile communications capabilities and are primarily targeted at providing voice, data communications. Such terminals include: smart phones, multimedia phones, functional phones, and low-end phones, etc. (2) ultra mobile personal computer device: the equipment belongs to the category of personal computers, has calculation and processing functions and generally has the characteristic of mobile internet access. Such terminals include: PDA, MID, and UMPC devices, etc., such as ipads. (3) portable entertainment devices: such devices can display and play multimedia content. This type of device comprises: audio and video playing modules (such as an iPod), handheld game consoles, electronic books, and intelligent toys and portable car navigation devices. (4) the server: the device for providing the computing service comprises a processor, a hard disk, a memory, a system bus and the like, and the server is similar to a general computer architecture, but has higher requirements on processing capacity, stability, reliability, safety, expandability, manageability and the like because high-reliability service needs to be provided. And (5) other electronic equipment with a data interaction function.
A further embodiment of the present invention provides a computer-readable storage medium storing one or more programs, which are executable by one or more processors to implement the method for presenting an object in a center of a screen according to any one of the foregoing embodiments.
According to the method and the system for presenting the object in the center of the screen, provided by the embodiment of the invention, the object can be accurately presented in the center of the screen under various angles, and the viewpoint and focus calculation mode is simple and efficient.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising one of 8230; \8230;" 8230; "does not exclude the presence of additional like elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above may be implemented by a computer program, which may be stored in a computer readable storage medium and executed by a computer to implement the processes of the embodiments of the methods described above. The storage medium may also be a magnetic disk, an optical disk, a Read-only Memory (ROM), a Random Access Memory (RAM), or the like.
The above description is only for the specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. A method of rendering an object in the center of a screen, the method comprising the steps of:
constructing a first parcel box in a three-dimensional scene according to a user trigger instruction; the first packing box is used for containing a particle swarm formed by objects to be presented;
carrying out reverse transformation on the first wrapping box around a first central point to obtain a second wrapping box; the first center point is a center point of the first parcel box;
calculating the setting position of the camera in the three-dimensional scene according to the central point of the second packing box and the camera parameters; the camera is a virtual camera tool;
carrying out forward transformation on the central point of the second parcel box and the setting position of the camera around the first central point to obtain a target view point and a target focus point of the camera; wherein, the viewpoint is used for representing the setting position of the camera in the three-dimensional scene;
and projecting the object to be presented to the center of the screen for presentation according to the target viewpoint and the target focus of the camera.
2. The method for rendering an object in a center of a screen according to claim 1, wherein the building a first parcel box in a three-dimensional scene comprises: converting an object to be presented into a particle swarm;
if the object to be presented is a single object, selecting boundary points of the corresponding object to form a particle swarm;
if the objects to be presented are a plurality of objects and are within a first preset quantity, selecting boundary points of each object to form a particle swarm;
if the objects to be presented are a plurality of objects and exceed the first preset number, regarding each object as a particle swarm formed by particles;
building a packing box around the population of particles.
3. The method of screen-centric rendering of an object according to claim 1, wherein the inverse transforming the first parcel box around a first center point to obtain a second parcel box comprises:
reversely rotating a first packing box containing a particle swarm around the first central point; the first central point is the origin of a three-axis coordinate system, and each particle rotates around the first central point by a first preset angle from the positive direction of a z axis to the negative direction of an x axis and rotates by a second preset angle from the xz plane to the negative direction of a y axis;
and calculating a second wrapping box corresponding to the rotated particle swarm and a central point of the second wrapping box.
4. The method of claim 1, wherein calculating the set position of the camera in the three-dimensional scene according to the center point of the second parcel box and the camera parameters comprises:
taking a center point of the second parcel box as a current camera focus;
controlling the camera to shoot towards the current camera focus along the positive direction of the z axis;
and when the second parcel box is projected in the center of the screen, determining to obtain the setting position of the camera in the three-dimensional scene according to the camera parameters.
5. The method of claim 4, wherein forward transforming the center point of the second parcel box and the set position of the camera around the first center point to obtain the target viewpoint and the target focus of the camera comprises:
rotating the central point of the second parcel box around the first central point in a forward direction according to a first preset angle and a second preset angle to obtain a target focus of the camera;
and performing forward rotation on the set position of the camera around the first central point according to a first preset angle and a second preset angle to obtain a target viewpoint of the camera.
6. A system for rendering an object in the center of a screen, comprising: the building program module is used for building a first wrapping box in a three-dimensional scene according to a user trigger instruction; the first packing box is used for containing a particle swarm formed by objects to be presented;
the reverse transformation program module carries out reverse transformation on the first wrapping box around a first central point to obtain a second wrapping box; the first center point is a center point of the first parcel box;
the calculation program module is used for calculating the setting position of the camera in the three-dimensional scene according to the central point of the second wrapping box and the camera parameters; the camera is a virtual camera tool;
the forward transformation program module is used for performing forward transformation on the center point of the second parcel box and the setting position of the camera around the first center point to obtain a target view point and a target focus point of the camera; wherein, the viewpoint is used for representing the setting position of the camera in the three-dimensional scene;
and the presentation program module is used for projecting the object to be presented to the center of the screen for presentation according to the target view point and the target focus point of the camera.
7. The system for rendering an object in the center of a screen of claim 6, comprising:
the build program module includes: the conversion program unit is used for converting the object to be presented into a particle swarm;
if the object to be presented is a single object, selecting boundary points of the corresponding object to form a particle swarm;
if the objects to be presented are a plurality of objects and are within a first preset quantity, selecting boundary points of each object to form a particle swarm;
if the objects to be presented are a plurality of objects and exceed the first preset number, regarding each object as a particle swarm formed by particles;
a building program unit for building a parcel box around the population of particles.
8. The system for rendering an object in a center of a screen as recited in claim 6, wherein the computer program module is specifically configured to:
taking a center point of the second parcel box as a current camera focus;
controlling a camera to shoot towards the current camera focus along the positive direction of the z axis;
and when the second parcel box is projected in the center of the screen, determining to obtain the setting position of the camera in the three-dimensional scene according to the camera parameters.
9. An electronic device, comprising: one or more processors; a memory; the memory stores one or more executable programs, and the one or more processors read the executable program codes stored in the memory and run programs corresponding to the executable program codes so as to execute the method for presenting the object in the center of the screen according to any one of claims 1 to 5.
10. A computer readable storage medium, characterized in that the computer readable storage medium stores one or more programs which are executable by one or more processors to implement the method of rendering an object in the center of a screen as claimed in any one of the preceding claims 1 to 5.
CN202210979549.4A 2022-08-16 2022-08-16 Method, system, electronic device and storage medium for presenting object in screen center Pending CN115359164A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210979549.4A CN115359164A (en) 2022-08-16 2022-08-16 Method, system, electronic device and storage medium for presenting object in screen center

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210979549.4A CN115359164A (en) 2022-08-16 2022-08-16 Method, system, electronic device and storage medium for presenting object in screen center

Publications (1)

Publication Number Publication Date
CN115359164A true CN115359164A (en) 2022-11-18

Family

ID=84001321

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210979549.4A Pending CN115359164A (en) 2022-08-16 2022-08-16 Method, system, electronic device and storage medium for presenting object in screen center

Country Status (1)

Country Link
CN (1) CN115359164A (en)

Similar Documents

Publication Publication Date Title
CN108027653B (en) Haptic interaction in virtual environments
US20170154468A1 (en) Method and electronic apparatus for constructing virtual reality scene model
US20170186219A1 (en) Method for 360-degree panoramic display, display module and mobile terminal
US11282264B2 (en) Virtual reality content display method and apparatus
CN103157281B (en) Display method and display equipment of two-dimension game scene
WO2022193612A1 (en) Motion processing method and apparatus for game character, and storage medium and computer device
CN108771866B (en) Virtual object control method and device in virtual reality
CN112138386A (en) Volume rendering method and device, storage medium and computer equipment
CN111768473B (en) Image rendering method, device and equipment
CN108668108B (en) Video monitoring method and device and electronic equipment
US20170186243A1 (en) Video Image Processing Method and Electronic Device Based on the Virtual Reality
US20170154469A1 (en) Method and Device for Model Rendering
US20230290043A1 (en) Picture generation method and apparatus, device, and medium
CN110120087A (en) The label for labelling method, apparatus and terminal device of three-dimensional sand table
CN114047824A (en) Method for interaction of multiple terminal users in virtual space
WO2018232742A1 (en) Method and device for pointing object in virtual reality (vr) scene, and vr apparatus
CN110889384A (en) Scene switching method and device, electronic equipment and storage medium
CN115082607A (en) Virtual character hair rendering method and device, electronic equipment and storage medium
CN112206519B (en) Method, device, storage medium and computer equipment for realizing game scene environment change
CN111897437A (en) Cross-terminal interaction method and device, electronic equipment and storage medium
CN111589114A (en) Virtual object selection method, device, terminal and storage medium
CN111915479A (en) Image processing method and device, electronic equipment and computer readable storage medium
CN111599292A (en) Historical scene presenting method and device, electronic equipment and storage medium
CN108986228B (en) Method and device for displaying interface in virtual reality
CN115359164A (en) Method, system, electronic device and storage medium for presenting object in screen center

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