Pages

Monday, February 7, 2022

Wacom Bamboo Pen on HiDPI displays

 If you're running Windows 10 (or even Vista, 7, or 8) with a Wacom Bamboo Pen (CTL-460) or any other device from the same era, and you have a HiDPI display (4k, or anything where you've changed display scaling), you probably have been putting up with this...



Well I'm here to tell you how to fix it.

In "C:\Program Files\Tablet\Pen" there is an executable called "Consumer_CPL.exe". Right click and go to Properties->Compatibility and click on the "Change high DPI settings" button down the bottom. In that screen, make sure the "Program DPI" option is off, and instead at the bottom, in the "High DPI scaling override" section, check the box for "Override high DPI scaling behavior." and set "Scaling performed by:" to "System", as in the picture below.


Now when you open up the Wacom Control Panel, it will look like this...

Furthermore, on this screen if you click on "Mapping" you can find the infamous checkbox to disable "Windows Ink", the API that Microsoft created with the release of Windows 10 to handle pressure sensitive pens. The temptation is to turn this off, as that is what is required to make applications such as GIMP 2.10.30 work with the tablet. Windows Ink support has been added to the unstable development build of GIMP 2.99.8, so better to switch to that version instead.



Friday, February 26, 2021

Voxel maths corrections, part 2

 

Two bunnies, one polygonal, one voxel.
Which bunny is rendered with Voxels? If you answered "the one that's not Z-sorted properly" then you are correct! It may not look like much, but now the voxels use the same matrices for positioning as the rest of my code. Well, the projection isn't the same, but it's a very close (and very dirty) approximation. The modelview matrices are however the same. So finally the normals, the projection, the positioning, are identical. And back to tradition, here is the code.

Wednesday, February 24, 2021

Symmetry and Maths

If you scroll back through the older posts, you may notice that the bunny is facing a different direction between regular OpenGL and the voxel view. I only just noticed it today, while trying to get the voxel view to align up with my newer 3d maths code. As you can see, the scale and position aren't exactly correct, but at least now they're close, and I'm not mirroring the bunny through any axis. Really not sure how I never noticed that one, but you live and learn.

Monday, December 10, 2018

Cross Platform Vulkan VR

The next round of progress has been committed. We've got window resizing and fullscreen support working on Windows, Linux *and* MacOS, and VR support working on Windows and Linux.

VR on MacOS is another story though. While OpenVR does work on Mac (only just), it appears that OpenVR and Vulkan is not currently supported, as one of the OpenVR function calls required to initialise appears to not be implemented on the Mac build of OpenVR. Fortunately it seems Valve is working on it, or at the very least this is not only one of the few issues that they have assigned to someone, they did it very quickly.

Meanwhile, while VR does work on Windows and Linux, it does not work well. This is no reflection on OpenVR or Vulkan, rather a reflection on my taking the absolute quickest method to get it working. There is currently flickering on my test setup where the OpenVR Vulkan Example has none. I believe this is because of the synchronisation method I'm using, vkQueueWaitIdle() is possibly not the best method available, which comes as no surprise. I plan on smoothing out a lot of the wrinkles in its design before taking on that issue though. Having got this far, I've developed a quite good picture in my head of how all the pieces of Vulkan fit together, and plan to make use of this in writing sane texture and mesh handling code, possibly even getting FontStash working on Vulkan, which will all be very useful in the next major phase of this project, the voxels.

The mesh in this image is the LPS Head - here seen with only the lambertian texture map (no bump map).

Monday, November 12, 2018

Cross-Platform Vulkan Mesh Render Example in C


I feel I should take some time out to briefly talk about the current state of my Vulkan stuff.
The specific commit I'm talking about is this one.

This is the most simple cross platform Vulkan mesh rendering example, that is written in C, that I'm aware of. Does it do everything correctly? Probably not. It can't even handle the window being resized. What it does do is contain 100% of the Vulkan code within a single file, while leaving the platform specific code to be the simplest possible example of each. It is also utterly painless to compile, not requiring any external SDK to be installed, it requires only the compiler for your platform.

The complete steps required to prepare the build environment are in the Readme file, which for Windows, is get a good version of MinGW-w64 (specifically 8.1.0-x86_64-posix-seh), on Linux is how to install the up to date Nvidia drivers (and the Vulkan driver, which is not included by default) and Clang, and on Mac it is naught more than "Install XCode". Why no Clang on Windows? Debugging 64bit binaries created with Clang on Windows is currently an "at your own risk" case, and in my experience as of a few weeks ago when I started this was "problematic" when using VSCode as my debugging interface. Given the standard of work of the Clang and VSCode people, I'm sure this will be a distant memory quite soon, if they haven't already taken care of it.

