Interesting world of Shaders and vtk

Hey folks,
The last two weeks were full of fun. Sitting near my screen exploring various shaders was fun. With the help of Elef and Ranveer, I could do a lot of different examples and all this helped me build some really cool visualization examples (At least I was amazed ūüėõ ).
So let me walk you through few things I achieved over the past two weeks.

  • Displaying Frame-Rate of vtk¬†Renderer
    The example renders ten small unit radii spheres and displays the number of times the screen is rendered per second.  It is calculated by finding the inverse of the last rendering time (in seconds of course). And we obtain last rendering time using a callback function GetLastRenderTimeInSeconds. As the name suggests, this function returns the time delay between last rendering time and the present rendering time.
    A small demo of the work is available here:

    The documented code is available here.

  • Taking user inputs to Shaders using¬†SetUniformf
    This task was aimed at understanding how to use user input to set shader properties. I came up with a code which takes as an input our choice for RGB values and returns a sphere of that color.
    SetUniformf is a very important tool which magically acts as an interface between the OpenGL world of shaders and our Python world. As we move on to more complicated tasks, this function will be increasingly useful for sure.
    A small demo of the code is available here:

    The documented code can be found here.

  • Constructing Sphere using fundamental blocks – Vertices and Faces
    It was very interesting to know how any 3D shape is rendered using triangles as the fundamental block. I tried to visualize the same in a more general way. The rendered shape can be changed to ellipsoid very easily. I am currently working on including a slider which changes the dimension of the sphere as per the slider input. The sphere looks deformed (intentionally) to emphasize the use of triangles to form the sphere. I have used as less as 24 triangles to get a sphere.
    The sphere looks like this:

    The documented code can be found here.

  • Extending the to-be-added sphere function
    Elef is working on a Pull Request to add sphere function. The sphere would help to produce 3D Glyphs. The purpose of my work is to allow for additional parameters -vertices and faces, which would act as an alternative to the traditional center and radii thing. The Pull Request is under review and can be seen here.

It is really fun working with my mentors and the awesome community at dipy. I strive to learn new things and will try more such interesting stuff as we proceed. I’m loving GSoC ūüôā . Looking forward to more fun this summer.


End of Community Bonding Period

Hey folks!!

We have come to the end of the first stage of GSoC project, the Community Bonding Period. Official coding begins NOW!!

I spent my Community Bonding Period very well. I got a very good exposure to the project and this helped me a lot in understanding the work and starting off correctly. I got introduced to vtk, GLSL language and obviously the vtk library of Python and how to communicate between them.

I had a Video Chat with Elef, Ranveer, David, and Gabriel on 8th May. The talk was very smooth and I got myself familiar with their expectations of this project. They are very much interested in improving the visualization module of dipy which I also think is the need of the hour. We discussed the importance of Shaders and its relevance in this field of study.

As a part of the Community Bonding Period, I worked on the following tasks to gain more insight into the project.

1. Experimenting with the vtk-shaders code. This was the initial code developed and maintained by David. I went ahead and made several modifications to the given code to obtain interesting shapes. I understood the structure of the code and different aspects of using a Python wrapper around python vtk.

2. Understood the basic functioning of Streamlines. The strategies used to perform various operations on the graph input.

3. Spherical Harmonics are used for the visualization of spheres. I tried out experimenting with that and now I would be spending some more time trying to figure out the Spherical Harmonics and the use it has to produce visualizations of the datasets.

With an important part of the project ending soon, I am very much excited to get into the Coding Period of the program and look forward to having great fun ahead. In the next few days, I’ll be again having a Video chat with Elef and my mentors regarding future works that need to be done.

Looking forward to more exciting times.



Random Git tricks

Here are few times when I looked up to help on the internet for help regarding git.

  • `git pull upstream master` caused many merge conflicts which I did not wanted to handle at that time. To undo the effect use `git reset –merge`

More things will be added as I proceed.


Selected for GSoC with dipy, Python Software Foundation

Phew!!! Selected for GSoC-2018 ūüôā .

This was definitely not the time I wanted the result to come. After having an exam till 5 and another due tomorrow afternoon, this result business kept me out of focus. Sitting with my headphones on, refreshing PSF GSoC page, and drinking water regularly, this is what I was at from 9.00pm IST. Now, it’s all sorted, the stage is set, the time has started to execute what has been thoroughly planned for this summers.

With my End Semesters examination still on, I am briefly getting familiar with the work. I have started using playing around with shaders. As we enter the Community Bonding Period, I have the following goals in coming days

  1. To start writing blog, which I guess is on track after having a good start like this ūüėČ
  2. Participating more on the Gitter Channels.
  3. Continue with the small contributions that I have been doing.
  4. Look for more visualization related issues (#1492 and #1355).
  5. Participate in Brainhack. Although I cannot physically attend the event, but I’ll be keeping track of the talks, to get introduced this field.

While there are a few issues I am working on and hope to complete that soon, I would join the discussions on issues related to visualization soon.

It’s a good start to this interesting endeavour and would love to keep the spirits high. <3

Will be back with more interesting stuff.


(NOTE: This post was written on 23rd April 2018 and published after I got rights of this blog.)

Checking my brand NEW Blog

Hey there!!

I got this cool blog from PSF. This is highly customizable and I would like to spend more time playing around with this cool layout.

Stay tuned to hear more from me!!!!