Search

CN-122023604-A - Automatic generation method and system for primitive set mapping animation based on neural network

CN122023604ACN 122023604 ACN122023604 ACN 122023604ACN-122023604-A

Abstract

The invention provides a method and a system for automatically generating primitive set mapping animation based on a neural network, belonging to the field of computer graphics. The method comprises the steps of obtaining a starting primitive set and a target primitive set, encoding to obtain corresponding features, calculating a primitive matching matrix by using a neural network model based on a cross attention mechanism based on the features, determining a matching relation between the starting primitive and the target primitive according to the primitive matching matrix, generating an intermediate primitive sequence by parameter interpolation for matched primitive pairs, realizing the addition or extinction of the primitives by transparency gradient processing for unmatched primitives, and generating an animation frame sequence by symbolic distance field Boolean operation rendering according to the intermediate primitive sequence and the Boolean operation relation. The invention obviously improves the structural semantic expression capability, the topological stability and the cross-icon generalization capability of animation generation, and can be widely applied to the fields of user interface dynamic icon design, game engine graphic animation, mobile terminal interaction effect and the like.

Inventors

  • WEN XINYU
  • JIN XIAOGANG

Assignees

  • 浙江大学

Dates

Publication Date
20260512
Application Date
20260410

Claims (9)

  1. 1. The automatic generation method of the primitive set mapping animation based on the neural network is characterized by comprising the following steps of: Acquiring a starting primitive set and a target primitive set, wherein each primitive set consists of a plurality of symbol distance field basic primitives and Boolean operation relations thereof; Respectively encoding the initial primitive set and the target primitive set to obtain initial primitive set characteristics and target primitive set characteristics; Calculating a primitive matching matrix by using a neural network model based on a cross-attention mechanism based on the initial primitive feature set and the target primitive feature set; Determining a matching relation between a starting primitive and a target primitive according to the primitive matching matrix, generating an intermediate primitive sequence by parameter interpolation for matched primitive pairs, and realizing the addition or extinction of the primitives by transparency gradient processing for unmatched primitives; And generating an animation frame sequence through the Boolean operation rendering of the symbol distance field according to the intermediate primitive sequence and the Boolean operation relation.
  2. 2. The automatic generation method of primitive set mapping animation based on neural network according to claim 1, wherein each primitive at least comprises primitive boolean operation type information, primitive type information and primitive geometry parameter information; the primitive Boolean operation type information comprises a union set, a difference set and an intersection set; the primitive category information comprises circles, rectangles and triangles; the graphic element geometric parameter information is coded and expressed as , wherein, As the kind information of the graphic element, Determining the location of the primitive in image space for the anchor point parameter, The size relation of the graphic element relative to the unit space is determined for the scaling parameter, The orientation of the primitive is determined for the rotation parameter, The color of the primitive is determined for the color parameter, The visibility of the primitives is determined for the transparency parameters.
  3. 3. The automatic generation method of primitive set mapping animation based on neural network according to claim 2, wherein the encoding process comprises: Performing single-heat coding on the category information of each graphic element in a predefined graphic element category vocabulary to obtain a first feature, performing single-heat coding on the Boolean operation type information of each graphic element in the predefined Boolean operation type vocabulary to obtain a second feature, and normalizing the geometric parameter information of each graphic element to obtain a third feature; And after the first feature, the second feature and the third feature are spliced, mapping the first feature, the second feature and the third feature to the feature vector through a multi-layer perceptron to obtain the initial primitive set feature and the target primitive set feature.
  4. 4. The automatic generation method of primitive mapping animation based on neural network according to claim 1, wherein in step 3, the calculating the primitive matching matrix using the neural network model based on the cross-attention mechanism comprises: Adopting a Transformer architecture as a basic framework, introducing a cross attention mechanism, taking initial primitive set characteristics as inquiry, taking target primitive set characteristics as keys and values, and calculating a similarity matrix by scaling dot product attention Wherein And A learnable query matrix and a key matrix respectively, As the dimension of the key vector, Representing the characteristics of the starting primitive set, The index of the starting primitive is indicated, Representing the characteristics of the set of target primitives, Representing a target primitive index; And normalizing the similarity matrix according to the rows to generate a primitive matching matrix.
  5. 5. The method for automatically generating primitive set mapping animation based on neural network according to claim 4, wherein the step of determining the matching relationship between the initial primitive and the target primitive according to the primitive matching matrix comprises setting a matching probability threshold, and determining that the initial primitive is matched with the target primitive when the corresponding element in the primitive matching matrix is greater than the matching probability threshold, otherwise, adopting a default mapping strategy to process the primitive corresponding relationship.
  6. 6. The automatic generation method of primitive set mapping animation based on neural network according to claim 1, wherein the generating the intermediate primitive sequence by parameter interpolation comprises: According to the calculated primitive matching matrix, decomposing the primitive animation into independent channels of displacement, scaling, rotation, color and transparency, respectively carrying out parameter interpolation according to the independent channels, and generating a smooth intermediate primitive sequence by combining continuous sampling of time parameters.
  7. 7. The automatic generation method of primitive set mapping animation based on neural network according to claim 1, wherein the adding or subtracting of primitives through transparency gradient processing comprises: For primitives that exist in the starting primitive set but do not exist in the target primitive set, extinction is achieved by progressively decreasing transparency, and for primitives that exist in the target primitive set but do not exist in the starting primitive set, a new increase is achieved by progressively increasing transparency.
  8. 8. The automatic generation method of primitive set mapping animation based on neural network according to claim 2, wherein the generating an animation frame sequence by symbolic distance field boolean operation rendering comprises: based on the symbol distance fields of the primitives in the intermediate primitive sequence, combining the whole symbol distance fields according to a Boolean operation relation, wherein the Boolean operation relation adopts a mode of taking the minimum value to represent the union set, taking the maximum value to represent the difference set and taking the maximum value to represent the intersection set; And generating pixel color values by applying an antialiasing threshold function to the whole symbol distance field, and mixing the color and transparency parameters of each graphic element to obtain a final rendering result, wherein the final rendering result supports two modes of frame-by-frame image sequence and real-time rendering by a shader.
  9. 9. An automatic primitive set mapping animation generation system based on a neural network, for implementing the automatic primitive set mapping animation generation method according to any one of claims 1-8, comprising: The system comprises a primitive set acquisition module, a primitive set encoding module, a primitive set mapping module, an animation generation module and a rendering output module; the primitive set acquisition module is used for acquiring and analyzing the structured primitive set data to obtain a starting primitive set and a target primitive set; The primitive set coding module is used for respectively coding the initial primitive set and the target primitive set characteristics to obtain the initial primitive set characteristics and the target primitive set characteristics; The primitive set mapping module is used for calculating a primitive matching matrix by using a neural network model based on a cross attention mechanism based on a starting primitive feature set and a target primitive feature set; The animation generation module is used for determining the matching relation between the initial primitive and the target primitive according to the primitive matching matrix, and generating an intermediate primitive sequence through parameter interpolation for matched primitive pairs; And the rendering output module is used for generating an animation frame sequence through symbolic distance field Boolean operation rendering according to the intermediate primitive sequence and the Boolean operation relation.

