Tuesday, June 11, 2013

HTC One Back Template for DIY Case Artwork

I got a super-cheap, clear hardshell case (price seems to have gone up since I bought it...) for my HTC One and was interested in making some custom art to put between the case and the phone. I wasn't able to find any templates readily available online, so I spent a little bit of time with a flatbed scanner and whipped one up myself:

Note: I make no guarantees about the applicability of this template to your own case. It worked for me and I hope you find it useful, as well. The biggest potential issue would be with the cutaways for the power and volume buttons, which are pretty large on my case, but it should be easy to remove them if your case doesn't have them.

Here's how it looks when it's all finished:
Sorry about the weird picture. I didn't have another camera on hand, and there weren't any good mirrors at work, so I had to just use the reflection from an old hard drive platter...

EDIT: Here's a slightly better picture:
I made this BMO design along with a couple of other Adventure Time designs, ready to print:
Best show on television.

Friday, May 31, 2013

Setting up a Cydia Repository

For RetroArch v0.9.9, the new star platform for support is/was iOS via jailbreak, so we needed to set up a Cydia repository for people to pull down the app. I followed this guide, which was helpful, but there were a few important deficiencies that required additional work. I'm going to cover those issues here.

First off, the directory structure described in the guide, with 'apps' and 'uploads' is unnecessary. All you need is a directory that contains your Packages.gz file and a subdirectory named 'deb' that holds your package. If you keep the directory structure from the guide, your Cydia URL will be http://yoursite.com/cydia/upload, which is tacky.

More importantly, if you follow the guide, your app will not install to the /Applications directory of your iOS device, and any *.info files will be broken, which was very bad news for RetroArch. To fix this, I followed this guide, the important parts from which I will summarize here:

First, you'll need to take create a new directory with the same name as your application--in my case, RetroArch. Then, inside that directory, create another new directory named Applications and one named DEBIAN. In the DEBIAN directory, place your 'control' file, which contains information about your application, and in the Applications directory, place your compiled application (in my case RetroArch.app).

At this point, you're ready to bundle your application using dpkg:
dpkg -b [your.app.name]
Once your deb is created, you can delete the directory structure and then create your Packages.gz:
dpkg-scanpackages -m . /dev/null | gzip -9c >Packages.gz
Create a directory called 'deb' and drop your deb bundle into it and you should be all set.

Wednesday, May 15, 2013

Fix for: Google Voice Search force closes immediately

This is just a quick post and it may or may not work in your case: I installed a nightly of Cyanogenmod 10.1 on my HTC One and the Google Voice Search app force closed every time I clicked on the little microphone icon. Everything else worked fine, including Google Now and so forth.

The fix for it, in my case, was just to go to the Play Store and update the Google Search app. If that doesn't fix it for you, I would recommend uninstalling the Google Search app entirely and then reinstalling. If that doesn't help either, you probably have something more serious amiss.

Thursday, April 25, 2013

Multipass Shaders - NTSC, Motion Blur and More

It's been a while since I've done one of these posts and, in that time, RetroArch's multipass shader implementation has matured quite a bit, paving the way for a lot of really cool effects that simply can't be done in a single pass. At the time of this writing, higan's multipass shader implementation hasn't been released yet, but many of these shaders should be portable to it (with some substantial effort, at least) when it arrives.

As always, images were captured at 4x scale. Click the thumbnails to embiggen.

First up:
Themaister's NTSC Shader
Themaister wrote a sweet new real-time NTSC Composite shader that mimics a lot of the noise, fringing and crosstalk present in the NTSC composite signal:
This shader is a big deal because blargg's CPU-based NTSC filter was previously the only way to get this effect, which was important in some older games' art design. However, the filter had to be hardcoded to the individual consoles' specific resolution, which made it a headache to maintain in a multi-console setting. This shader should work on all of RetroArch's cores, and it is available in GLSL and Cg/cgp flavors.

