Posts

How to Simulate and Render Blobs

Image
Hi everyone, It's blob time! This is a long one so buckle up. If you haven't been following along on my tweeter for the last month, I've been working on simulating and rendering blobs. Here's a dump of my progress (easily accessible from the hashtag #vectorboy64 ). I'll add some captions This first one is just me trying out position based dynamics and the constraint functions. PBD is a really cool way to simulate physics, and I'm really happy with how flexible it is and how easy it is to implement. I'm definitely going to use it for some other stuff in the future. position based dynamics with oscillating pressure and distance constraints #vectorboy64 (???) pic.twitter.com/ZOa6QLtndR — Kelly Jelly rebs your zankage and distunks you. (@pyromuffin) January 9, 2019 I spent a really long time trying to figure out the gradients of some tricky vector math formulas. I have them mostly correct, but there are still spurious rotations like this in the ...

How to implement Ballot() with DX11

Image
Hi, Today I will talk about a quick (slow) hack for getting some platform specific code working crossplatform. This is really about correctness, and not speed - I mean, otherwise the shader code wouldn't run on windows anyway. This hack won't be necessary once we can switch over to DXC - Microsoft's new shader compiler with shader model 6.0, but for now, that's out of reach. from GPUopen... though I'm pretty sure this isn't actually what it does. In order to explain what the function Ballot() actually does, I need to first take a little diversion to explain GPU hardware. GPU SIMDs The way a (modern, discrete) GPU works is that it executes instructions WAVE_SIZE (64 on AMD and 32 on Nvidia) at a time, all in lockstep. An easy way to think about it is that a set of WAVE_SIZE threads all share one instruction pointer. A group of WAVE_SIZE threads all located on a single SIMD is called a wave (or warp, using NV terminology). The cool thing about...

Rotating a vector using integer math

Image
Hello, Today's galaxy brain idea is to use integer math to do arbitrary rotation about a point. Why? I can already hear you saying "We have very nice floating point units that are good at this already!" and I say, No thanks  to the floating point unit. They're all well and good, but converting between floats and ints is slow on the GPU, wasting a whole instruction and especially so when you want to do index calculations. Also consider that on newer versions of GCN, we have packed ops, but no packed float/int conversions. Also, also consider that GCN doesn't have scalar floating point ops, and if you want to do float math in a scalar context, you'll be issuing vector instructions with SGPR sources! If you are maxed out on VALU and want to offload some calculations to SALU, then you're only making your problem worse if you need to do floating point ops.  Think about the index rotation case: read in some integer index data, maybe a thread...

How to do nothing in HDR

Image
Hi, Today's post is about how to do nothing in HDR. That's just a clickbait way of saying I want to transform an SDR/SRGB gamma encoded (hereafter referred to as just SDR) image such that it appears like an SDR image after PQ encoding. The buffer you'll retreive from an SDR swapchain on windows is precisely that: an SDR/SRGB gamma encoded texture. Essentially, I want to press the button that turns on HDR and see nothing  happen. This is useful because maybe you want to toggle or lerp between SDR/HDR, so that you can compare the two. In the HDR Injector , I need to do this because once I've created the HDR swapchain, windows doesn't want to go back to the SDR swapchain for some reason . Also, I need to be able to sample parts of the SDR backbuffer to determine which parts had UI on them, or if color grading/tonemapping/post-processing occurred. Why is this even a problem? As I mentioned in my previous posts, HDR images are encoded in a different way tha...

How to render to HDR displays on Windows 10

Image
Hey! If you missed it, yesterday I wrote an artisanal blogue poaste about a tool I am working on called the HDR injector . Today, I will write about how to present an HDR image in Windows. Some of this will be a summary of the talk by Evan Hart at GDC 2018. There are three steps, which I don't think are explained anywhere, except maybe within these ultra-rare DX12 samples that I had to catch midair from a hot tweet. Set your swapchain effect to DXGI_SWAP_EFFECT_FLIP_DISCARD . Emphasis on FLIP. The GDC talk above seems to think this isn't 100% required, but I couldn't get any HDR working without it. Set your swapchain buffer format to an HDR compatible backbuffer format. The ones that work for me are:  DXGI_FORMAT_R16G16B16A16_FLOAT and  DXGI_FORMAT_R10G10B10A2_UNORM , though I expect other formats might work. I haven't tested all of them. Depending on which format you picked in ( 2 ) you need to select the correct color space. If you  selected RGB...

HDR Injector

Image
Hi, friends. It's been about 3 years since my last blog post. A few things have happened in the mean time. I currently live in the SF bay (deep under the sea, biding my time) and work for Sony, doing PS4 graphics support. Cool. I'm not really going to talk about that today - just a quick catch up for those of you playing along at home. I will talk about a little project I've been working on in my free time.  HDR basics Fast forward. We currently live in the year 2018: a time of incredible power. The planet glows with unnatural energies and we're able to channel these Occult Phenomena directly into our eyes via Highe Dynamick Range televison and monitor devices. The advantage of these devices is twofold: Enhanced brightness - things can be brighter, and show a more realistic range of brights/darks Wide color - you can show a wider range of colors. This is hard to describe if you haven't already seen it. It's astounding how good it can look. ...

Global Game Jam: Friendship is Tragic

Image
Greetings bros, antibros, and those not on the bro-spectrum. I did that global game jam thing! Check it out: http://globalgamejam.org/2015/games/friendship-tragic Aww yeah. I did this game jam at Gamenest in SF, which is totally not even a little bit close to where I live in LA. It's only an 8 hour bus ride. That's fine for a weekend trip, right? Totes. This is the best game jam I've done so far. Probably because it was the least ambitious, and therefore the most polished. Also, I suspect you won't be able to figure out how to play the game because there is no explanation, rules, or instructions! Fantastic! BONUS FLUID SIM VID: Infinity Ward? Yeah, it's a pretty sweet job. I'm doing my best not to lose my indie cred, but it's hard. In my secret activision-owned-indie-free-time, I'm working on some sick ghost video game stuff. Did someone say PIXEL ART? NO? too bad. Rocks and floating platforms. Of course.