Description

Automatic generation method and system for primitive set mapping animation based on neural network Technical Field The invention belongs to the field of computer graphics, and particularly relates to a method and a system for automatically generating primitive set mapping animation based on a neural network. Background In a user interface design and graphic interaction system, a geometric interpolation technology and an animation generation method are needed to realize smooth animation transition between vector icons. Previous work has focused primarily on Scalable Vector Graphics (SVG) animation generation. For example, carlier et al in paper DeepSVG (depth vector image) published by NIPS 2020, propose a hierarchical generation network-based SVG representation learning method. According to the method, coding and decoding modeling is carried out on the SVG command sequence, distributed representation of vector graphics is learned in a latent space, and continuous transition between different SVG graphics is realized through latent space interpolation, so that SVG animation generation is supported to a certain extent. The method provides an early exploration path for data-driven vector graphics animation. However, deepSVG performs transitional modeling mainly based on command sequences and latent variable interpolation, and the animation process relies on continuous change of the whole latent space, and lacks explicit modeling on graphic internal structure semantics, primitive combination relations and Boolean operation logic. When there is a significant difference in the structural composition or topological relationship of the two icons, it is often difficult to ensure structural stability and semantic consistency of the transition process by only latent spatial interpolation. In recent years, with the development of text-to-image diffusion models, researchers have proposed a series of automated SVG generation methods. For example, vectorFusion and SVGDREAMER methods, both utilize visual priors of pre-trained diffusion models to enable automatic generation of text to SVG through micro-vector renderings and parameter optimization. Such methods offer significant improvements in visual quality, diversity, and editability. Although the above method focuses mainly on automatic synthesis of single-frame SVG, the generation mechanism and parameter optimization framework can theoretically provide a basic representation and a transition starting point for SVG animation generation. However, the prior art has the following key problems: 1. The existing automatic icon animation generation scheme mostly adopts SVG paths or control point sequences as minimum modeling units, does not carry out explicit modeling on the structural composition and semantic relation of graphics, is easy to cause the loss of structural information in the animation process, and introduces a semantic fuzzy intermediate state. For example, a circular icon is formed by two concentric circles through boolean difference set operation, while the path representation method can only record the outline, and cannot retain the structural information of "difference between two circles". 2. The path interpolation method mostly adopts a fixed linear or Bezier curve interpolation strategy, lacks a learning mechanism for the evolution rule of the icon structure, cannot adaptively adjust the transition scheme according to the structure difference of the icon pairs, and is easy to cause visual jump or unnatural deformation effect. 3. When the number of structures, the combination logic or the topological relation between the initial icon and the target icon is changed, the traditional path interpolation process is unstable, and problems such as selfing, overturning or artifact are easy to generate, so that the quality of the animation is reduced. 4. The existing method is difficult to distinguish the corresponding relation of the primitives from the newly added/subtracted relation, the structured primitives which are not combined with the graphics are represented, the Boolean operation semantic information is easy to lose, the method based on deep learning relies on end-to-end pixel level generation, and the explicit control capability on the primitive level structure is lacking. 5. Existing methods are difficult to directly integrate with real-time rendering pipelines based on symbolic distance fields. The Symbol Distance Field (SDF) method is increasingly widely applied to game engines, mobile terminal UI and Web graphics, but an intermediate frame generated by a traditional path interpolation method cannot be directly converted into SDF expression, so that seamless connection with a shader animation pipeline cannot be realized. 6. The richness of the animation effect is limited, and the traditional method only supports simple interpolation of geometric parameters, cannot simultaneously cover multi-dimensional animation channels such as displacement, scaling,