- Creating common 3D shapes using 3D pen
To let users stamp common 3D shapes, the following codelets (blocks) are added in the "Pen" palette.
Here are some example shapes created from the above codelets:
A "knot" codelet is intended to be used for a 3D version of the knitting application
(http://community.csdt.rpi.edu/projects/38/). For the detailed parameter usage of the knit codelet, please refer to this interactive example (http://www.smartjava.org/ltjs/chapter-05/08-basic-3d-geometries-torus-knot.html).
Currently, stampled shapes take over the following properties from a 3D sprite (in above example, a bird): color, position, rotation, scale, and texture. Thus, if you want to change those properties for shapes created from 3D pen, first you can apply 3D operations to the 3D sprite and then stamp any shapes you want.
Using the arc codelet, we can develop a VirtualWigwam application as follows:
Hereby we achieved the goal we set in the beginning of the summer!
- 3D shape display control for speed up the rendering
In the current design, the rendering process gets increasingly slow, when you add
more 3D shapes. For
example, when we want to display N arcs created by 3D pen,
rendering steps go like the following:
- 1st step: rendering 1st arc
- 2nd step: rendering 1st and 2nd arcs
- 3rd step: rendering 1st, 2nd, and 3rd arcs
....
- Nth step: rendering 1st, 2nd, ..., and Nth arcs
Thus, it costs you N*(N+1)/2 times of rendering the arc. This is unavoidable because if we change anything in the 3D space
and make it visible, we need to request Three.js to update the
entire canvas for 3D. Three.js might be doing something
intelligent to avoid rendering the same objects over and over
again, but at least the above sequence is what we request from the
application's perspective.
Having said that, if we do not need to display intermediate results from the 1st -
N-1th renderings, we can just skip these steps and display the Nth result only.
Based on that idea, I have implemented a "hide pen" and a
"show pen" codelets, which stops and resumes rendering 3D shapes
by 3D pen.
Using these codelets just as the following, the system just
renders arcs N times, not N*(N+1)/2 times.
hide pen
repeat N
arc width: 100 height: 100
show pen
- Switching codelets depending on if the sprite is 2D or 3D
There are codelets that are applicable only for 2D, or 3D. So depending on the status of the sprite (i.e., 2D or 3D), showing codelets that work for the selected sprite makes sense. For example, when a 2D sprite is selected, the "pen" palette shows the following codelets:
On the other hand, when a 3D sprite is selected the same palette looks as follows:
My summer job ends on August 1st. For the rest of the week, I will work on a document that describes the implementation of the 3D system for C-Snap.
I have been really enjoying this project and am reasonably happy for the achievements I made including the VirtualWigwam.
Hope someone takes over my work and further enhances this project!