tutorials:using-mesh-clouds-as-organ
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tutorials:using-mesh-clouds-as-organ [2024/11/04 11:37] – tim | tutorials:using-mesh-clouds-as-organ [2024/12/06 14:37] (current) – [Preparation] tim2 | ||
---|---|---|---|
Line 3: | Line 3: | ||
===== Idea ===== | ===== Idea ===== | ||
- | In this tutorial | + | This tutorial |
- | The leaf is added and transformed several times to simulate | + | The leaf is transformed |
+ | |{{ : | ||
+ | |The rendered result of the example branch | | ||
+ | The example model can be found in the GroIMP example explorer (File/ | ||
+ | |||
+ | ===== Preparation ===== | ||
+ | |||
+ | Before you start modeling with point clouds it is recommended to do two settings: | ||
+ | - On the view3d in the menu view/ | ||
+ | - In the preferences, | ||
===== Loading cloud ===== | ===== Loading cloud ===== | ||
- | Since the point cloud is an changeable asset in this model, we will use the GraphExplorer plugin to import it as a Graph Object. | + | In order to proper ship this project, |
- | To do so first open the Graph Objects | + | Therefore we first need to add the ply file to the [[user-guide: |
- | In the newly opened panel an external | + | select "All files" as type, to show files that can be edited in the text editor(see image). |
- | Afterwards the graph object | + | After load the ply file, it can now be loaded in RGG as an input Stream with the function |
+ | |||
<code java> | <code java> | ||
- | GraphObjectRef | + | Node x =Utils.loadNodeFromStream(getInputStreamFromProject("leaf.ply" |
[ | [ | ||
- | A ==> x.cloneGraph(); | + | A ==> x; |
] | ] | ||
</ | </ | ||
Line 43: | Line 54: | ||
</ | </ | ||
- | Even so this code moves the points to the right position, this is not enough for this tutorial. We need to move the connected meshes as well. To do so we use the structure of the imported CollectionCloud ([[groimp-platform: | + | Even so this code moves the points to the right position, this is not enough for this tutorial. We need to move the connected meshes as well. To do so we use the structure of the imported CollectionCloud ([[tutorials:pointcloud-io# |
<code java> | <code java> | ||
void redraw_Mesh()[ | void redraw_Mesh()[ | ||
Line 64: | Line 75: | ||
] | ] | ||
</ | </ | ||
+ | |||
+ | After these steps the point and mesh cloud should start at the location of the root node and can be easily transformed by turtle geometry. | ||
+ | |||
+ | ==== Manipulate the whole cloud ==== | ||
+ | |||
+ | The imported cloud will behave similar to other subset of the graph in GroIMP. | ||
+ | |||
+ | The rotation of a point cloud can be quite tricky depending on the the rotations in the measurement. A simple trick for the modelling is to add a '' | ||
+ | |||
+ | After the right rotation and scale is estimated, these values can be used on top of any turtle state. | ||
+ | Therefore a leaf can be added in different angles using the same rotation. In the given example the model starts with simple " | ||
+ | |||
+ | |||
+ | |||
+ | <code java> | ||
+ | protected void init () | ||
+ | [ | ||
+ | Axiom ==> | ||
+ | P(4)RU(70)F(2) //creating a brown branch rotate by 70 | ||
+ | [ P(2) M(-1.3)RL(80) M(0.05)Scale(10)Rotate(0, | ||
+ | [ P(2) M(-.6)RL(-80) M(0.05)Scale(10)Rotate(0, | ||
+ | ; | ||
+ | ] | ||
+ | |||
+ | public void loadPC() | ||
+ | { | ||
+ | // load ply graph from | ||
+ | Node x =Utils.loadNodeFromStream(getInputStreamFromProject(" | ||
+ | [ | ||
+ | r: | ||
+ | ] | ||
+ | | ||
+ | | ||
+ | [ | ||
+ | r: | ||
+ | r: | ||
+ | ] | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | |||
+ | |{{ : | ||
+ | |A branch with leaves, first with place holders and then with point clouds| | ||
===== Growth ===== | ===== Growth ===== | ||
- | - manipulation | + | Even so the growth described here is only increasing the width and height |
+ | |||
+ | To do this change, | ||
+ | <code java> | ||
+ | public void grow(){ | ||
+ | [ | ||
+ | p: | ||
+ | | ||
+ | | ||
+ | | ||
+ | } | ||
+ | ] | ||
+ | | ||
+ | | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | |{{ : | ||
+ | |The branch in 4 growth steps | | ||
===== Light ===== | ===== Light ===== | ||
- | - creating | + | Using any of the GroIMP raytracer it is possible to receive the amount of intercepted energy for each mesh. |
+ | This information can be used for detailed analysis or specific growth behavior. | ||
+ | In this example the absorbed power per area is used to set the RGBAShader of each mesh in order to create | ||
+ | |||
+ | <code java> | ||
+ | |||
+ | public void light(){ | ||
+ | | ||
+ | float max = max(flm.getAbsorbedPower3d((*mn: | ||
+ | | ||
+ | [ | ||
+ | mn: | ||
+ | float inp = flm.getAbsorbedPower3d(mn).getMax(); | ||
+ | inp= inp/ | ||
+ | // estimate RGB values | ||
+ | inp=2*inp/ | ||
+ | int r = (int)(255*(inp-1)); | ||
+ | r = (r> | ||
+ | int b = (int)(255*(1-inp)); | ||
+ | b = (b> | ||
+ | int g = 255-r-b; | ||
+ | // change shaders | ||
+ | mn.setShader(new RGBAShader(r, | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | In order to see the result of the scene needs to be rendered, since the 3d view is otherwise using the mesh collector. | ||
+ | |||
+ | |{{ : | ||
+ | |The rendered leaves with color coded meshes, from red (high) over green (medium) to red(low)| |
tutorials/using-mesh-clouds-as-organ.1730716628.txt.gz · Last modified: 2024/11/04 11:37 by tim