The present invention relates to methods for generating using and storing representations of graphical data.
Computers are ubiquitous in modern society, finding an ever increasing number of roles. Computers are now frequently used to display and manipulate graphical data in a variety of different applications. Such applications include, by way of example, computer aided design and computer gaming.
When graphical data is displayed on a display device such as a computer monitor, the graphical data is represented by an array of pixels, each pixel having a value which defines its colour within the graphical data. While the use of pixel based data is necessary to allow the display of graphical data it does not lend itself to ready manipulation of the graphical data by, for example, scaling. Another known way of representing graphical data is by way of various graphical primitives such as lines, polygons etc. Such a representation is sometimes referred to as a vector-based representation, given its reliance on vectors and vector based primitives. Vector-based representations are useful in that they typically more readily allow manipulation of the graphical data in a way which preserves the integrity and quality of the graphical data.
As graphical data becomes more widely used, there is a need to ensure that it is efficiently stored. This is particularly so when graphical data is used on devices which have limited physical storage such as mobile telephones, tablet computers and the like. As such, various data compression techniques have been developed. Some such data compression techniques work with pixel data and carry out various transforms to compress the data. A widely used compression technique of this type is JPEG compression.
There is also a need for techniques which allow vector-based graphics data to be efficiently and effectively stored. It is an object of some embodiments of the present invention to provide a method for generating and storing a representation of graphical data.
According to a first aspect of the invention, there is provided a method of generating a representation of graphical data based upon a plurality of stored floating point data values and a plurality of stored integer values. The method comprises reading a plurality of said integer values; reading a plurality of said floating point data values, each read floating point data value being based upon a respective read integer value; and generating a representation of said graphical data based upon said plurality of read floating point data values.
In this way, a plurality of stored indices can refer to a single stored floating point value. As such, where a floating point value occurs a plurality of times within data to be represented, storage requirements can be minimised by storing the floating point value only once, and storing plural references to the floating point value. Given that the references take the form of integer values, there is a considerable saving in storage space requirements given that integers can be stored in a smaller space than floating point values.
The floating point values may represent all or part of the graphical data. For example, the floating point values may represent points in vector space as discussed below.
The floating point values may be stored in a data structure providing an integer index for each stored floating point value. For example, the floating point values may be stored in a table. Each read integer value may be the index of a respective one of the floating point values so as to identify that floating point value.
Each of the integer values may have an associated sign, and each of said floating point values may be unsigned. Reading said plurality of floating point values may then comprise modifying a sign of at least some of the read floating point values based upon the sign of the respective read integer value. Such an arrangement may be advantageous in that only the magnitude of each required floating point value is stored and can be referred to by positively and negatively signed integers to generate positive and negative floating point numbers respectively. This further reduces storage requirements given that only a single floating point data item is required to potentially generate two different floating point values of equal magnitude but differing sign.
Said plurality of integer values may define a plurality of tuples and said generating may generate a plurality of tuples representing features of said graphical data.
At least some of said tuples may define respective points in a vector space. For example, each tuple may take the form of an n-dimensional vector in an n-dimensional vector space.
The generating may further comprise reading a plurality of vertex data items, each vertex data item identifying one of said tuples and each vertex data item representing a vertex in the graphical data. In this way a plurality of vertices of an object to be represented can be stored and can refer to the stored tuples. A plurality of coincident vertices can be separately represented (by respective vertex data items), but rely upon the same stored data (i.e. the same tuple) so as to reduce total required storage space.
The graphical data may be represented by a plurality of polygons and the generating may generate the polygons from the vertex data items. The polygons may be triangles. The polygons may define a connectivity for the vertices represented by the vertex data items so as to define part of the graphical data.
Some of said tuples may represent a point in a two-dimensional texture map, said point in said two dimensional texture map being associated with one of said vertices and said generating may comprise generating graphical data in which said point in said two dimensional texture map is applied to said one of said vertices.
The tuples may be pairs or triples, or tuples of other dimension.
At least some of the tuples may define a colour. The at least some of said tuples which define a colour may comprise a plurality of elements, each element providing a value for a respective colour channel. For example, the at least some of the tuples which define a colour may comprise a first element providing a value for a red colour channel, a second element providing a value for a green colour channel, a third element providing a value for a blue colour channel and a fourth element providing a transparency value.
In some embodiments of the invention the read floating point values define a bounded range, and the method further comprises: reading integer data indicating a number of points within said bounded range; reading a plurality of integer data items, each identifying one of said points within said bounded range; and generating for each integer data item a floating point position value based upon the respective integer data item, the bounded range and the number of points within the bounded range.
Such a method provides a degree of quantization and means that only the data defining the bounds of the bounded range need be stored in floating point form, thereby further reducing floating point data storage requirements.
According to a further aspect of the present invention, there is provided a method of generating a stored representation of graphical data, the method comprising reading a plurality of signed floating point values providing a representation of said graphical data; storing a plurality of unsigned floating point values based upon said read floating point values, each unsigned floating point value being stored only once; and storing a plurality of integer values, each integer value identifying a stored floating point value and being associated with a read floating point value.
The floating point values may represent any component of the graphical data including, for example, points in vector space which define the graphical data, colour data or any other components which may be used to represent the graphical data.
Each of said integer values may have an associated sign based upon the sign of a respective read floating point value.
The read floating point values may define a plurality of tuples and the stored integer values may define a plurality of tuples.
Each of said tuples may define a point in a vector space.
The method may further comprise storing a plurality of vertex data items, each vertex data item identifying one of said tuples of integer values and each vertex data item representing a vertex in said graphical data. The method may further comprise storing data representing a plurality of polygons based upon said vertex data items. The polygons may be triangles.
At least some of said tuples may define a colour. The at least some of said tuples which define a colour may comprise a plurality of elements, each element providing a value for a respective colour channel. For example, such tuples may comprise a first element providing a value for a red colour channel, a second element providing a value for a green colour channel, a third element providing a value for a blue colour channel and a fourth element providing a transparency value.
The graphical data may represent an interconnection of fluid flow control components such as valves, filters and so on. Such graphical data may be useful in allowing visualisation of the interconnection of fluid flow control components.
Aspects of the invention can be implemented in any convenient form including by way of suitable methods, systems and apparatus. Aspects of the invention can be implemented by way of a computer. As such computer-implemented methods in which each step is carried out by a suitably programmed processor are provided. Similarly, aspects of the invention provide computer readable media comprising computer executable instructions configured to cause a computer to carry out a method as described above. Such computer readable media include tangible media (e.g. discs) and intangible media (e.g. communications signals). Further aspects of the invention provide computer readable media storing a representation of graphical data generated using a method as described above.
Where aspects of the invention are implemented by way of a computer, there may be provided a computer apparatus comprising a memory (e.g. a random access memory) storing processor readable instructions and a processor configured to read and execute instructions stored in said memory. The processor readable instructions may comprise instructions configured to cause the processor to carry out a method as set out above.
An embodiment of the invention will now be described, by way of example, with reference to the accompanying drawings, in which:
The computer 1 further comprises non-volatile storage in the form of a hard disc drive 4. The hard disc drive 4 may provide persistent storage for image data which is to be processed by the computer 1. The computer 1 further comprises an I/O interface 5 to which are connected peripheral devices used in connection with the computer 1. More particularly, a display 6 is configured so as to display output from the computer 1. Input devices are also connected to the I/O interface 5. Such input devices may include a keyboard 7 and a mouse 8 which allow user interaction with the computer 1. It will be appreciated that the computer 1 may have other input interfaces, for example where the computer 1 is a portable computer it may include any suitable portable computer interface such as a touch screen.
A network interface 9 allows the computer 1 to be connected to an appropriate communications network so as to receive and transmit data from and to other computers. The CPU 2, volatile memory 3, hard disc drive 4, I/O interface 5, and network interface 6, are connected together by a communications bus 10 to allow communication therebetween.
As has been discussed above, the computer 1 is configured to manipulate representations of graphical data. Techniques for such manipulations are now described.
Graphical data used in embodiments of the invention is vector data. Such data comprises, amongst other things, a plurality of vector positions in vector space, together with details defining the connectivity of those vector positions to define shapes which in turn define the graphical data. Such vector positions are routinely stored as floating point number tuples having as many elements as there are dimensions in the vector space to be represented. The use of floating point numbers in computing will be well-understood by one of ordinary skill in the art, being a common form for the storage of non-integer real numbers. While floating point numbers offer precision, their use can be disadvantageous in that they require relatively large storage space.
There is now described a technique which allows floating point data storage to be minimised, while at the same time allowing storage of graphical data with precision. This is described with reference to
For example, where a vector (3.45, 2.86, and −3.45) is included within the floating point data 11, the floating point table of values 12 will include:
3.45 2.86
The signed integer indices will then represent the vector by values of [1, 2 −1]. That is, the signed integer index ‘1’ identifies the first value in the floating point table of values 12 being 3.45. Given that 1 is positively signed, this indicates that the value should be read with no sign modification. The signed integer index ‘2’ identifies the second value in the floating point table of values 12 being 2.86. Again, given that ‘2’ is positively signed, the value is read with no sign modification. The signed integer index ‘−1’ also indentifies the first value in the floating point table of values. However given that this index is negatively signed, the value is read with sign inversion to give −3.45.
It can be seen from the preceding description that where a floating point value of particular magnitude occurs more than once within the floating point data 11 (be that within a single vector or multiple vectors) it need only be stored once, thereby reducing storage requirements. It will be appreciated that storing signed integer indices 13 is relatively space efficient as compared with storage of floating point values.
In the arrangement described above, an index of 0 is arranged to index a floating point value of 0 which need not be stored in the floating point table of values 12.
In addition to representing positions in vector space, floating point tuples of the type described above can be used to store colour data. Specifically, where a four-element tuple is used, three elements can be used to store colour channel data for red, green and blue channels and a fourth element can be used to store a transparency (or alpha) value. Such tuples can again be represented using the floating point table of values 12 in combination with the signed integer indices 13.
The process of reconstructing the floating point triples 11′ is now described with reference to an example illustrated in
The Floating point table 12 contains the values [1.5, 1, 0.5].
The signed integer indices 13 contains follows values [−1, 2, 0, 2, 2, 3, 2, 2, −3, −2, −2,0]
The signed integer indices are interpreted such that each three indices (reading from left to right) represent a single triple being a position in vector space. The signed integer indices 13 therefore represent four triples. The triples are separated in this way by dotted lines in
The preceding description has explained how the use of a floating point table of values and a set of signed integer indices allows floating point tuples to be stored in a space-efficient manner. It has been explained that such a representation can be used to represent points in vector space or to represent colour data. Indeed, it will be appreciated that any floating point values can be generally stored in the manner described above, there being an expected saving in the storage requirements where a floating point number of particular magnitude occurs more than once in the floating point values.
There is now described a file format which can be used to store data of the type described above—together with associated data—so as to represent graphical data.
Each of these components is now described in further detail with reference to
The first component which provides the value map 20 includes the table of floating point values 12 and the signed integer indices 13 which have been discussed above. The signed integer indices 13 are represented by three sets of vectors 26, respectively storing two, three and four dimensional vectors, 26a, 26b, 26c. Each set of vectors includes a plurality of signed integer values (one for each vector element) which index the table of floating point values in the manner described above. The two and three dimensional vectors 26a, 26b, are used to represent positions in vector space, while the four dimensional vectors 26c are used to represent colour in the manner outlined above.
The mesh data 21 may have one or more instances, each defining a mesh. Each instance has a name which takes the form of a string. The mesh data 21 also comprises vertex indices 27, each vertex index being an unsigned integer which refers to a three-dimensional vector in the value map 20. Triangle vertices 28 define how the vertices are joined together to define triangles. Each triangle vertex refers to one of the vertex indices 27 which in turn refers to a three-dimensional vector in the value map 20, as noted above.
The mesh data 21 further includes normal indices 29, one for each vertex referred to by the vertex indices 27. Each normal index refers to a three-dimensional vector in the value map 20. The normal indices are stored in an order corresponding to that of the vertex indices, thereby allowing vertices and their normals to be associated together. It will be appreciated that vertex normals are required to allow proper rendering of the mesh, and the use of normal vectors in graphical rendering will be known to those of ordinary skill in the art.
Finally, the mesh data 21 includes texture indices 30, each texture index referring to a two-dimensional vector in the value map 20. Each texture index applies to a respective one of the triangle indices, and the texture indices are stored in the same order as the triangle indices. Each two-dimensional vector is used to indicate a position within a planar texture which should be located coincident with the respective triangle vertex.
Moving now the material data 22, each instance has a name provided in the form of a string, a diffuse colour 31 which is provided as an integer referencing a four-dimensional vector in the four dimensional vectors 26c of the value map 20, a diffuse texture 32 which is provided as a reference to an instance of blob data 24 (described below), and a reflection colour 33 which is provided as an integer referencing a four-dimensional vector in the four dimensional vectors 26c of value map 20. It will be appreciated that not all instances of the material data 22 need have both texture and colour data.
The occurrence data 23 has instances which use the defined constructs to create objects. Each instance has a name which takes the form of a string, and a location which takes the form of an index identifying a three-dimensional vector stored in the value map 20. The location identifies a point in three-dimensional space at which the occurrence is located. A rotation again indentifies a three-dimensional vector which provides rotation information. Hierarchies of occurrences can be created, and child data defines such hierarchies. Such hierarchies can be used to define a complex object from component parts, where a root instance represents an object and the child objects define its component parts. In such a case, location and rotation data for child objects is specified relative to their parent object.
Each occurrence includes a mesh name and material name which are strings respectively referring to an instance of the mesh data and material data described above. A reference name takes the form of a string which identifies another occurrence instance, thereby allowing two instances of a particular graphical object to be defined, one referencing the other to allow common properties to be shared, but each occurrence to have its own position and location area.
In some embodiments, unnamed instances of some components may be created and used to provide a default where no instance of a particular component is specified. For example, where an occurrence instance fails to identify a mesh component instance by name, that occurrence instance may use data taken from an instance of mesh data having no name.
Blob data 24 is arranged to store byte strings of data. Each instance comprises name and type data (both strings) and a byte array representing the data.
Meta data 25 stores data relating to the graphical data in the form of name, value string pairs.
It will be appreciated that the various components set out above and the various data items included within those components may, in general terms, occur zero or more times within a particular example data file, depending upon the nature of the data to be represented.
An example of use of data such as that described above is now presented with reference to
Referring to
Referring to
Reference is made to
Similarly,
The data of
Referring now to
(x1,y1,z1):vector index:(x2, y2, z2)
Referring now to
Referring to
(u1,v1):vector index:(u2, v2)
In general terms, the application of a texture to a surface made up of triangles in the manner described above will be well known to those of ordinary skill in the art. Briefly, each two-dimensional vector identifies a point within the plane of the texture 40. The triangle vertex associated with that two-dimensional vector is located at that point within the plane of the texture 40. The surface is shown relative to the continuous texture in
It will be appreciated that the data of
Where the surface of
Various modifications can be made to the embodiments which have been described above.
For each instance of occurrence data, a bounding box may be defined (for example using a pair of maximum and minimum three-dimensional vectors). Such bounding boxes define the location of the occurrence in three-dimensional space before the processing of the occurrence is complete, thereby allowing an overall arrangement of occurrences within a scene to be determined prior to completion of rendering.
Additionally or alternatively, each occurrence may further comprise a pair of three dimensional vectors which are used during animation of a three-dimensional model. A first vector may indicate a direction of travel for the occurrence during the animation, while a second vector may indicate a direction of rotation along the direction of travel in which the occurrence is to rotate during the animation. These three dimensional vectors can be stored in the form described above using floating point data and referencing integers.
An alternative way of storing vector position data is now described with reference to
Integer slice data 103 defines an integer number of positions along the one-dimensional line 102, such that integer position data 104 can then identify a particular one of the slices (or positions). In this way, the only floating point data which must be stored is that used to define the bounds, the remaining data all being stored in integer form.
Specifically, where the bounds 101 define MinBound and MaxBound representing minimum and maximum bounds respectively by indexing appropriate floating point values; the number of slices is given by NumSlices, and the stored values are each represented by m, a floating point value based upon each stored integer position value m can be obtained using:
Value=MinBound+((MaxBound−MinBound)*m)/NumSlices)
It will be appreciated that storing data in this way provides some degree of quantization.
The method described with reference to
A simple one dimensional example is now presented.
In the example, the floating point data 100 stores a single value [1.0]. The bounds 101 store two signed integer values [−1, 1] thereby defining a range between −1.0 and 1.0.
The integer slice data 103 indicates that five slices are used.
Given values [−1, 1, 4, 2, 5], which make up the positions 104, these values can be converted into values within the bounded range −1 to 1 using:
value=−1+((1−(−1))*read_value)/5
Although various embodiments have been described above, it will be appreciated that these embodiments are for presented for the purposes of illustration only and are not intended to limit the scope of the claimed invention. It will be readily apparent to the skilled person that various modifications can be made to the described embodiments without departing from the spirit and scope of the present invention.
Number | Date | Country | Kind |
---|---|---|---|
1313292.3 | Jul 2013 | GB | national |
Filing Document | Filing Date | Country | Kind |
---|---|---|---|
PCT/EP2014/065547 | 7/18/2014 | WO | 00 |