Hot answers tagged

14

You're thinking of paletting from a modern perspective. That is, you're thinking of palettes as a part of the image, with each image owning its own palette. In SNES-style hardware, palettes are global. You don't design your palette for your images, you design your images for your palettes. Well, it's a complex interplay between the two, but the needs of the ...


6

Another way to do this is to make a texture that maps each RGB to a colour on the palette, an image like this (from the NES colours): Then in a post processing shader you can the RGB colour from your regular image in a way like this: uniform sampler2d paletteMapping; vec3 mapColor( vec3 realColor ) { vec3 mappedColors = floor( realColor * 16 ); ...


4

Chroma key effect used for removing colors but you can change colors Instead of removing them. Chroma key compositing, or chroma keying, is a visual effects / post-production technique for compositing (layering) two images or video streams together based on color hues (chroma range). The technique has been used heavily in many fields to remove a ...


4

It seems like you want a variation mask for each sprite. This would entail creating a new greyscale image for each spritesheet, with the darkest values being on the parts of the sprite you want to change (here, Mario's clothing) and the lightest values on those you don't (here, his skin and eyes). In game, you can additively color the variation mask with ...


3

It took a little while to stumble across and my understanding of bit operations is limited, but this discrepancy appears to be due to the data loss suffered when converting values from 24-bit to 15-bit and back again. As described here. The relevant part of that article describes the conversion algorithm like so (where color is an integer in the range 0 - ...


2

As concept3d said, a pair of float4s means 8 components total (so half the size of a 16-component matrix), and you can just fit a rotation, translation, and uniform scale value into 8 components. (Although I would use a quaternion rather than axis-angle - that way no trig functions need to be used in the vertex shader to apply the rotation.) As for the "...


2

Encode world matrix as 2 float4s 2 float4 means 2 vectors, encoding these in two vectors is easy and is actually common. This can easily be done: axis/angle -> axis ( x,y,z 3 floats ), angle ( 1 float ). translate/uniform scale -> ( x,y,z 3 floats ), uniform scale ( 1 float ). Now decoding this is as easy constructing a 4x4 matrix from scaling, rotation ...


2

I'm not sure if this is what you have already tried, but you can simply get the Pixmap of the Texture and draw over it: texture.getTextureData().prepare(); Pixmap pixmap = texture.getTextureData().consumePixmap(); for(int i=0; i < pixmap.getWidth(); i++) { for(int j =0; j < pixmap.getHeight(); j++) { if(pixmap.getPixel(i,j) == colorToReplace) ...


1

I'd go with an MouseListener per JLabel. Make a custom subclass of MouseListener which is parameterized with the tileId (or whatever you are using to identify the tiles). Furthermore would not recommend using Swing for a game /mapeditor, we build a map editor using jmonkeyengine3 and Swing which is not working very well. You might want to look into JavaFX ...


1

I'm not familiar with Allegro, but a scan through the documentation turns up the following: al_draw_pixel void al_draw_pixel(float x, float y, ALLEGRO_COLOR color) Draws a single pixel at x, y. al_put_pixel void al_put_pixel(int x, int y, ALLEGRO_COLOR color) Draw a single pixel on the target bitmap. If you look at the source code linked from the ...


1

It appears like you are looking at the inspector of one of several subsprites of an image asset you imported with the "Sprite Mode: Multiple" setting and then sliced with the sprite editor. The second screenshot, however, appears to have marked several actual tile images, not the subsprites created from them. It appears like they are using a separate image ...


1

The easiest way to do this by using a tile palette or just resizing the image by not cutting it up. So you can change the image to Point (No filter) instead of Bilinear. After that you choose (Grid by cell size). Then you get a series of cut p parts (Also, you should probably choose a power of 2 or a multiple of two). Then click create, 2d, tile map. Then, ...


1

In modern OpenGL and for your specific use case - equally sized tiles in a texture atlas - you have the option of not actually using a texture atlas at all. Instead you would use a texture array, meaning that your texcoords for each tile are in the 0..1 range and flipping becomes trivial. You also gain the advantages of having wrap modes, clamp modes and ...


1

If your texture coords normally go from x0 to x1 then any given coordinate x between those values can be flipped by doing this: flippedX = x0 + (x1 - x);


1

Ok, i have modified the shader with the Load instruction suggested by @melak47, and now is working. Texture2D<float4> txPalette : register( t1 ); //-------------------------------------------------------------------------------------- // Pixel Shader //-------------------------------------------------------------------------------------- float4 PS( ...


Only top voted, non community-wiki answers of a minimum length are eligible