Articles on m-agour's Bloghttps://blogs.python-gsoc.orgUpdates on different articles published on m-agour's BlogenMon, 26 Sep 2022 19:28:46 +0000Week 14: Introducing standalone Animationshttps://blogs.python-gsoc.org/en/m-agours-blog/week-14-introducing-standalone-animations/<h1>What did you do this week?</h1> <p>PLACEHOLDER</p> <h1>What is coming up next week?</h1> <p>PLACEHOLDER</p> <h1>Did you get stuck anywhere?</h1> <p>PLACEHOLDER</p> <p> </p>mo.aggour@gmail.com (m-agour)Mon, 26 Sep 2022 19:28:46 +0000https://blogs.python-gsoc.org/en/m-agours-blog/week-14-introducing-standalone-animations/Week 13: Keyframes animation is now a bit easier in FURYhttps://blogs.python-gsoc.org/en/m-agours-blog/week-13-keyframes-animation-is-now-a-bit-easier-in-fury/<h2>What did you do this week?</h2> <ul> <li> <p>Added the ability to have the ShowManager stored inside the Timeline. That way the user does not have to update and render the animations because it will be done internally.</p> </li> <li> <p>Added a record method to the Timeline that records the animation and saves it as either GIF or MP4 (requires OpenCV). This record functionality has the option to show/hide the PlaybackPanel which makes it better than recording the animation using a third-party software.</p> </li> <li> <p>Fixed some issues that Serge mentioned while reviewing PR #<a href="https://github.com/fury-gl/fury/pull/665">665</a></p> </li> </ul> <h2>What is coming up next week?</h2> <ul> <li>Instead of adding the ShowManager to the Timeline, doing it the other way around is a better choice and makes the code more readable.</li> <li>Add tests for the Timeline's record method.</li> <li>Add tests for the billboard actor to test consistency among different approaches..</li> </ul> <h2>Did you get stuck anywhere?</h2> <p>I didn't get stuck this week.</p>mo.aggour@gmail.com (m-agour)Tue, 20 Sep 2022 05:50:08 +0000https://blogs.python-gsoc.org/en/m-agours-blog/week-13-keyframes-animation-is-now-a-bit-easier-in-fury/Week 12: Adding new tutorialshttps://blogs.python-gsoc.org/en/m-agours-blog/week-12-adding-new-tutorials/<h1>What did you do this week?</h1> <ul> <li>Restructured tutorials to be more readable and more focused on a specific topic.</li> <li>Replaced the old animation introductory tutorial with a lot simpler one. And added tutorial to explain keyframes and interpolators.</li> <li>Simplified setting lighting uniforms for the geometry-based-billboard actor by getting the <code>Scene</code> from the actor using <code>actor.GetConsumer(scene_idx)</code>.</li> </ul> <p> </p> <h2>What is coming up next week?</h2> <ul> <li>Allow the <code>Timeline</code> to take the <code>ShowManager</code> as an argument to reduce the amount of code user has to write every time using FURY animations.'</li> <li>Fix some typos in the tutorials and write some info about <code>Slerp</code>.</li> <li>Find a way to fix the shader-callback problem of not being executed when the actor is out of the camera's frustum.</li> </ul> <p> </p> <h2>Did you get stuck anywhere?</h2> <p>I didn't get stuck this week.</p>mo.aggour@gmail.com (m-agour)Tue, 13 Sep 2022 05:52:06 +0000https://blogs.python-gsoc.org/en/m-agours-blog/week-12-adding-new-tutorials/Week 11: Improving tutorials a littlehttps://blogs.python-gsoc.org/en/m-agours-blog/week-11-improving-tutorials-a-little/<h1>What did you do this week?</h1> <ul> <li> <p>Fixed some issues in the hierarchical order animation support <a href="https://github.com/fury-gl/fury/pull/665">PR</a> that we discussed during last week’s meeting (mostly naming issues).</p> </li> <li> <p>Explained the introductory tutorial a little. But it is not good suitable beginners. So, I will spend time improving tutorials this week.</p> </li> <li> <p>Added extrusion to <a href="https://github.com/fury-gl/fury/pull/661">vector_text</a> to allow the z-scaling to be functional.</p> </li> <li> <p>Fixed <code>lightColor0</code> being <a href="https://github.com/fury-gl/fury/blob/464b3dd3f5be5159f5f9617a2c7b6f7bd65c0c80/fury/actor.py#L2395">hard-set</a> to <code>(1, 1, 1)</code>. Instead, it’s now using the <code>Scene</code> to set the lighting uniforms.</p> </li> </ul> <h2> </h2> <h2>What is coming up next week?</h2> <ul> <li> <p>Improve tutorials.</p> </li> <li> <p>Find out how to get the <code>Scene</code> from the actor instead of manually assigning it.</p> </li> <li> <p>If I have time, I will try implement recording animation as GIF or as a video.</p> </li> </ul> <h2> </h2> <h2>Did you get stuck anywhere?</h2> <p>I didn’t get stuck this week.</p>mo.aggour@gmail.com (m-agour)Mon, 05 Sep 2022 09:25:43 +0000https://blogs.python-gsoc.org/en/m-agours-blog/week-11-improving-tutorials-a-little/Week 10: Supporting hierarchical animationshttps://blogs.python-gsoc.org/en/m-agours-blog/week-10-supporting-hierarchical-animations/<h2>What did you do this week?</h2> <ul> <li> <p>Implemented hierarchical order support for animations using matrices in this <a href="https://github.com/fury-gl/fury/pull/665">PR</a>.</p> </li> <li> <p>Improved the API of a <a href="https://github.com/fury-gl/fury/pull/660">PartialActor</a> by adding some methods to control the scales, positions and colors.</p> </li> <li> <p>Added a new example of using the new hierarchical feature to animate an arm robot.</p> </li> <li> <p>Improved <a href="https://github.com/fury-gl/fury/pull/661">vector_text</a> a little by adding options to control its direction.</p> </li> </ul> <h2>What is coming up next week?</h2> <ul> <li>Finish the hierarchical order animation support <a href="https://github.com/fury-gl/fury/pull/665">PR</a>.</li> <li>Explain tutorials in more detail. See this <a href="https://github.com/fury-gl/fury/issues/664">issue</a>.</li> <li>Fix issues discovered by Serge in this <a href="https://github.com/fury-gl/fury/pull/647#pullrequestreview-1061261078">review</a>.</li> <li>Fix <code>lightColor0</code> being <a href="https://github.com/fury-gl/fury/blob/464b3dd3f5be5159f5f9617a2c7b6f7bd65c0c80/fury/actor.py#L2395">hard-set</a> to <code>(1, 1, 1)</code>. Instead, find a way to get this property the same way other polygon-based actor gets it.</li> <li>Try to get PRs and issues mentioned above merged, closed or ready for a final review.</li> </ul> <h2>Did you get stuck anywhere?</h2> <p>I didn't get stuck this week.</p>mo.aggour@gmail.com (m-agour)Mon, 29 Aug 2022 13:59:29 +0000https://blogs.python-gsoc.org/en/m-agours-blog/week-10-supporting-hierarchical-animations/Week 9: Animating primitives of the same actorhttps://blogs.python-gsoc.org/en/m-agours-blog/week-9-animating-primitives-of-the-same-actor/<h1>What did you do this week?</h1> <ul> <li> <p>Made two tutorials that show two approaches on how to animate primitives of the same FURY actor using the <code>Timeline</code>.<br>  </p> </li> <li> <p>Tried sending all keyframes at once as uniforms, but I faced a performance issue doing this.</p> </li> <li> <p>Set uniforms that are not being sent by VTK for the billboard actor.</p> </li> </ul> <p> </p> <h1>What is coming up next week?</h1> <ul> <li> <p>Alter the <code>Timeline</code> to use matrices instead of setting values directly to allow hierarchical transformation.</p> </li> <li> <p>Improve the API of the <code>PartialActor</code> to act almost like a normal actor.</p> </li> </ul> <h1><iframe height="360" src="https://www.youtube.com/embed/VVgF3OeZB5I" width="640"></iframe></h1> <h1>Did you get stuck anywhere?</h1> <p>I had some issues but didn’t get stuck.</p>mo.aggour@gmail.com (m-agour)Thu, 25 Aug 2022 05:58:03 +0000https://blogs.python-gsoc.org/en/m-agours-blog/week-9-animating-primitives-of-the-same-actor/Week 8: Back to the shader-based version of the Timelinehttps://blogs.python-gsoc.org/en/m-agours-blog/week-8-back-to-the-shader-based-version-of-the-timeline/<h1>What did you do this week?</h1> <ul> <li> <p>First, I made some modifications to the main animation PR. Then as Filipi requested, I integrated the vertex shader That I was implementing a few weeks ago to work with the new improved version of the <code>Timeline</code>.</p> </li> <li> <p>As for how keyframes are sent to the GPU, the method being used is to send the needed keyframes for each draw. This is heavy because we only roll out the interpolation part, which with linear or step interpolation won’t make any difference! Instead, I tested hard-setting all the keyframes as a constant variable by manipulating the shader program’s string. This also was slow to initialize, and the shader was getting bigger and slower to bind and unbind. to solve this problem, I made a uniform that holds all the keyframes of the animation and sent data as vectors with was faster than string manipulation, also it was faster to render since data are now stored directly in memory and the shader program was a lot more compact. But this method had an issue; uniforms do not keep data stored as expected! If two or more actors have the same uniform name in their shader program. And only one of them was set, the other actor will get this value as well. A way around this is to change the names of the uniforms so that they maintain their data.</p> </li> <li> <p>Tested animating 200K billboard spheres animation but this time using translation as well. And they performed very well.<br> <iframe height="360" src="https://www.youtube.com/embed/SL7Mw1LyZ7Q" width="640"></iframe></p> </li> </ul> <h1>What is coming up next week?</h1> <ul> <li> <p>Fix issues I encountered this week working with GLSL shades.</p> </li> <li> <p>Implement slerp in GLSL as well as figure out a way to optimize sending keyframes to the shader program.</p> </li> <li> <p>Figure a way to animate primitives of the same actor by different timelines.</p> </li> </ul> <h1>Did you get stuck anywhere?</h1> <p>I had two issues, one mentioned above which was uniforms not being abler to hold data. The second one is that VTK does not send specular-related uniforms and <code>lightColor0</code> to the <code>dot</code> primitive, which are needed for light calculations.</p>mo.aggour@gmail.com (m-agour)Mon, 15 Aug 2022 10:30:35 +0000https://blogs.python-gsoc.org/en/m-agours-blog/week-8-back-to-the-shader-based-version-of-the-timeline/Week 7: Billboard spheres and implementing interpolators using closureshttps://blogs.python-gsoc.org/en/m-agours-blog/week-7-billboard-spheres-and-implementing-interpolators-using-closures/<h1>What did you do this week?</h1> <ul> <li> <p>Restructured the keyframe animation interpolators using closures to be functions instead of classes <a href="https://github.com/fury-gl/fury/pull/647">#647</a>. Now it is easier to implement new interpolators with the help of the functions existing in <a href="https://github.com/fury-gl/fury/blob/670d3a41645eb7bcd445a7d8ae9ddd7bebc376b7/fury/animation/helpers.py">fury/animation/helpers.py</a>. Also, now unit tests can be added for the latter functions.</p> </li> <li> <p>Added two examples explaining how to implement a custom interpolator that can be used by the <code>Timeline</code>, one using <a href="https://github.com/fury-gl/fury/blob/e0539269adc2a51e35282f83b8b0672bbe047a39/docs/tutorials/05_animation/viz_keyframe_custom_interpolator.py">classes</a> and the other using <a href="https://github.com/fury-gl/fury/blob/670d3a41645eb7bcd445a7d8ae9ddd7bebc376b7/docs/tutorials/05_animation/viz_keyframe_custom_interpolator.py">closures</a>.</p> </li> <li> <p>Fixed rotation issue that Shivam discovered while using the <code>Timeline</code> to animate glTF models. So, rotation in VTK is done by rotating first around Z-axis, then X-axis, then finally around Y-axis, which was not the order I was using to convert from quaternions to Euler degrees.</p> </li> <li> <p>Made changes requested by Javier and Filibi on the billboards using geometry shader <a href="https://github.com/fury-gl/fury/pull/631">PR</a>, and made an example of how to use this billboard to show an impostor sphere which looks almost like a real high poly sphere. Also benchmarked using this version of billboard vs using a quad-based billboard, and how they both affect the FPS of the animation.<br> <iframe height="360" src="https://www.youtube.com/embed/JFB6gELSMLA" width="640"></iframe><br>  </p> </li> </ul> <h2>What is coming up next week?</h2> <ul> <li> <p>Document the new closure-based interpolators. And make some slight renaming changes that we discussed in today’s meeting.</p> </li> <li> <p>Add tests to the functions inside <a href="https://github.com/fury-gl/fury/blob/670d3a41645eb7bcd445a7d8ae9ddd7bebc376b7/fury/animation/helpers.py">fury/animation/helpers.py</a>.</p> </li> <li> <p>Make changes to the geometry-shader-based billboard to make it more like the quad-based billboard actor while maintaining the new features.</p> </li> <li> <p>Integrate the already-implemented shader functionality to the new <code>Timeline</code> in a separate draft or PR.</p> </li> </ul> <h2>Did you get stuck anywhere?</h2> <p>I got stuck trying to get and modify the vertices (centers) of the billboard actor.</p>mo.aggour@gmail.com (m-agour)Thu, 04 Aug 2022 19:04:35 +0000https://blogs.python-gsoc.org/en/m-agours-blog/week-7-billboard-spheres-and-implementing-interpolators-using-closures/Week 6: Fixing the Timeline issues and equipping it with more featureshttps://blogs.python-gsoc.org/en/m-agours-blog/week-6-fixing-the-timeline-issues-and-equipping-it-with-more-features/<h2>What did you do this week?</h2> <ul> <li> <p>Improved the <em><code>PlaybackPanel</code> </em>by adding speed control and the ability to loop the animation. Also, fixed the lagging issue of play and pause buttons and composed them into a single play/pause button.</p> </li> <li> <p>Updated the old tutorials’ syntax to match the other tutorials and added a new tutorial on position animation using spline interpolation. Added unit tests for the <em><code>PlaybackPanel</code> </em>and the newly added color converters in<em> <code>colormap.py</code>.</em></p> </li> <li> <p>Added more hooks to the 2D sliders to cover two more states:</p> <ol> <li> <p><em><code>on_value_changed</code></em>, which gets called whenever the value of the slider is changed without interacting with the slider.</p> </li> <li> <p><em><code>on_moving_slider</code></em>, which gets called when the position of the slider is changed by user interaction. <a href="https://github.com/fury-gl/fury/pull/634">#634</a>.</p> </li> </ol> <ul> <li> <p>The reason for adding these two hooks is that there was only the <em><code>on_change</code> </em>hook, which always gets called when the value of the slider is changed without considering how the value is changed, hence, the functionality of the slider was limited.</p> </li> </ul> </li> <li> <p>Provided the ability to add static actors to the <code>Timeline</code>, which might be needed in the animation part of Shivam’s glTF project <a href="https://github.com/fury-gl/fury/pull/634">#643</a>.</p> <ul> <li> <p>If an <code>actor</code> is added to the <code>Timeline</code> as a static actor, it won’t be animated by the <code>Timeline</code>, but it will get added to the scene along with the <code>Timeline</code>.</p> </li> </ul> </li> <li> <p>Implemented a custom evaluator for the <code>Timeline</code>’s properties.</p> <ul> <li> <p>A custom evaluator uses a user-provided function that takes time as input and evaluates the property at that time. This feature is yet to be discussed more in today’s meeting.</p> </li> </ul> </li> <li> <p>Fixed camera rotation and the view-up issue when interacting with the scene.</p> </li> </ul> <h2>What is coming up next week?</h2> <ul> <li> <p>Make a tutorial on how to implement a new custom Interpolator to work with the <code>Timeline</code>.</p> </li> <li> <p>Add motion path visualization feature for both position and color properties.</p> </li> <li> <p>Add custom evaluation functions directly, without using the <em><code>CustomInterpolator</code></em>.</p> </li> <li> <p>Implement an already existing complex interpolator using closures instead of classes.</p> </li> </ul> <h2>Did you get stuck anywhere?</h2> <p>I didn’t get stuck this week.</p>mo.aggour@gmail.com (m-agour)Sat, 30 Jul 2022 18:19:06 +0000https://blogs.python-gsoc.org/en/m-agours-blog/week-6-fixing-the-timeline-issues-and-equipping-it-with-more-features/Week 5: Slerp implementation, documenting the Timeline, and adding unit testshttps://blogs.python-gsoc.org/en/m-agours-blog/week-5-slerp-implementation-documenting-the-timeline-and-adding-unit-tests/<h1>What did you do this week?</h1> <ul> <li> <p>Implemented Slerp (spherical linear interpolation) for rotation keyframes.</p> </li> <li> <p>Controlling the speed of the animation is now an option.</p> </li> <li> <p>Added the tests and documented the <code>Timeline</code>.</p> </li> <li> <p>Used the geometry shader to generate billboard actors using minimal set of calculations <a href="https://github.com/fury-gl/fury/pull/631">#631</a>.<br> <br> <iframe height="360" src="https://www.youtube.com/embed/kc4qICo_GFQ" width="640"></iframe><br>  </p> </li> </ul> <h2>What is coming up next week?</h2> <p>This week I will do the following:</p> <ul> <li> <p>Focus on finalizing the PR <a href="https://github.com/fury-gl/fury/pull/626">#626</a> to be merged.</p> </li> <li> <p>Make some upgrades to the playback panel to make it more functional and responsive.<br>  </p> </li> </ul> <h2>Did you get stuck anywhere?</h2> <p>I didn’t get stuck this week.</p>mo.aggour@gmail.com (m-agour)Wed, 20 Jul 2022 09:38:16 +0000https://blogs.python-gsoc.org/en/m-agours-blog/week-5-slerp-implementation-documenting-the-timeline-and-adding-unit-tests/Week 4: Camera animation, interpolation in GLSL, and a single Timeline!https://blogs.python-gsoc.org/en/m-agours-blog/week-4-camera-animation-interpolation-in-glsl-and-a-single-timeline/<h2>What did you do this week?</h2> <ul> <li> <p>Managed to implement a single <code>Timeline</code> using the <code>Container</code> class. So, instead of having two classes: <code>Timeline</code> and <code>CompositeTimeline</code>, now the <code>Timeline</code> can have multiple <code>Timeline</code> objects and controls them as in the code below<br>  </p> <pre><code class="language-python">main_timeline = Timeline() sub_timeline = Timeline(actors_list) main_timeline.add_timeline(sub_timeline)</code></pre> <p> </p> </li> <li> <p>Implemented the HSV, Lab, and XYZ color interpolators in GLSL.</p> </li> <li> <p>Added support for animating two camera properties: position and focal position, which can be interpolated using any general <code>Interpolator</code>.<br> <iframe height="360" src="https://www.youtube.com/embed/SGI5QLytAd4" width="640"></iframe></p> </li> <li> <p>Allowed all <code>actors</code> inside all timelines to be added to the <code>Scene</code> automatically when the main (parent) <code>Timeline</code> is added to the <code>Scene</code>.</p> </li> <li> <p>Fixed the <code>PlaybackPanel</code>, added a counter to display the animation time as in the video above, and added an option to attach a <code>PlaybackPanel</code> to the <code>Timeline</code>.<br>  </p> <pre><code class="language-python">main_timeline = Timeline(playback_panel=True)</code></pre> <p> </p> </li> </ul> <h2>What is coming up next week?</h2> <p>This week I will do the following:</p> <ul> <li> <p>Start Implementing slerp interpolation using quaternions in both Python and GLSL. And use slerp to apply camera rotation.</p> </li> <li> <p>Add tests for the previous work.</p> </li> <li> <p>Make a PR to merge the non-shader-based version of the <code>Timeline</code>.</p> </li> <li> <p>Test how shader attributes can be used to hold keyframes for each vertex and benchmark it.</p> </li> <li> <p>Study ‘colormaps’ and implement some ‘colormaps’ in GLSL.<br>  </p> </li> </ul> <h2>Did you get stuck anywhere?</h2> <ul> <li> <p>Uniforms don’t maintain their data after shaders are unbounded and another uniform with the same name in a different shader is set.</p> </li> </ul>mo.aggour@gmail.com (m-agour)Sat, 16 Jul 2022 08:35:59 +0000https://blogs.python-gsoc.org/en/m-agours-blog/week-4-camera-animation-interpolation-in-glsl-and-a-single-timeline/Week 3: Redesigning the API, Implementing cubic Bezier Interpolator, and making progress on the GPU side!https://blogs.python-gsoc.org/en/m-agours-blog/week-3-redesigning-the-api-implementing-cubic-bezier-interpolator-and-making-progress-on-the-gpu-side/<h2>What did you do this week?</h2> <ul> <li> <p>Redesigned the keyframe animations API to optimize having a lot of timelines by composing them into a parent <code>Timeline</code> called <code>CompositeTimeline</code> while maintaining playing individual timelines separately.</p> </li> <li> <p>Implemented the cubic Bezier Interpolator using two control points for each keyframe. Also made a tutorial for it below:</p> <iframe height="360" src="https://www.youtube.com/embed/rUd5FqE_1MA" width="640"></iframe></li> <li> <p>Also Implemented linear and cubic Bezier in GLSL interpolations to be computed by the GPU by sending two keyframes as uniforms and the current animation time.</p> </li> <li> <p>Composed the playback panel as a single component <code>PlaybackPanel</code> (slider does not function yet).</p> </li> <li> <p>As we tried to come up with a way to do keyframe animations on a partial subset of the actor’s primitives not all of them, we found that there is no currently implemented way to get the primitives count of a single actor. So I made this PR <a href="https://github.com/fury-gl/fury/pull/617">#617</a> so that the primitives’ count is saved inside the polydata of the actor as suggested by Filipi and Javier so that the primitives’ count can be used to distinguish the vertices of different primitives.</p> </li> </ul> <h2>What is coming up next week?</h2> <p>This week I will do the following</p> <ul> <li> <p>Finish up the <code>PlaybackPanel</code>.</p> </li> <li> <p>Implement all other interpolators in GLSL (color interpolators included).</p> </li> <li> <p>Start Implementing slerp interpolation using quaternions in both Python and GLSL.</p> </li> <li> <p>Add tests for the previous work.</p> </li> <li> <p>Now that I made some progress with the keyframe animation API, I should be able to make a mergeable PR!</p> </li> </ul> <h2>Did you get stuck anywhere?</h2> <ul> <li> <p>Couldn’t get the <code>LineSlider2D</code> to work inside my new <code>PlaybackPanel</code>.</p> </li> </ul>mo.aggour@gmail.com (m-agour)Thu, 14 Jul 2022 16:05:24 +0000https://blogs.python-gsoc.org/en/m-agours-blog/week-3-redesigning-the-api-implementing-cubic-bezier-interpolator-and-making-progress-on-the-gpu-side/Week 2: Implementing non-linear and color interpolatorshttps://blogs.python-gsoc.org/en/m-agours-blog/week-2-implementing-non-linear-and-color-interpolators/<h1>What did you do this week?</h1> <ul> <li> <p>Implemented some other general interpolators such as n-degree spline and cubic spline interpolators. Also implemented HSV and LAB color interpolators.</p> <blockquote> <p>PRs <a href="https://github.com/fury-gl/fury/pull/612">#612</a> and <a href="https://github.com/fury-gl/fury/pull/613">#613</a></p> </blockquote> <iframe height="360" src="https://www.youtube.com/embed/qAcIbhcH3W0" width="640"></iframe><iframe height="360" src="https://www.youtube.com/embed/M7A1JYODYGc" width="640"></iframe></li> <li> <p>Added animation slider to seek a particular time and visualize the timeline in real-time.</p> <iframe height="360" src="https://www.youtube.com/embed/R9OPlgbI5ok" width="640"></iframe></li> <li> <p>Managed to do the transformation on the GPU side using GLSL using matrices. And did some digging about how and when we interpolate the camera and also how to do this on the GPU side.</p> </li> </ul> <h2>What is coming up next week?</h2> <p>This week I will do the following</p> <ul> <li> <p>Allow FURY actors to maintain the number of primitives as an object property so that it can be used to manipulate only a subset of primitives in a single actor.</p> </li> <li> <p>Change the structure of the Animation API to a newer one designed by Filipi to solve performance issues when creating a large number of timelines.</p> </li> <li> <p>Implement the Bézier curve interpolation.</p> </li> </ul> <h2>Did you get stuck anywhere?</h2> <p>I got stuck trying to fix the clipping plans not being appropriately set. Which caused actors to disappear at some point.</p> mo.aggour@gmail.com (m-agour)Mon, 04 Jul 2022 20:17:09 +0000https://blogs.python-gsoc.org/en/m-agours-blog/week-2-implementing-non-linear-and-color-interpolators/Week 1: Implementing a basic Keyframe animation APIhttps://blogs.python-gsoc.org/en/m-agours-blog/week-1-implementing-a-basic-keyframe-animation-api/<nav> <h2>What did you do during the Community Bonding Period?</h2> <p>During the community bonding period, we had weekly meetings in which I got to know the mentors better and bonded with Shivam and Praneeth, my fellow contributors. We talked about the importance of open-source contributions and discussed scientific visualization, how important it is, and how it differs from game engines despite having some similarities. We also discussed how important the code review is and how to do a proper code review.</p> <h2>What did you do this week?</h2> <p>I continued implementing the Timeline class. Added some functionalities according to what we discussed in the weekly meeting, such as handling Fury Actors, adding, removing, translating, and scaling them according to the keyframes. Then made two tutorials for it with simple UI to control the playback of the animation.</p> <iframe height="360" src="https://www.youtube.com/embed/Ia1Qe1EU0-g" width="640"></iframe> <p>Reviewed Bruno’s PR <a class="reference external" href="https://github.com/fury-gl/fury/pull/424">#424</a> as Filip advised to help me figure out how to change uniforms’ values during runtime. I found it straightforward. I also found a similar method already used in some tutorials and experiments to set the time uniform, which is based on the same idea. They both are using shaders callback functions. Going through the VTk’s documentation, I found a more efficient way to do this. It’s newly implemented in VTK 9, does not require callbacks, and is easy to use on individual actors. I had to verify first that Fury does not support an older version of VTK and it does not. I tested it and ran into some issues As Filip instructed I don’t waste a lot of time with uniforms so I postponed it for the next week.</p> <p>Also, when I was attending Shivam’s meeting, he showed us a smooth glTF model which differed from the last time I saw it. When I asked him he said he applied the normal. Him saying that reminded me of how we can use normals to smooth shade shapes. I applied this trick to the sphere actor in this PR <a class="reference external" href="https://github.com/fury-gl/fury/pull/604">#604</a> and worked as expected.</p> <h2>What is coming up next week?</h2> <p>If the implemented timeline is good to go, I will write the associated tests, finish up any missing methods, and document it properly. I will probably continue implementing the other interpolation methods as well.</p> <h2>Did you get stuck anywhere?</h2> <p>I got stuck changing the color of some actors.</p> </nav> <div class="bd-content col-12 col-md-9 col-xl-7"> <article class="bd-article"> </article> </div>mo.aggour@gmail.com (m-agour)Wed, 29 Jun 2022 16:24:09 +0000https://blogs.python-gsoc.org/en/m-agours-blog/week-1-implementing-a-basic-keyframe-animation-api/My journey till getting accepted into GSoC22https://blogs.python-gsoc.org/en/m-agours-blog/my-journey-till-getting-accepted-into-gsoc22/<article class="bd-article"> <h1>A Little About Myself</h1> <p>My name is Mohamed and I’m from Egypt. I am pursuing a Bachelor of Engineering in Computer Engineering and Automatic Control (expected: 2023), Tanta University, Egypt.</p> <p>I’ve been around computers since 2008 when I had my first PC with 128MB RAM and ran on Windows XP (that’s almost all I could remember about it).</p> <p>Around 2013, I had some questions about how games are made and how to make them myself! There was no one to answer these questions for me.</p> <p>My english wasn’t any good and the game development arabic community was very hard to find on the internet. But eventually, I came across a forum with some people speaking about some stuff such as game engines, 3D models, textures, animations, and a lot of fun stuff. That made sense back then and answered some of my questions. Then It was time to get involved with this amazing community. I was lucky enough to start with 3ds Max 2009 Edition, with that little view cube begging me to touch it. It was just love at first sight.</p> <p>I learned enough to model a basic house with no interior or a low poly human face.</p> <p>I was very curious about these game engines. Back then, the top three game engines available for the public were <a class="reference external" href="https://www.cryengine.com/">CryEngine 3</a>, <a class="reference external" href="https://en.wikipedia.org/wiki/Unreal_Engine#Unreal_Development_Kit">UDK</a>, and <a class="reference external" href="https://en.wikipedia.org/wiki/Unity_%28game_engine%29#Unity_3.0_%282010%29">Unity</a>.</p> <p>I was advised to use CryEngine 3 since it required no coding experience to use it. I started designing and texturing terrains and adding 3D models (I remember adding a pyramid and had a hard time scaling it down).</p> <h2>My first coding experience</h2> <p>It started with C programming language, which I came across while taking Harvard’s CS50. I then used it in competitive programming as my primary language.</p> <p>When I heard about OpenGL API for the first time from a senior and that it is being used to develop game engines, I started learning it along with GLSL.</p> <p>And it finally hit me: It is all math!</p> <p>I then started practicing pipelines, lighting models such as Blinn and Blinn-Phong models, cameras, texturing, fog, skybox, shadows, etc…</p> <h2>Developing a 3D game</h2> <p>In the Graphics course, OpenGL was being taught to us using python and there was a course project!</p> <p>I started preparing my notes and the shaders I wrote during that summer, only for the Professor to restrict us to use OpenGL v1.0 and only use PyOpenGL and Pygame.</p> <p>So, no Numpy, no PyGLM, fixed pipelines, no custom shaders, and each vertex had to be sent individually to the GPU.</p> <p>At first, I got disappointed, but while developing the game, I had a lot of optimization challenges that made me have fun figuring out how to still make the 3D game I’ve always wanted to make!</p> <p>I searched on GitHub for similar projects to the one I’m trying to make and did not find any 3D FPS game using this version of OpenGL (at least not listed publicly).</p> <p>I ended up implementing almost everything from scratch.</p> <p>Real-world physics inspired the physics of the game. This means that I have collected data about walking speed, running speed, initial jumping velocity, and gravity. Even the sound Sound intensity is inversely proportional to the square of the distance between the source and the player.</p> <p>I used Interpolation (bilinear interpolation) to interpolate the terrain’s height (y) at any given (x-z) coordinates so that entities can move on 64*64 pixels height map based terrain smoothly to reduce the number of triangles. I also implemented for this game an animation system that used obj sequence animations, then optimized it to load faster, and consume 95% less disk space compared to the non-optimized form.</p> <p>Source code of the game: <a class="reference external" href="https://github.com/m-agour/MummyIsland">MummyIsland</a></p> <p> </p> <h2>My journey to GSoC22</h2> <p>I first knew about GSoC from a friend last year. I then went through the organization’s list. There were a lot of familiar names that I recognized such as Anki, Godot, Blender.</p> <p>Then I glanced at the Python software foundation. I had to go in and scroll through the sub-organizations only to come across FURY. The luminous horse got my attention. I felt the connection right away.</p> <p>I went through the docs of both FURY and VTK.</p> <p>I tried to contribute back then by adding the option to use the FXAA anti-aliasing algorithm for the window (I didn’t notice it has already been implemented as a method for the window).</p> <p>So instead, I implemented the first mentioned shader in the GSoC 21’s project idea “<strong>Add new shader effects</strong>” (<a class="reference external" href="https://github.com/m-agour/Simple-Animation-System/tree/main/additional%20files/GLSL%20GSoC21%20test/shaders">the fire shader</a>) in GLSL using Gaussian noise.</p> <p>The next step was to implement the shader to make it work with FURY actors but then I knew I’m having a mandatory training required by the University last summer. I was disappointed, and I decided to postpone until next year’s GSoC.</p> <p>This year when the accepted organizations were announced, I didn’t bother to go through the list since I knew exactly which organization I’m going to apply for. So I just went directly to read the Ideas list for FURY.</p> <p>The keyframe animation system was the perfect match! I have been around keyframes for half of my life to even guess the required features before I read them! I then started to contribute and one contribution led to the other one.</p> <p><strong>Code contributions:</strong></p> <ol class="arabic simple"> <li> <p><a class="reference external" href="https://github.com/fury-gl/fury/pull/552">https://github.com/fury-gl/fury/pull/552</a></p> </li> <li> <p><a class="reference external" href="https://github.com/fury-gl/fury/pull/555">https://github.com/fury-gl/fury/pull/555</a></p> </li> </ol> <p> </p> <h2>The day I got accepted</h2> <p>I made it my mission for the day to keep watching the email for any changes. When It got 8:00 pm in the Cairo timezone, I didn’t see any changes. So I started searching for any news whatsoever and I couldn’t find any. The GSoC dashboard doesn’t say anything (story of my life. I didn’t even get any promotions or spam mails that day). That’s when I gave up. But, something doesn’t feel right! Right? I went again to check the dashboard to find that my proposal got accepted. I couldn’t even believe it. I would better not jump to conclusions and wait for the official email before celebrating. Shortly after, I received the official email. It was a whole new feeling I had never experienced ever before! I reached a whole new level of happiness.</p> </article>mo.aggour@gmail.com (m-agour)Tue, 28 Jun 2022 07:12:11 +0000https://blogs.python-gsoc.org/en/m-agours-blog/my-journey-till-getting-accepted-into-gsoc22/