dotnet-logo

Low Level Keyboard Hooks In C#

Sometimes Global Hotkeys In C# are not good enough.  Sometimes you need to get right down there with the low level events and hook the keyboard yourself.  In my recent Fullscreenizer project, I had to do this to detect hotkeys reliably due to games often making their input exclusive and not passing the events on for other applications to detect.

Here is an excerpt from Fullscreenizer’s code that hooks the keyboard at a low level.

(more…)

Read More

dotnet-logo

Global Hotkeys In C#

I recently picked up an old project and wanted to add some new functionality that would listen for and respond to hotkey combinations even when the application didn’t have focus.  After a little searching on the Internet, I came across this helpful post on StackOverflow.  The solution in the StackOverflow post made use of the WinAPI RegisterHotKey and UnregisterHotKey functions.  Functionality was okay, but was limited to calling the same function even with differing hotkeys.  I written my own solution based on the StackOverflow post which fixes this issue.  It’s not elegant by any means, but it gets the job done.

(more…)

Read More

maya-logo

Notes On Implementing A Maya Viewport 2.0 Renderer Override

Over the last two months or so, I have been working on a project in my free time that overrides Maya’s Viewport 2.0 renderer.  A viewport renderer override can be useful to render the scene externally, such as in a game engine.  The advantages of this are that you can fully control the rendering so that the result in the viewport matches your game engine in real-time.  From a productivity standpoint, this is an amazing plus.  Other advantages include, but are not limited to, removing the limitation for the number of light sources natively available within Maya’s built-in viewport renderers.  Implementing such a project is no easy task, and it comes with many strange quirks and issues.  I will discuss, on a high level, implementation of such a renderer, as well as share some notes on things I’ve learned throughout the project.  Some things may be generic to the API whereas others may be specific to renderer overrides.  Please note that this is not a tutorial, but is instead intended to provide a direction for you to follow.

(more…)

Read More

maya-logo

Exporting A Maya Light’s Radius/Range

It can sometimes be useful to know the radius or range of a light source within Maya.  For example, an exporter for a video game could require the radius of a point light and the height of a spotlight to be exported for use in the rendering portion of the game engine, or the same information could even be required for a viewport renderer override in order to compute the lighting.  Whatever the case, here’s an easy way to export a radius and range within Maya.

(more…)

Read More

maya-logo

Implementing A Simple Maya Python Deformer

Deformers within Maya can provide users with easy-to-use and intuitive interfaces for modifying, or even animating, low-level components, such as vertices, of geometry.  They can be used in many situations, such as providing a starting point for more complex models, keyed for animation, or even to help sculpt and shape geometry, to name a few.  Deformers are useful because they are a node in the DAG.  This means they affect the geometry at that specific point in time, and can be edited at a later date.  They can also be removed like any other node, and the order that the node appears in the graph can have dramatic changes on the resulting geometry.  In other programs, such as 3ds Max, they are commonly referred to as Modifiers.

(more…)

Read More

maya-logo

Reloading Textures In Maya Using Python

When working with textures in a 3d program, you often find yourself reloading the textures.  For example, when creating a 3d model for a video game, you may reload the normal map multiple times, or you may be modifying a diffuse map.  Whatever the cause, you will most likely want to see the effect your changes have on the 3d model quickly, so you can get back to tweaking.  Unfortunately, programs such as Maya, which this article will focus on, do not provide a quick and easy way to reload textures.  The snippets discussed will be from various modules I have previously written, so alone, they will not make complete sense.  They will, however, provide you with all information you require to implement this yourself.  There are easier ways than will be discussed in this article to reload all textures within the scene.  However, when this tool was requested by an artist, I was told it must be able to reload only selected objects’ textures, as well as all textures.  Because of this, the solution discussed will include traversal of connections and attributes.

(more…)

Read More

maya-logo

Maya: Baking Details With Normal Maps

It is often desirable, especially in real-time applications such as video games, to have 3d models consisting of as few triangles as possible, whilst still maintaining a certain level of visual quality.  In the case of video games, it is often the case than an artist is given a limit of which the triangle count must not exceed.  The fewer triangles the artist has at their disposal, the less accurately a shape can be represented.  The solution to this is normal mapping, whether it be by hand, or through a process called baking.  Baking of normal maps consists of taking a high resolution mesh and transferring it’s detail to a lower resolution version of the same mesh.  This approach allows the artist to ignore triangle counts for their higher detail model, and being able to display the details on the lower resolution model without a high triangle count.  This technique, however, does not come without problems.  There are many issues ranging from edges being too sharp to show up on normal maps, to envelopes not being large enough for the baking process.  This article will not cover these caveats, but instead will assist in the process of transferring details from a high resolution model to a low resolution model, with UVs, in Maya.

(more…)

Read More

maya-logo

Maya: Modifying The Undo Queue

When scripting in Maya, whether it be MEL or Python, commands such as move, rotate, and the like, all cause Maya’s undo queue to be populated.  If you are scripting something that is intensive, or includes many commands which will populate the undo queue, you may wish to disable the undo queue for a performance increase, and to save memory.  On the contrary, you may wish to group a set of commands into a single undo, to make a script’s actions appear as a single undo step to the user.  The undoInfo command within Maya, which is accessible in both MEL and Python, allows you to query and modify the undo queue.

(more…)

Read More

python-logo-transparent

Python Snippet: Creating Clean Selection Lists In Maya

Introduction

I’ve recently been learning Python to develop tools at work for use with Maya.  When writing tools, I have found myself often requiring easy-to-iterate lists of the active selected components (faces, edges, vertices, and so on) or objects.  Using PyMel, and some fancy Python magic, I have written some reusable functions that can easily be extended or modified to filter the selection as is required.

(more…)

Read More

Fripside - Judgelight - Hard - IOGraphica - 3 minutes (from 17-34 to 17-38)

Modern Art With Osu!

A very interesting game I’ve recently picked up again in the last few months is Osu!.  Osu! has quite an interesting history.  At heart, Osu! is a rhythm game where you hit targets on the screen using your mouse along to a sound track.

As a little experiment, I had the idea of tracking the mouse movement throughout the duration of a song and seeing what sort of image it came up with if you were to plot the movements as pixels.  I used IOGraph to both log and plot the mouse coordinates throughout songs.  Below are examples of a few songs I played and the results from them.  They are quite interesting!  I recommend trying this yourself, as both Osu! and IOGraph are free, and you can come up with some really interesting patterns.  Why not try the same songs I did and see how your patterns differ?

(more…)

Read More