Virtual book generation method and device, equipment, medium and program product
Through the virtual book generation method, the initial book model is dynamically generated and page turning animation is added, which solves the problem of low efficiency of existing 3D book generation, achieves a faster development cycle and diversified virtual book styles, and improves the user experience.
Patent Information
- Application Number
- CN202410675774.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-28
- Publication Date
- 2024-08-30
AI Technical Summary
The existing 3D book generation method is inefficient and requires a long time to develop. When changing the way the book is presented, it needs to go through the original painting-model-animation-program development process, resulting in slow product iteration.
Provide a virtual book generation method that inputs book information into the book generation model, adds text content based on typesetting rules, calculates the curvature scalar of virtual book pages, determines the style type and generates page turning animations, including scrolls, simulated contemporary books and sliding effects , dynamically generate the initial book model to reduce the manual design process.
It improves the efficiency of 3D book generation, reduces manual design participation, shortens the development cycle, makes the virtual book style closer to reality and diversified, and improves user experience.
Smart Images

Figure CN118570343A
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of artificial intelligence technology, and in particular to a method, device, equipment, medium and program product for generating a virtual book. Background Art
[0002] The currently commonly used method for generating Metaverse 3D books is: specify a book style, manually draw 2D renderings, manually make models, and manually make flipping effects. Finally, generate reading content on the model through program development, and combine it with page-turning animations to complete the production of a 3D book.
[0003] It can be seen that the current technical solution requires a long development cycle to produce a 3D book style. If the way the book is displayed needs to be changed, it is necessary to go through the process of original painting-model-animation-program development, resulting in slow product iteration and low efficiency in generating 3D books. Summary of the invention
[0004] The embodiments of the present application provide a method, device, equipment, medium and program product for generating a virtual book to solve the technical problem of low efficiency in the production method of 3D books in the related art.
[0005] To solve the above technical problems, the embodiments of the present application provide the following aspects:
[0006] In a first aspect, an embodiment of the present application provides a method for generating a virtual book, the method comprising:
[0007] Inputting the book information of the book to be produced into a preset book generation model to obtain an initial book model; wherein the initial book model includes virtual book pages;
[0008] Based on a preset typesetting rule, adding the text content of the book to be produced to the virtual book page;
[0009] Determining a curvature scalar of the virtual page based on the surface curvature of the virtual page;
[0010] Determining the style type of the virtual book page according to the curvature scalar;
[0011] A page turning animation is determined according to the style type, and the page turning animation is added to the initial book model to generate a virtual book.
[0012] Optionally, the style type includes at least one of the following: a scroll style type, a simulated contemporary book style type, and other style types, and determining the page turning animation according to the style type includes:
[0013] When the style type is the scroll style type, determining that the page turning animation is a scroll opening effect;
[0014] When the style type is the simulated contemporary book style type, determining the page turning animation to be a book page turning effect;
[0015] When the style type is the other style types, it is determined that the page turning animation is a sliding page turning effect.
[0016] Optionally, when the style type is the scroll style type, determining that the page turning animation is a scroll opening effect includes:
[0017] Based on the transform component, increasing the expanded length of the virtual page frame by frame and adjusting the position of the virtual page;
[0018] According to the time interval of each frame of virtual book pages, the rotation angle of the scroll body model is increased frame by frame to simulate the opening effect of the scroll and generate a page turning animation.
[0019] Optionally, when the style type is the simulated contemporary book style type, determining that the page turning animation is a book page turning effect includes:
[0020] Determine the virtual page turning axis and select any corner of the current virtual page as the starting point for page turning;
[0021] Based on the transform component, the any corner is driven to be folded along the virtual page turning axis, and the current virtual page is driven to rotate, so as to simulate the page turning effect and generate a page turning animation.
[0022] Optionally, when the style type is the other style types, determining that the page turning animation is a sliding page turning effect includes:
[0023] The sliding direction of the user is determined, and the current virtual page is driven to move out of the current display area along the sliding direction, and the next virtual page of the current virtual page is driven to move into the current display area to simulate the sliding page turning effect and generate a page turning animation.
[0024] Optionally, the method further includes:
[0025] Receiving description information input by a user describing the appearance style of the book to be produced;
[0026] The appearance style of the initial book model is changed according to the description information.
[0027] In a second aspect, an embodiment of the present application provides a device for generating a virtual book, the device comprising:
[0028] A generation module, used for inputting book information of a book to be produced into a preset book generation model to obtain an initial book model; wherein the initial book model includes virtual book pages;
[0029] An execution module, configured to add the text content of the book to be produced to the virtual book page based on a preset typesetting rule;
[0030] Determining a curvature scalar of the virtual page based on the surface curvature of the virtual page;
[0031] Determining the style type of the virtual book page according to the curvature scalar;
[0032] A page turning animation is determined according to the style type, and the page turning animation is added to the initial book model to generate a virtual book.
[0033] Optionally, the style type includes at least one of the following: a scroll style type, a simulated contemporary book style type and other style types, and the execution module is further used to determine that the page turning animation is a scroll opening effect when the style type is the scroll style type;
[0034] When the style type is the simulated contemporary book style type, determining the page turning animation to be a book page turning effect;
[0035] When the style type is the other style types, it is determined that the page turning animation is a sliding page turning effect.
[0036] Optionally, the execution module is further configured to, when the style type is the scroll style type, increase the unfolded length of the virtual page frame by frame and adjust the position of the virtual page based on a transform component;
[0037] According to the time interval of each frame of virtual book pages, the rotation angle of the scroll body model is increased frame by frame to simulate the opening effect of the scroll and generate a page turning animation.
[0038] Optionally, the execution module is further used to determine a virtual page turning axis when the style type is the simulated contemporary book style type, and select any corner of the current virtual book page as a starting point for page turning;
[0039] Based on the transform component, the any corner is driven to be folded along the virtual page turning axis, and the current virtual page is driven to rotate, so as to simulate the page turning effect and generate a page turning animation.
[0040] Optionally, the execution module is also used to determine the user's sliding direction when the style type is the other style types, drive the current virtual page to move out of the current display area along the sliding direction, and drive the next virtual page of the current virtual page to move into the current display area, so as to simulate the sliding page turning effect and generate a page turning animation.
[0041] Optionally, the execution module is further configured to receive description information input by a user to describe the appearance style of the book to be produced; and to change the appearance style of the initial book model according to the description information.
[0042] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor, a memory, and a program stored in the memory and executable on the processor, wherein the program, when executed by the processor, implements the steps of a method for generating a virtual book as described in the first aspect.
[0043] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of a method for generating a virtual book as described in the first aspect are implemented.
[0044] In a fifth aspect, an embodiment of the present application provides a computer program product, including computer instructions, which, when executed by a processor, implement the steps of a method for generating a virtual book as described in the first aspect.
[0045] Therefore, in the method shown in the embodiment of the present application, an initial book model can be dynamically generated according to the book information of the book to be produced, and the virtual book page content can be typeset and added according to the initial book model, and the corresponding page turning effect can be generated to finally generate a virtual book, so that the style of the virtual book is closer to reality and more diversified, and the manual design and modeling process of designers, modelers, special effects artists, etc. is eliminated, which can improve the generation efficiency of 3D books. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present application. Also, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0047] Figure 1 A flowchart of a method for generating a virtual book provided in an embodiment of the present application;
[0048] Figure 2A and Figure 2BA comparative schematic diagram of a user interacting with a 3D book in a virtual scene provided in an embodiment of the present application;
[0049] Figure 3 A schematic diagram of obtaining the curvature of a point on a virtual book page surface provided in an embodiment of the present application;
[0050] Figure 4 A schematic diagram of a page turning effect provided in an embodiment of the present application, in which a scroll opening effect is provided;
[0051] Figure 5 A schematic diagram of a page turning effect provided in an embodiment of the present application that simulates the page turning effect of a modern book;
[0052] Figure 6 A schematic diagram of a page turning effect provided in an embodiment of the present application in which a sliding page turning effect is provided;
[0053] Figure 7 A flowchart of a method for generating a virtual book provided in an embodiment of the present application;
[0054] Figure 8 A structural block diagram of a device for generating a virtual book is provided for an embodiment of the present application;
[0055] Fig. 9 A structural block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0056] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0057] Figure 1 A method for generating a virtual book according to an embodiment of the present application is shown, the method comprising:
[0058] Step S101, inputting the book information of the book to be produced into a preset book generation model to obtain an initial book model;
[0059] Among them, the initial book model includes virtual book pages;
[0060] Step S102: adding the text content of the book to be produced to the virtual book page based on the preset typesetting rules;
[0061] Step S103, determining the curvature scalar of the virtual page based on the surface curvature of the virtual page;
[0062] Step S104, determining the style type of the virtual book page according to the curvature scalar;
[0063] Step S105: determine a page turning animation according to the style type, and add the page turning animation to the initial book model to generate a virtual book.
[0064] In step S101, the book information includes at least one of the following: the appearance, type, and publishing information of the book to be produced. First, it is necessary to collect and obtain information related to the book to be produced for the production of an initial book model (such as a 3D virtual book model). In addition, the content of the book can be obtained, such as the text content, chapter structure, illustrations, etc. of the book; the size of the book: such as the length, width, height and other dimensional information of the book; the cover design of the book, such as the cover design elements, colors, patterns, etc. of the book; the page layout, such as the typesetting, fonts, line spacing and other design details of the book pages; other customized requirements: other information related to book production can be obtained according to the specific situation.
[0065] In addition, not only can the book information related to the book be directly obtained, but also after generating the initial book model based on the preset book generation model, the description information input by the user to describe the appearance style of the book to be produced can be received; and the appearance style of the initial book model can be changed according to the description information. Figure 2A and Figure 2B As shown, the user can click the "Switch Style" button, and then a style keyword input box pops up, and the user enters keywords, such as the style description of the book style: technology style, cultural style, etc., or descriptive words such as color and shape, to change the appearance style of the initial book model. And it is not limited to the user changing the style of the book after the initial book model is generated. The description information can also be input into the preset book generation model to combine the relevant information of the book to generate an initial book model that meets the user's needs and conforms to the objective actual book.
[0066] It should be noted that the preset book generation model can be an AIGC (Artificial Intelligence Generated Content) model. AIGC refers to a technology based on artificial intelligence technical methods such as generative adversarial networks and large pre-trained models, which generates relevant content with appropriate generalization capabilities through learning and recognition of existing data. The core idea of AIGC technology is to use artificial intelligence algorithms to generate content with certain creativity and quality. AIGC can generate various forms of content and data, including text, images, music, video, 3D interactive content, etc., as well as open up new scientific discoveries, create new value and meaning, etc.
[0067] In a specific application scenario, it is necessary to first obtain the specific information of the book, and generate the corresponding book model based on the AIGC tool according to the specific information such as the relevant time of the book, the size of the book, the style of the book, etc., and then confirm the size and world position of the book according to the resolution of the display end and the player position (the position of the virtual player). Among them, the generation of the model is mainly to find the relevant time data based on the data stored in the local library, generate a description of the book appearance model based on the time data, and transmit it to the AIGC tool to generate the corresponding model. The main technologies used are key information extraction, content summary, AIGC, etc. In order to generate a model that is convenient to place in space and easy to use, it is necessary to ensure that the center of the model coincides with the actual physical center, and the book page is facing the y-axis direction. After completing these operations, a book-style model (book_model) and a cut image (page_image) of the corresponding book page will be obtained. Therefore, the initial book model can be dynamically generated according to the book information or user selection, so that the generated initial book model is closer to the actual physical book and more in line with the user's choice, which improves the user's experience.
[0068] In step S102, the text content of the book to be produced can be added to the virtual book page based on the preset typesetting rules. Specifically, the text content of the book to be produced can be obtained, and after the text content is typeset according to the size, sequence and preset typesetting rules of the virtual book page, the typeset text content is added to the virtual book page to obtain the virtual book page with the text content added. That is to say, the corresponding virtual written page and the size of the virtual written page can be located according to the generated initial book model, and the typesetting style (vertical version / horizontal version) can be confirmed according to the publication time of the book, and then the typesetting content of each page can be confirmed according to the content of the article. Specifically, the text content of the book to be produced needs to be obtained first, and these text contents can be the text content, chapter structure, etc. of the book. Then, the text content needs to be typeset according to the size of the book page and the preset typesetting format to ensure that the layout of the text on the book page is reasonable and beautiful. The typesetting process includes determining the typesetting parameters such as font, font size, line spacing, paragraph spacing, and arranging the text content page by page according to the sequence of the book page. In this way, it can be ensured that the presentation of the text content on the book page meets the expected typesetting effect. After the layout of the text content is completed, the next step is to add the layout text content to the virtual book page. This step can be done through computer software. The layout text content is inserted into the design template of the virtual book page to ensure the coordination and balance of the text and page elements. The virtual book page with added text content is included in the initial book model as part of the initial book model. The entire layout process needs to pay attention to maintaining the clarity and readability of the text content, while also considering the beauty of the layout and the overall design style to ensure that the final book page can attract readers and provide a good reading experience.
[0069] In step S103 to step S105, the curvature scalar of the virtual book page needs to be determined based on the surface curvature of the virtual book page; the style type of the virtual book page is determined according to the curvature scalar, and then the page turning animation is determined, and then the page turning animation is added to the initial book model to generate a virtual book. The style type includes at least one of the following: scroll style type, simulated contemporary book style type, and other style types. The page turning effect type corresponding to the scroll style type is the scroll opening effect, the page turning effect type corresponding to the simulated contemporary book style type is the book page turning effect, and the page turning effect type corresponding to the other style types is the sliding page turning effect.
[0070] It should be noted that the scroll style type is a cylindrical style similar to a scroll. The pages of this style are geometrically similar to a fully or partially rolled up shape, showing obvious curvature, which is suitable for simulating ancient scrolls or certain special forms of artistic display. The simulated contemporary book style type is a rectangular style similar to a contemporary book. The pages of this style are visually close to regular books, and the pages remain basically straight, with almost no or no curvature, which is suitable for most traditional books and documents. The remaining style types are between the first two style types, with a certain curvature, but not as significant as the scroll style type. The remaining style types can be used to simulate tortoise shells, wooden boards or other slightly curved materials, providing a visual style between classical and contemporary.
[0071] The corresponding page turning effects are introduced for different style types.
[0072] In a possible implementation, when the style type is a scroll style type, determining the page turning animation as a scroll opening effect includes: based on the transform component, increasing the unfolded length of the virtual page frame by frame and adjusting the position of the virtual page; according to the time interval of each frame of the virtual page, increasing the rotation angle of the scroll body model frame by frame to simulate the scroll opening effect and generate a page turning animation.
[0073] In one possible implementation, when the style type is a simulated contemporary book style type, determining the page turning animation as a book page turning effect includes: determining a virtual page turning axis, and selecting any corner of the current virtual book page as the starting point for turning the page; based on the transform component, driving any corner to turn along the virtual page turning axis, and driving the current virtual book page to rotate, so as to simulate the book page turning effect and generate a page turning animation.
[0074] In one possible implementation, when the style type is other style types, determining that the page turning animation is a sliding page turning effect includes: determining the user's sliding direction, driving the current virtual page to move out of the current display area along the sliding direction, and at the same time driving the next virtual page of the current virtual page to move into the current display area to simulate the sliding page turning effect and generate a page turning animation.
[0075] After the page turning animation is generated, it is necessary to add the page turning animation to the corresponding initial book model to finally generate a virtual book.
[0076] It should be noted that when generating different page turning effects, it is mainly divided into two parts: curvature scalar calculation and page turning effect calculation.
[0077] Calculation of curvature scalar:
[0078] The book styles are divided into three categories. Style A is a cylinder similar to a scroll (corresponding to the style described in the first possible implementation method above), style B is a cuboid similar to a contemporary book (corresponding to the style described in the second possible implementation method above), and style C is between AB and is a slightly curved model. It can be defined as a tortoise shell, a wooden board, etc. (corresponding to the style described in the third possible implementation method above). It is necessary to calculate the curvature scalar to confirm which type of A, B, and C the generated model belongs to. The method is: locate the surface of the book page, mesh the surface, and obtain N points P on the surface. N .
[0079] Calculate N P N The curvature c of a point is calculated as:
[0080] Draw a circle tangent to point p and cut the circle into m points q, as Figure 3 As shown, where N is the normal vector of point p, M i is the normal vector of point q, N is the Z axis to form the coordinate system L. It is known that in L, M i (o x,i ,o y,i ,o z,i ), p(x n ,y n ,z n ), then the curvature of point p is:
[0081]
[0082] but From this, we can get the curvature scalar (a, d) of the entire surface, where a = ∑c i / N,d=∑(c i -a) 2 / N. Set the threshold (δ a ,δ b ), if a=0±δ a , and d=0±δ b , then the model is considered to belong to category C; if a≠0±δ a , and d=0±δ b , then the model belongs to Class A, otherwise, the model belongs to Class B.
[0083] Page turning effect calculation:
[0084] After determining the model type according to the curvature scalar, it can be seen that the A-type model is a scroll style, which can replace silk fabrics, bamboo slips, etc., and the page-turning effect is rolling; Class C is a contemporary simulation book style, and the page-turning effect corresponds to simulation; Class B is others, using a sliding effect.
[0085] Here are some basic concepts: The method shown in the embodiment of the present application uses a Transform component, which contains the position (Position), rotation (Rotation) and scale (Scale) of each object in the scene. Position refers to the position of the Transform component on the X, Y, and Z axes. Rotation refers to the degree of rotation of the Transform component around the X, Y, and Z axes. Scaling refers to the scaling of the Transform component along the X, Y, and Z axes. When the scale value is 1, it is the original size of the scaled object. For each pixel on the object, there is a vertex coordinate (x, y, z), and in the specific description of the page turning effect below, the initialization Transform of each object is defined as T0={(p x ,p y ,p z ),(r x ,r y ,r z ),(s x ,s y ,s z )}, let the time of each frame be t f .
[0086] Scroll Effect:
[0087] The scroll effect can be divided into two parts: the twitching and deformation of the book page (lengthening along the x-axis), and the rolling of the scroll body (rotating around the y-axis). By modifying the position of the page Transform and the rotation of the scroll body frame by frame, a pseudo scroll opening effect can be created (such as Figure 4 shown).
[0088] Set the page's movement speed to v x , then the Transform of the page changes to:
[0089]
[0090] Where L is the original length of the page, and n represents the nth frame.
[0091] Set the rotation speed of the scroll body (i.e. the cylinder in the figure) to θ, then the Transforms of the cylinder will change to:
[0092] Tn =T0+{(0,0,0),(0,n*t f *θ,0},(0,0,0)},n∈[0,1,2,……,n]
[0093] Simulation effect:
[0094] The simulation effect can be seen as the folding and twisting of the lower right corner of the book page along the axis OR, where the OR axis is centered on O frame by frame, and the red shadow area from OS to OE is scanned flatly, and A′ is the symmetric point of A about the OR axis. And the entire book page needs to be flipped around the axis y. The above animations can form a simulation effect of page turning (such as Figure 5 shown).
[0095] Define the book page as page P, and the normal vector of P is The vertex coordinates of point O on plane P are (x o ,y o ,z o ), point R is also on plane P, and point R moves at a speed of V y , moving from point S to point E, the coordinate change of R is:
[0096] P R =(x R ,y R ,z R )=(x s ,y s ,z d )+(0,V y *t f *n),y s +V y *t f *n≤y e
[0097] The direction vector of the line OR is According to the following relationship:
[0098]
[0099] Find the normal vector of the plane Q that is perpendicular to the page P and passes through OR And it is known that R is also on plane Q, then the expression of plane Q is:
[0100] a(xx R )+b(yy R )+c(zz R )=0;
[0101] Point A is the bottom corner of page P, and its vertex coordinates are (x A ,y A ,z A), only A′(x A′ ,y A′ ,z A′ ) is the symmetric point of point A about plane Q, indicating the position of A after turning the page. Parallel to The center point of points A and A' is on plane Q, so we have the equation:
[0102]
[0103] According to the above equations, we can get A′(x A′ ,y A′ ,z A′ ) coordinates. It can be obtained that the line connecting R and A' is the state of the folded edge, but as shown in the figure above, the inversion form is not realistic enough, so it is best to make the straight line RA' have a certain curvature, then interpolation can be performed between points R and A' so that the inserted points conform to the curve distribution. When point R moves to point E, the plane P can be rotated around the y axis as a whole, and the coordinates of all vertices on the plane change to:
[0104]
[0105] Here, θ represents the rotation angle.
[0106] Sliding effect: The sliding effect requires two page objects to cooperate with each other to change their position to achieve the sliding effect (such as Figure 6 shown):
[0107] The specific process is: determine the user's sliding direction, if sliding left, the direction coefficient d = -1, if sliding right, the direction coefficient d = 1;
[0108] The current page A is within the user's visible area, and the initial Transforms are:
[0109] T A,0 ={(p x ,p y ,p z ),(r x ,r y ,r z ),(s x ,s y ,s z )};
[0110] Then the initial Transforms of page A' are:
[0111] T A ′ ,0 ={(p x +(-d*L)+p y ,pz ),(r x ,r y ,r z ),(s x ,s y ,s z )}:
[0112] Where, L is the length of the page.
[0113] Assume that the sliding speed of the page is v x , then the Transform changes of the two are:
[0114] T A,n =T A,0 +{d*(n*t f *v x ,0,0),(0,0,0},(0,0,0)},n∈[0,1,2,……,n]
[0115] T A ′ ,n =T A ′ ,0 +{d*(n*t f *v x ,0,0),(0,0,0},(0,0,0)},n∈[0,1,2,…,n];
[0116] After reaching the final state, page A′ is within the user’s visual field, and the position of page A is corrected to
[0117] T A,n =T A ′ 0
[0118] That is, the position of the original page A and the position of page A' are replaced.
[0119] It should be noted that the initial book model and page turning can be bound to various trigger events (such as virtual player clicks, page turning and other operations) to generate a virtual book that can interact with users. It should also be noted that the application of AIGC can also dynamically generate page styles and page turning effects, but the method shown in the embodiment of the present application takes into account that the AIGC generation model and the AIGC dynamic generation of page styles and page turning effects are high-frequency trigger operations. If it is completely dependent on AIGC, the calculation efficiency is low and the user experience is poor, so the Transform component is used to dynamically generate page styles and page turning effects.
[0120] In summary, if Figure 7As shown, the method shown in the embodiment of the present application can combine book information, generate a book model based on AIGC, and further generate a method of dynamically generating a book page style and page turning effect based on the book model. And the user can interactively switch the dynamic book style by selecting a book style or entering a keyword. Compared with the existing 3D book development process, the present application uses AIGC and corresponding algorithms to automatically generate the model, style, and page turning effects of 3D books, which shortens the development cycle of 3D books, reduces manual participation, and improves the generation efficiency and accuracy of 3D books. The method shown in the embodiment of this application allows users to select 3D book styles, improve user experience, and deepen the combination of virtual and real. In addition, compared with the related technology that uses AIGC to generate all content, the method shown in the embodiment of the present application uses relevant algorithms to automatically generate the typesetting style and page turning effects of 3D books, greatly shortening the user's waiting time and further improving the generation efficiency of 3D books.
[0121] The method shown in the embodiment of the present application utilizes AIGC combined with relevant algorithms to dynamically generate 3D books, eliminating the manual design and modeling process of designers, modelers, special effects artists, etc., and can generate a 3D book style that is more in line with the actual book based on the basic information of the book, deepen the combination of virtual and real, and enhance the user's reading experience in the metaverse world. It can be applied to the metaverse 3D book scene.
[0122] Figure 8 A device for generating a virtual book according to an embodiment of the present application is shown, and the device 80 includes:
[0123] The generation module 801 is used to input the book information of the book to be produced into a preset book generation model to obtain an initial book model; wherein the initial book model includes virtual book pages;
[0124] An execution module 802 is used to add the text content of the book to be produced to the virtual book page based on a preset typesetting rule;
[0125] Determine a curvature scalar of the virtual book page based on the surface curvature of the virtual book page;
[0126] Determine the style type of the virtual book page according to the curvature scalar;
[0127] The page turning animation is determined according to the style type, and the page turning animation is added to the initial book model to generate a virtual book.
[0128] In a possible implementation, the style type includes at least one of the following: a scroll style type, a simulated contemporary book style type, and other style types. The execution module 802 is further configured to determine that the page turning animation is a scroll opening effect when the style type is the scroll style type;
[0129] When the style type is a simulated contemporary book style type, the page turning animation is determined to be a book page turning effect;
[0130] When the style type is other style types, the page turning animation is determined to be a sliding page turning effect.
[0131] In a possible implementation, the execution module 802 is further configured to, when the style type is a scroll style type, increase the unfolded length of the virtual page frame by frame and adjust the position of the virtual page based on the transform component;
[0132] According to the time interval of each frame of virtual book pages, the rotation angle of the scroll model is increased frame by frame to simulate the scroll opening effect and generate a page turning animation.
[0133] In a possible implementation, the execution module 802 is further configured to determine a virtual page turning axis when the style type is a simulated contemporary book style type, and select any corner of the current virtual book page as a starting point for page turning;
[0134] Based on the transform component, drive any corner to fold along the virtual page turning axis, and drive the current virtual page to rotate to simulate the page turning effect and generate a page turning animation.
[0135] In one possible implementation, the execution module 802 is also used to determine the user's sliding direction when the style type is other style types, drive the current virtual page to move out of the current display area along the sliding direction, and drive the next virtual page of the current virtual page to move into the current display area to simulate the sliding page turning effect and generate a page turning animation.
[0136] In a possible implementation, the execution module 802 is further configured to receive description information input by a user to describe the appearance style of the book to be produced; and to change the appearance style of the initial book model according to the description information.
[0137] In the device 80 shown in the embodiment of the present application, the device can dynamically generate an initial book model according to book information or user selection, and layout the page content and generate corresponding page turning effects according to the initial book model, so that in the metaverse space, the style of the virtual book is closer to reality and more diverse, and the user can set the book style according to personal preferences, providing a reading interaction method in a metaverse scenario and improving the efficiency of generating virtual books.
[0138] The present application embodiment also provides an electronic device 90, such as Fig. 9 As shown, it includes: a processor 901, a memory 902, and a program stored in the memory 902 and executable on the processor 901. When the program is executed by the processor, the steps of a method for generating a virtual book as shown in the above embodiment are implemented.
[0139] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of a method for generating a virtual book shown in the above method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0140] The embodiment of the present application also provides a computer program product, including computer instructions, which, when executed by a processor, implement the steps of a method for generating a virtual book shown in the above method embodiment and can achieve the same technical effect. To avoid repetition, they are not described here.
[0141] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0142] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0143] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A method for generating a virtual book, characterized in that: The method comprises: Inputting the book information of the book to be produced into a preset book generation model to obtain an initial book model; wherein the initial book model includes virtual book pages; Based on a preset typesetting rule, adding the text content of the book to be produced to the virtual book page; Determining a curvature scalar of the virtual page based on the surface curvature of the virtual page; Determining the style type of the virtual book page according to the curvature scalar; A page turning animation is determined according to the style type, and the page turning animation is added to the initial book model to generate a virtual book.
2. The method according to claim 1, characterized in that The style type includes at least one of the following: a scroll style type, a simulated contemporary book style type and other style types, and determining the page turning animation according to the style type includes: When the style type is the scroll style type, determining that the page turning animation is a scroll opening effect; When the style type is the simulated contemporary book style type, determining the page turning animation to be a book page turning effect; When the style type is the other style types, it is determined that the page turning animation is a sliding page turning effect.
3. The method according to claim 2, characterized in that When the style type is the scroll style type, determining that the page turning animation is a scroll opening effect includes: Based on the transform component, increasing the expanded length of the virtual page frame by frame and adjusting the position of the virtual page; According to the time interval of each frame of virtual book pages, the rotation angle of the scroll body model is increased frame by frame to simulate the opening effect of the scroll and generate the page turning animation.
4. The method according to claim 2, characterized in that: When the style type is the simulated contemporary book style type, determining that the page turning animation is a book page turning effect includes: Determine the virtual page turning axis and select any corner of the current virtual page as the starting point for page turning; Based on the transform component, the any corner is driven to be folded along the virtual page turning axis, and the current virtual page is driven to rotate, so as to simulate the page turning effect and generate the page turning animation.
5. The method according to claim 2, characterized in that: When the style type is the other style types, determining that the page turning animation is a sliding page turning effect includes: The sliding direction of the user is determined, and the current virtual page is driven to move out of the current display area along the sliding direction, and the next virtual page of the current virtual page is driven to move into the current display area to simulate the sliding page turning effect and generate the page turning animation.
6. The method according to any one of claims 1 to 5, characterized in that The method further comprises: Receiving description information input by a user describing the appearance style of the book to be produced; The appearance style of the initial book model is changed according to the description information.
7. A device for generating a virtual book, characterized in that: The device comprises: A generation module, used for inputting book information of a book to be produced into a preset book generation model to obtain an initial book model; wherein the initial book model includes virtual book pages; The execution module is used to add the text content of the book to be produced to the virtual book page based on a preset typesetting rule; determine the curvature scalar of the virtual book page based on the surface curvature of the virtual book page; determine the style type of the virtual book page according to the curvature scalar; determine a page turning animation according to the style type, and add the page turning animation to the initial book model to generate a virtual book.
8. An electronic device, characterized in that: include: A processor, a memory, and a program stored in the memory and executable on the processor, wherein when the program is executed by the processor, the steps of the method for generating a virtual book according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the program is executed by the processor, the steps of the method for generating a virtual book according to any one of claims 1 to 6 are implemented.
10. A computer program product, characterized in that The method comprises computer instructions, which, when executed by a processor, implement the steps of the method for generating a virtual book according to any one of claims 1 to 6.