I mixed it with cgwg's CRT shader and ended up with this (ntsc2-crt.shader):
You can compare that with an earlier version I cobbled together from the old NTSC shader--which tended to be finicky and not everyone liked anyway--and cgwg's CRT (crt-geom-interlaced-flat-ntsc.shader):
Digging through an old thread on byuu's forum, I also found where cgwg had written a similar shader that combined NTSC with CRT in 6 passes with barrel distortion (6-pass-ntsc+crt2.shader):
In the same thread, cgwg had posted this shader, called 'beam-dynamic,' that is essentially the same result as the beam4 shader mentioned in one of my other posts:
Out of all of these variations, I think my favorite is Themaister's NTSC with the addition of scanlines that have been softened with gaussian blur (ntsc2-maister-scanlines.shader):

Harlequin's Gameboy Shader
This shader does for Gameboy emulators what cgwg's CRT does for regular consoles, i.e., recreates the look of the original display with startling verisimilitude:
I'm not going to spend a lot of time talking about this shader here, even though it's completely badassed, since it's covered at length in a previous post. It's available in Cg/cgp format only, though you can use Themaister's handy cg-to-glsl python script to convert it to GLSL if necessary.

Harlequin's LCD Shader
Using some of the same concepts from the Gameboy shader, Harlequin is also working on a more generalized shader that mimics the low-resolution, slow-refreshing color LCD displays from a number of handheld consoles, such as Sega's Game Gear and Nintendo's Gameboy Advance:

Similarly, cgwg posted an LCD shader he's been working on that produces a regular, square pixel grid pattern, paired with some simple motion blur (lcd-cgwg.shader):


Motion Blur
Speaking of motion blur, I wrote a multipass version of this shader a while back and cgwg revised it down to a single pass (refers to previous frames, so still incompatible with higan v092 and earlier). This effect can be good for mimicking the slow response time of crummy LCDs (motion blur.shader):
I also made a version that only adds the blur during rewind, along with a little sepia-tone effect, kinda like the rewind effect in Braid (braid rewind.shader):
This shader can be added before pretty much any other shader (either manually by pasting in the code or by using the new, built-in RGUI shader stacking function and/or glslp shader configuration files) at a scale of 1.0 and the effect will only kick in when the game is rewinding :D

GTU
This shader from aliaspider is an interesting take on the CRT paradigm insofar as he didn't want to focus on phosphor emulation or heavy-handed scanlines or any of that other jazz. He was more interested in the blurring/blending effect of CRTs that enabled tricks like pseudo-hires transparency and color dithering. Later revisions include some sweet gamma correction and the ability to create mild scanlines (if you choose; GTUv031-multipass.shader):
I think this is one of the best ways to get pseudo-hires transparency working properly, and the transparency it creates is smooth and absolutely beautiful:
Aliaspider made a single-pass version of the shader that should work in higan v092 and earlier, along with the multipass version linked above for RetroArch, and a multipass version for higan v093's upcoming shader implementation.

My 4k Phosphor Shader
This is another one that I won't spend much time on, since I cover it at length in another post:
This shader currently doesn't look so hot as it's designed to work at around 10x scale (i.e., on a 4k resolution television or other high-DPI display; it gets wrecked by subpixel behavior at current normal scales [read: 1080p]). However, it brings some nice things to the table, such as easily-edited LUTs that can be created/modified in Photoshop/GIMP rather than a text editor and scale-ability to freaky-huge resolutions. I'll attempt to convert this to byuu's higan v093 format at some point, though it may take some time.

Wednesday, April 24, 2013

Customizing Harlequin's Gameboy Cg Pixel Shader

CRT shaders are great, but they're not always appropriate for every console, seeing as handhelds' tiny LCD screens have very different characteristics, which in turn shaped the way the games for those consoles were designed. The original Gameboy handheld had these characteristics in spades, including a slow response time (manifesting as motion blur), very low resolution and a distinctive 2-color palette that ranged from yellow to green. Emulators typically represent this color palette as black and white, which can be jarring for people who spent a lot of time with the system.

