Tag Info

Hot answers tagged

5

For one, nearest-neighbor will result in pixel perfect scaling only if it's used to upscale in integer multiples. Apart from that, you should not be conducting any scaling operations on your view/projection matrices. If you set your view to match the dimensions of the screen, and your projection matrix to be orthographic with dimensions that match the ...


3

You have only two main options, both of which have serious pros and cons: Use normalized positioning, so that the X and Y coordinates are expressed effectively as a percentage of the available width and height. Use absolute positioning, so the X and Y coordinates are exactly the pixel or point coordinates of the sprite on the screen. Relative positioning ...


2

You need to average the sprite pixels which are visible beneath each screen pixel. The sprite pixels can be sampled "nearest", but to move smoothly in subpixel increments on the display, you need some kind of oversampling. If you're using OpenGL, you can do this in your shader by averaging 4, or 9 or more sprite samples offset near each fragment (calculated ...


1

From my understanding a spritefont is essentially a collection of sprites where each letter translates to a coordinate on a spritesheet, such as the following: You can do this manually, of course, but it would be a pain to check each coordinate. You can use BMFont to do the conversion for you, which creates an image such as the one above, followed by an ...


1

You'll want to look into pixel-art upscaling filtering algorithms (http://en.wikipedia.org/wiki/Image_scaling). These have been specifically designed to upscale pixel art, having the properties of (1) retaining the original color palette (aka. no blurring) and (2) removing jaggies (aliasing that occurs due to nearest neightbour sampling). Some names of ...


1

Here's how I've approached this situation in Unity in the past: I create a custom shield shader that accepts some number of vector parameters (typically 3 or 4), each representing a recent hit. The xyz components are the position of the hit in local coordinates, and the w component is the intensity. Within the fragment shader, I compute the object-space ...


1

Unity colors have 4 float values typical of many color formats RGBA, corresponding to the individual percentage color values Red, Green, Blue and the Alpha transparency channel. Also as mentioned above the default "Tint" applied by Unity is a multiplicative shader Photoshop calls this effect "Multiply" and the process is literally multiplying the color ...


1

Try sprite.setOriginCenter(); This should help


1

"Which of these options is better from a practical point of view?" I'll interpret the word "practical" here to be distinct from "theoretically highest performance on a computer"... At two triangles per sprite, recomputing all the vertices on the host CPU will be not that expensive, & easy to think about. Or, since all the geometries are the same (two ...


1

You aren't limited to having only one MVP per VBO. So you would not in fact need to update the VBO every frame just because you stuff all of your sprites into a single VBO. What I do is store an instance ID with each vertex, which changes only on a per-model basis, and use those instance ID's to index into a uniform array of mat4's, one for each "instance."



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