forked from LumaPictures/partio
-
Notifications
You must be signed in to change notification settings - Fork 1
/
README
133 lines (99 loc) · 4.58 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
===================================================================
Partio - A library for particle IO and manipulation
- Andrew Selle, Walt Disney Animation Studios
- John Cassella, RedpawFX & Luma Pictures
===================================================================
This is the initial source code release of partio a tool we used for particle
reading/writing. It started out as an abstraction for the commonalities in
particle models (i.e. accessing many attributes associated with an index or
entity).
Super impatient scons building guide
====================================
$ git clone https://github.com/wdas/partio.git
$ cd partio
$ scons -j 4
(dist/ will now have your build)
Getting Started
==============
I support both scons and cmake build files. I would rather not support
more. Lately I have been using cmake more, so that may be more up to
date, but others have contributed fixes from time to time.
Source code overview
====================
src/
lib/ Library code (public API in root)
lib/core Core library (KDtree traversal, data representations)
lib/io Input/Output (Different file formats)
py/ SWIG based python bindings
doc/ Doxygen documentation and (the start of) a manual
tests/ Start of regression tests (I need more)
tools/ Useful tools
partconv <input format> <output format>
partinfo <particle file>
partview <particle file>
contrib/
partio4Maya:
partio plugin for maya
containing 3 tools:
partioVisualizer - an openGL "locator" for viewing point clouds within the maya interface
partioEmitter - a standard maya emitter type capable of loading any cache format supported by partio
and emitting those particles into a standard maya particle/nParticle object
partioExport - a drop in replacement for the maya dynExport command that supports the same syntax but all of partIO's writable formats
(bonus) partioExportGui.mel a very smart wrapper Gui for exporting particles with user selection of attributes.
Class Model
-----------
The goal of the library is to abstract the particle interface from the data
representation. That is why Partio represents particles using three classes that
inherit and provide more functionality
ParticlesInfo - Information about # of particles and attributes
ParticlesData - Read only access to all particle data
ParticlesDataMutable - Read/write access to all particle data
The functions used to get particle access are these:
readHeaders()
returns ParticlesInfo
reads only the minimum data necessary to get number of particles and
attributes
readCached()
returns ParticlesData
For multiple users in different threads using the same particle file
ParticlesData
create() and read()
returns ParticlesDataMutable
allows read/write access
Behind the scenes you could implement these classes however you like. Headers
only representation is called core/ParticleHeader.{h,cpp}. Simple
non-interleaved attributes is core/ParticleSimple.{h,cpp}.
Attribute Data Model
--------------------
All particles have the same data attributes. They have the model that they are
of three basic types with a count of how many scalar values they have.
VECTOR[3]
FLOAT[d]
INT[d]
VECTOR[3] and FLOAT[3] have the same data representations.
VECTOR[4] is invalid however FLOAT[4] is valid as is FLOAT[1...infinity]
This seems to encompass the most common file formats for particles
Iterating
---------
There are multiple ways to access data in the API. Here are
some tips
- Use SIMD functions when possible prefer dataAsFloat(),data(arrayOfIndices) as
opposed to data(int singleIndex) which accesses multiple pieces of data at
once
- Cache ParticleAttributes for quick access instead of calling attributeInfo()
over a loop of particles
- Use iterators to do linear operations over all particles They are much more
optimized than both data() and the dataAsFloat or
Backends
--------
Behind the scenes there are SimpleParticles, ParticleHeaders, and
SimpleParticlesInterleaved. In the future I would like to write a disk-based
cached back end that can dynamically only load the data that is necessary.
create(), read() and readCached could be augmented to create different
structures in these cases.
Readers/Writers
---------------
New readers and writers can be added in the io/ directory. You simply need to
implement the interface ParticlesInfo, ParticlesData and ParticlesDataMutable
(or as many as you need). Editing the io/readers.h to add prototypes and
io/ParticleIO.cpp to add file extension bindings should be easy.