Thankfully, a nice fellow named Harlequin has come to the rescue with a really great pixel shader for RetroArch that does for Gameboy displays what cgwg's CRT shader did for those displays. Like cgwg's CRT shader, Harlequin's Gameboy shader reproduces a lot of different aspects of the Gameboy display and presents a number of options to the user that are easy to modify with just a simple text editor (I use/prefer Notepad++ but almost anything will work). Unlike cgwg's, though, the Gameboy shader also uses some lookup textures (LUT) that require no text editing and can be modified using an image editor such as Photoshop or GIMP. Harlequin has included several example LUTs and I'll cover a few in screenshots.

As usual, all shots are at 4x (which is a bit small for Gameboy resolution, but oh well) and you can click the thumbnails to embiggen. All shots were taken via RetroArch with the Gambatte core unless stated otherwise.

First, here's an unfiltered shot for comparison:
And here's one of Harlequin's Gameboy shader with default parameters:
First, I'll cover the LUTs, which can be edited with an image editor. The palette files are found in the 'resources' folder and they're just two 64x64 squares of color that the shader pulls from to get the appropriate colors (i.e., to replace white and black in the emulator). One of the included samples is yellower and resembles the display in strong light, such as daylight:
Another sample mimics the higher contrast of the Gameboy Pocket revision:
Also in the resources folder, you'll find some sample backgrounds, which apply a texture to the image. The default has some angled hatching, while the included samples show some different types of texture that are possible, like this noisy bit:
Next up, we have the shader variables that are easily modified by users with a simple text editor. These are enumerated in the shader's enclosed README file and I'll include some shots here for reference.