Being that it does load a Wavefront OBJ file, it has my old OBJ loading code in there, which while it works just fine for most simple models, does do some silly things with some of the more complicated models (I'm looking at you Powerplant). It is capable of loading the San Miguel scene, and some versions of the Sponza Atrium, as well as everything from the Stanford 3D Scan Respository. It's not the main focus of this, and here it's only contribution is that it does not add a cumbersome OBJ loading library (I'm looking at you absolutely everything ever). If you know of an OBJ loader written in C that is of Sean Barrett levels of awesome, I'd love to hear about it.

This is the last point of the project being "simple". From here I'm adding OpenVR support and all the other complexity that I usually roll with, starting with my usual window handling code. Maybe at some point in the future it will return to an example-like state of commenting, but from commits after this one will break things for a while.

Friday, September 28, 2018

Cross Platform Vulkan

With the release of MacOS 10.14 Mojave, Apple has deprecated not only its long suffering OpenGL implementation, but also OpenCL. As they were the original creator of OpenCL, I think it's safe to say it's as good as dead. That leaves Apple with no viable Graphics or Compute platform. Fortunately, The Brenwill Workshop open sourced their MoltenVK library, which acts as a very lean Vulkan layer that sits on top of Metal. After getting a very rudimentary single window with a shader example going on the 3 platforms I care about, being Windows, Linux and MacOS, I can say that not only does MoltenVK work, it is arguably the best library on the entire MacOS ecosystem. There are a few small gotchas, and I wish to detail them here.

Firstly, there are only three supported surface formats. This is because MoltenVK uses a CAMetalLayer for its rendering, and this only supports five formats, and two of them are just downright odd, so justifiably ignored. These translate into the following Vulkan surface formats...

VK_FORMAT_B8G8R8A8_UNORM
VK_FORMAT_B8G8R8A8_SRGB
VK_FORMAT_R16G16B16A16_SFLOAT


...which gives us plenty to work with. This should not be considered odd at all, the current Nvidia drivers on Linux, 396.54, as well as the current Nvidia Windows drivers, 411.70, only report the first two of those formats on the 750M I tested (the same MacBookPro I tested the Mac version on). It should be noted, that on Windows and Linux, Vulkan will initialise with other formats, where as on Mac it will crash with a...

*** Terminating app due to uncaught exception 'CAMetalLayerInvalid', reason: 'invalid pixel format 70'


The only other quirk I encountered was the order of operations. As the shader takes a single float in a uniform buffer, the exact location of the vkCmdCopyBuffer() call to update the uniform buffer caused the drawing to stop right after the clear command was issued, so I was left with a ClearColor coloured window, even though everything was reporting success. That was without the full Command Queue debugging options enabled, so I suspect that will complain if you have it enabled.

If you want to play with shaders on Vulkan, on either of the three platforms, the repository is here.

Thursday, June 15, 2017

Fresh System Install

This is primarily for my own records, but I think it's also needed for programmers to detail their *exact* setup so people can play along at home. Not so important on Linux (because Linux is a programmers OS, that stuff works really well), but utterly essential on Windows, where this time around I counted over half a dozen different distributions of *mingw* alone. Here you will find, what is in my opinion, the "best practice" method of getting my cross platform dev environment going. If you're watching my Voxel Project at all, this combined with the readme.md located there, will tell you *exactly* how to set up your compilers, covering *every single step* required to make it work. I write this today, because the instructions I wrote last time are no longer working. Lets see how long it lasts this time.

* Windows updated as of 2019-06-14
* Linux updated as of 2018-11-09

All OS's

google.com/chrome

Ubuntu 16.04.02

ubuntu-16.04.2-desktop-amd64.iso
Win32 Disk Imager - allows UEFI to work, on unix use "dd"

sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update
sudo apt-get install nvidia-410 vulkan-utils

# from Voxel Repo
sudo apt-get install a56 imagemagick git-core libglu1-mesa-dev libxi-dev ocl-icd-opencl-dev mingw-w64

sudo apt-get install clang vlc vim-gnome

# from GitHub
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
ssh-add
ssh-copy-id username@oldhost

Windows 10

Windows 10 USB Install Tool

All OS's Step 2


git config --global user.email your_email@example.com
git config --global user.name "your name"