Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 19 Jul 2006
Offline Last Active Sep 09 2015 07:20 PM

Topics I've Started

256 or 1024 color palettes/rotation (with 32bit color)

03 August 2015 - 09:37 PM

I'm trying to figure out how to use 32bit color display mode but still use something like an 8bit 256 color palette (or better 1024 color palette) so I can set very precise color gradients and do palette rotations and other effects with them.

[ie: 16 color shade gradients like for example: black to red, black to blue, black to yellow, ...... blue to white, brown to yellow, etc...]

My best guess so far is to use a shader to pick the closest colors - and perhaps have them calculate a color to match to based on how the original color gradients would be calculated. I want to do this to avoid white-washing, burn-outs and other color destroying artifacts from some other shader layers -- also I want it to look somewhat retro too (like Sega Genesis retro). 

Also I was hoping to do some palette swapping and rotation effects.


Anyway, all ideas - abstract, beginner or otherwise - are totally welcome. (^_^)

Released MeoMotion 2D Game Character Animator - Free

19 June 2015 - 10:46 AM

It was a hard decision, but I decided to freely release MeoMotion Animator for 2D distortion skeleton game character animation for games. It includes simple example source code for MonoGame (and XNA), SharpDX, DirectX11, SDL2, and OpenGL and editor allows consolidation of projects in exports.

  It has a simple interface and allows vertex distortions, and fade-blend animation overlays(for expressions), supports animated part-swapping, time-lined layer reordering, key-part isolated blending, control-z(although not 100% tested), etc..

It can be found here:




And editor tutorials are also available as video:



If people like it enough I will later try to add more features. Possibly IK, parametric interpolations, binary exports, and others...

SharpDX Shader Bytes - VertexShader accepts nothing

21 May 2015 - 05:36 PM

Using SharpDX - trying to use precompiled Shader bytes held by ShaderBytes as:


public byte[] spriteVSBytes = { ... tons of numbers ... }

Tried compiled shader bytes for versions: 2, 3, 4/4 lev 9_1 (not 5 yet) - compiled with fxc.exe and all these work in my DX11 c++ version


VS = new VertexShader(dev, shaderData.SpriteVSBytes); // <-- says SpriteVSBytes is invalid.



// GET DEFAULT SHADERS (from pre-compiled) - create vertex layout

ShaderBytes shaderData = new ShaderBytes(); // an object I made which holds precompiled shader bytes

ShaderSignature signature = new ShaderSignature(shaderData.SpriteVSBytes);

VS = new VertexShader(dev, shaderData.SpriteVSBytes);

PS = new PixelShader(dev, shaderData.SpritePSBytes);           

var elements = new[] {

    new InputElement(name: "SV_Position", index: 0, format: Format.R32G32B32_Float, offset: InputElement.AppendAligned, slot: 0, slotClass: InputClassification.PerVertexData, stepRate: 0),

    new InputElement(name: "COLOR0",    index: 0, format: Format.R32G32B32A32_Float, offset: InputElement.AppendAligned, slot: 0, slotClass: InputClassification.PerVertexData, stepRate: 0),

    new InputElement(name: "TEXCOORD0",   index: 0, format: Format.R32G32_Float,   offset: InputElement.AppendAligned,  slot: 0, slotClass: InputClassification.PerInstanceData, stepRate: 0),


vertLayout = new InputLayout(dev, signature, elements);


An unhandled exception of type 'SharpDX.SharpDXException' occurred in SharpDX.dll

Additional information: HRESULT: [0x80070057], Module: [General], ApiCode: [E_INVALIDARG/Invalid Arguments], Message: The parameter is incorrect.


... but the parameter should be correct. (O_O)

Honestly I want to like SharpDX but with lack of documentation and headache after headache, I'm almost ready the throw in the towel on making a SharpDX version. sad.png

Chaining Pixel Shaders

11 May 2015 - 06:44 PM

I have a bunch of pixel shaders and I'm wondering if I can keep them separate and chain them together based on what effect combination I need.

ie: pass a pixel output to another shader's pixel input (in another cso)


Also I'm wondering if anyone knows if there's any performance difference in doing this:




or this


dvc->PSSetShaderResources(0,1,tex1); // (only 2 anyway)


Visual Studio erasing source files during debug - createSwapChain

27 April 2015 - 07:18 AM

Using Visual Studio 2013 C++ - Windows_SDK 8.1 kit - DirectX 11, on Windows 7, GeForce GT 610 (works with DirectX 11)
Header files (and some unrelated text files) in my project folder are being erased - made blank after a crash which I narrowed down to being caused by:
If I don't include a call to this, the crash doesn't happen, no memory leaks occur, and none of my project files become corrupted or erased.
(I've been manually backing up the files since the autobak doesn't seem to be doing it - unfortunately I accidentally copy empty ones sometimes)
It doesn't return an error (it doesn't return at all) - the screen goes black and all input responses cease (including Alt-tab, Shift f5, windows message keys to shut down safely) -- then I reboot and find the project and debug texts are corrupted or erased to blank files.
I'm wondering if anyone has any advice on this. Any advice would be welcome. smile.png
If you are wondering, here's the code which leads to the freeze (maybe it's something with the description?) Also I'm wondering if setting the window display state could effect this?

 DXGI_SWAP_CHAIN_DESC swapChainDesc = { 0 };
D3D_FEATURE_LEVEL featureLevel;
HRESULT result;
if ((numerator == 0) || (denominator == 0)) { REPORT("illegal numerator or denominator"); return false; }
swapChainDesc.BufferCount = 1;
swapChainDesc.BufferDesc.Width = screenWidth;
swapChainDesc.BufferDesc.Height = screenHeight;
swapChainDesc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
if (vsync_enabled) {
   swapChainDesc.BufferDesc.RefreshRate.Numerator = numerator;
   swapChainDesc.BufferDesc.RefreshRate.Denominator = denominator;
} else {
   swapChainDesc.BufferDesc.RefreshRate.Numerator = 0;
   swapChainDesc.BufferDesc.RefreshRate.Denominator = 1;
swapChainDesc.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
swapChainDesc.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
swapChainDesc.Flags = 0;
swapChainDesc.OutputWindow = hwnd;
swapChainDesc.SampleDesc.Count = 1;
swapChainDesc.SampleDesc.Quality = 0;
swapChainDesc.Windowed = !fullscreen;
swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; 
UINT createDeviceFlags = 0, numDriverTypes = ARRAYSIZE(driverTypes), numFeatureLevels = ARRAYSIZE(featureLevels);
#ifdef _DEBUG
  createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;
#endif REPORT("Begin crashing:");for (UINT i = 0; i < numDriverTypes; ++i) {
   result = D3D11CreateDeviceAndSwapChain(NULL, driverTypes[i], NULL, createDeviceFlags, featureLevels, numFeatureLevels,  D3D11_SDK_VERSION, &swapChainDesc, &swapChain, &device, NULL, &deviceContext);
   if (SUCCEEDED(result)) { driverType = driverTypes[i]; featureLevel = featureLevels[i]; break; }    REPORT("reached even this point??????");
    // ...nope... (O__O) ... it hates me....
}REPORT("reached this point???"); // nope - it hates me if (FAILED(result)) {
   REPORT("CreateDeviceAndSwapChain FAILED"); return false;