The first one is the 'alpha' setting, which determines how dark a 'white' pixel should be. If you raise the value,  everything becomes darker:
While lowering the value will make the pixel grid less visible in white areas:
The next option, response time, determines how long it takes a pixel to go from white to black and vice versa. It doesn't really translate very well into static screenshots so I didn't bother showing it here. The next option after that, though--blending mode--determines whether just the space between dots is blended (mode 0) or all texels (mode 1), which, in practical terms, is how sharp/blurry the edges of the individual pixels are:
The next option--texel alpha blending--effectively controls how defined the grid pattern is. Higher values result in round/fat-looking pixels:
While lower values give you a sharp, well-defined grid:
After that, we have 'contrast,' which works just like the slider on the side of the Gameboy. Lower values can simulate the look of low batteries:
'Background smoothing' lessens the effect of the background LUT. Higher values make the background less visible, lower values make it more visible:
'Shadow opacity' controls how dark the drop-shadows from the pixels are. Higher values mean darker shadows:
Finally, 'shadow offset' determines which direction the drop-shadows appear (i.e., for simulating a light source that isn't directly above the display). Setting both the X- and Y- values to 2.0 will offset it more:
While setting them both to 0 puts the shadows directly underneath the pixels:
Just so you know: you can use this shader with other RetroArch cores, as well, and see what your favorite games would look like in an alternate, Gameboy-centric universe:

Harlequin has made some major changes to the way the shader looks and works since he first started working on it. While the current iteration is extremely convincing, I also liked an earlier version that looked more stylized. Here's a couple of shots:

You can download it from my Mediafire.

Thursday, March 14, 2013

Pixel Shaders for RetroArch 3D Cores

RetroArch got its first 3D core recently in the form of TyrQuake and it seems most of the existing pixel shaders either look unimpressive or don't work at all. Thankfully, shaders written for Pete's OpenGL plugin for PSX emulators are easy to port to RetroArch's XML format and they seem to generally work well enough.


A Lovely Bloom
One of the few conventional shaders that still functions as expected, this one looks really nice, and the screenshot doesn't really do it justice. It gives light sources a nice bloomy glow that softens things up a bit. 

 HDRTV
This shader saturates colors somewhat and adds faint scanlines. It has been around for a long time (it was one of the original shaders available for bsnes when it first got pixel shader support) but the scanlines weren't visible on 2D sources, so I was surprised to see them here.

NV+MSAA
This shader uses the "natural vision" algorithm to do some color adjustment with added post-proc anti-aliasing.

Cartoon
This one darkens the image too much to be very useful in an already dark game like Quake but may be good for future cores that have brighter games.

Edge Detection
While not necessarily practical, this shader draws a line at each color intersection to produce a cool, old-timey effect.

Scale4xHQ
One of the only scale/interpolation shaders that has any noticeable effect, this one is a bit blurry for my tastes but it evens out a lot of the jaggies.

Scanline3x
I'm a sucker for scanlines and these normally crummy-looking scanline filters I made a while back actually look pretty nice here. (Note: I think I got the 3x and 4x mixed up; 3x should have fewer, larger scanlines than 4x)

Scanline4x

Themaister Waterpaint Scanlines
While the effect isn't as pronounced as with 2D cores, this shader does some smoothing with scanlines and ends up with a sort of screen-door effect that nevertheless looks pretty good.

CPU Filters
Some of the bsnes-style CPU filters work, but not that well. The NTSC variants all perform their normal functions, but the the image is off-center and cuts some things off, as pictured. The scanline filters work pretty well, too, though they're sort of hard to see. Interpolation filters like HQ2X seem to have no visible effect, and SuperEagle crashed my game :/

Monday, March 11, 2013

XRandR Overscan Fix for Intel HD4000 Ubuntu

I have my television hooked up to a computer running Ubuntu 12.10 Quantal and have had issues with overscan across a variety of chipsets. For Nvidia graphics, the proprietary driver sometimes has an overscan compensation slider or at least something. Intel drivers are open source and very convenient but don't seem to have much in the way of driver configuration outside of what's exposed in the normal settings applications.

If you have an Intel chipset, such as the built-in HD4000 graphics that come with Ivy Bridge CPUs, there are a few angles you can try that center around using xrandr, which stands for 'X Resize, Rotate and Reflection.' This program has a bunch of different options, and I strongly recommend spending some time with the man page. No matter which options you try first, you'll need to query the program and see which display device is being used. You can do this by typing into a terminal:
xrandr -q
For me, HDMI3 is the one that's hooked up, so it lists all of the available modelines and some other information.

Now that we know which device is being used, we can invoke xrandr with this syntax:
xrandr --output [device] --[option]

The option that worked for me is --transform, which performs some crazy matrix math that I don't understand (I'll update this post if someone tells me wtf is going on) on each pixel, apparently kinda like the pixel shader stuff I've written about elsewhere, I think...? Anyway (replace HDMI3 with whatever your device is called):
xrandr --output HDMI3 --transform 1.05,0,-35,0,1.05,-19,0,0,1
This doesn't make it fit exactly on my screen but it's much closer than it was. Unfortunately, it gets wiped out every time you logout, so we need to do something to make it stick. You can add it to your startup items or tack it onto your lightdm window manager's configuration file by typing into a terminal:
sudo nano /etc/lightdm/lightdm.conf
Navigate to the end of the file and start a new line and paste this in:
display-setup-script=xrandr --output HDMI3 --transform 1.05,0,-35,0,1.05,-19,0,0,1
Save and exit and the transform command should kick in every time you login.

Other options that may help:
The 'scale' option should ideally just scale your screen down, but in my experience, it makes everything (text, window borders , etc) bigger, similar to changing the DPI in Windows, without actually changing the visible area.

The 'border' option also seems like it should do exactly what we want, but I haven't seen it actually work anywhere. On my system, it fails with this error:

X Error of failed request:  BadName (named color or font does not exist)
  Major opcode of failed request:  140 (RANDR)
  Minor opcode of failed request:  11 (RRQueryOutputProperty)
  Serial number of failed request:  29
  Current serial number in output stream:  29

which seems to be a catch-all for unrecognized commands :/

Generally, I would recommend skipping all of this and attempting to fix it through your TV's built-in options (generally called "just scan" mode or "pixel perfect" or something like that). The only time you should attempt to do it in software is when your TV is too crummy (like mine) and doesn't have any of those options.

Analytics Tracking Footer