miércoles, 28 de enero de 2015

NURBS Loft Tool Utility





This is a little problem i found when modeling my product shot for the demo reel.
After using the "trim tool" for doing that star shape hole on the geometry i needed to do a loft between the onward and backward star edges.
This is what i got from the "loft tool":


As you can see if you zoom in the image a problema arises : the resulting "geometry" is very ugly. At first i thought it could be the viewport cheating. I did a render and... exactly, the lofted surfaces were as shown :( --> big problem.

So I decided to automate the first process i came into when i started this, which was selecting pair by pair of trimmed edges and loft them. The drawback was that I had to do several times the op. Here comes Python I thought. It took me a couple of minutes and a look at http://download.autodesk.com/us/maya/2011help/CommandsPython/loft.html to figure it out.

import maya.cmds as mc

curSel = mc.ls(long=True, selection=True)
if not curSel :
    sys.stdout.write("No object(s) selected!!")
else:
    nOfEdges = len(curSel)
    for i in range(0,nOfEdges,2):
        mc.loft(curSel[i],curSel[i+1])

Important Note: it's crucial for the code to be effective that you SELET BY PAIRS
of trimmed edges that might be lofted, because the current selection respects that order.


Here above all the trim edges selected.
Now below the result after applying the script:


Notice how the topology is now super clean!!! :))

martes, 20 de enero de 2015

Computational Geometry: 2D Convex Hull



In computational geometry, of the many problems computer scientists have dealt with is to find the hull of a set of points. There are several approaches for this but the "Graham Scan" algorithm guarantees a performance in time of O(nlog(n)) which  is optimal.

This algorithm makes use of sorting methods such as merge sort because it respects the previous order in subsequent sortings.

Finding the convex hull has many applications in 3d digital content creation tools as well as in image processing and so many other fields.

Since I finished the MOOC on algorithms I wanted to code this algorithm. Nevertheless, the web is full of code for this. In my case, I've followed the approximation held in Algorithms, 4th Edition by Sedgewick. Pseudocode can be found here.

I've had a good time coding this :D!
Here are some results from the video.





sábado, 3 de enero de 2015

Another Drawing!!



This time I rescued an old drawing of the days when I was son keen on Nine Inch Nails. The character is Trent Reznor and he is portrayed in the dark ages between his Downward Spiral (1995) album and The Fragile (1999) when he was after known for suffering depression, social anxiety disorder and bear with the grief of his grandmother's death. His grandmother raised him alone. Also he got addicted to cocaine and suffered from alcohol addiction as well as other thoughts about committing suicide, he was walking on the thin line. One day he was reborn when he used chinese white heroin which he believed was cocaine and consequently overdosed, he ultimately resuscitated at a local hospital.

Trent Reznor has a bipolar disorder which he exorcitates through his music. One can notice the strength and high tempo of some of his tracks combined immediately after with other calmer, softer parts, probably reflecting his ambivalent manic-depressive disorder. I can't help being moved by this kind of people, people with mental illnesses which bear constantly with their condition and in spite of it , no matter what they manage to get through. Obviously not all of them succeed, many commit suicide. There is another public character with bipolar disorder that I look up to after learning all he has had to suffer and that is Stephen Fry the english comedian, actor, writer, and so, so many other things. Stephen Fry deserves an entry on his own.

The drawing is just a quick sketch with some postproduction with Photoshop: colour adjustment and rain effect.

I'll leave you with my favourity NIN song, a cover of one of Joy Division's tracks Dead Souls, part of the The Crow Soundtrack.