Tag Info

Hot answers tagged

46

This looks like the bottom layer of a volume texture that many games these days use to perform color correction. The idea is that the final RGB screen color, after rendering and tonemapping, is used as a texture coordinate to index into this texture, and the color found in the texture replaces the original color. This allows artists to arbitrarily modify ...


15

We have a similar case with our RTS Remake. All units and houses are sprites. We have 18 000 sprites for units and houses and terrain, plus another ~6 000 for team colors (applied as masks). Long-stretched we also have some ~30 000 characters used in fonts. So the main reason behind atlases are: less wasted RAM (in older days when you upload NPOT to GPU ...


15

The zip-format supports several different compression algorithms. You can use a different algorithm for each file in the archive. When you want to store already compressed files which do not benefit from additional compression (like PNG) in a zip-archive, you can encode these files with the "stored" algorithm which doesn't compress at all. The "Add to ...


14

Since you've asked for experiences, here are mine. Back in the days when I was programming PS2 games, the "layered alpha quads" approach was a way that we often implemented fog. Occasionally as ground fog, but much more commonly as full-screen fog. And it worked just fine in either case. So yes, it was viable in the pre-fragment-shader days. Well, sort ...


9

The problem with using texture atlases and adjacent texels leaking has to do with the way linear texture filtering works. For any point in the texture that is not sampled exactly at the center of a texel, linear sampling will sample 4 adjacent texels and compute the value at the location you asked as the weighted (based on distance from the sample point) ...


9

One way to choose texture sizes is to have a target texel density relative to the size of an object. For instance, if you wanted 128 texels per meter, then an object 4 meters in size should have a 512x512 texture, an object 8 meters in size should have a 1024x1024 texture, etc. The same guideline can be applied to tiling textures as well. Another thing to ...


9

texelFetch is quite different from texture. texture is your usual texture access function which handles filtering and normalized ([0,1]) texture coordinates. texelFetch directly accesses a texel in the texture (no filtering) using unnormalized coordinates (e.g. (64,64) in the middle-ish texel in a 128x128 texture vs (.5,.5) in normalized coordinates).


7

Option #1: Split tubes into 2 parts, the tube and the rim. So that you stretch the tube to be as long as you need it and the rim part is always the same size. Option #2: Make the tubes to be always the same length and hide the ends behind the walls.


7

UV interpolation needs to take into account the depth of the vertices. You need to perform perspective-correct interpolation, which involves dividing by the w coordinate of the interpolated homogeneous vector. The "folded plane" effect of affine interpolation becomes more pronounced at wide FOV or when the camera is close to an object, but it's not ...


7

Don't worry about it. When the "deflate" algorithm used in .zip files encounters a block of data that's already well-compressed, like the pixel data of a .png image, it finds that it can't compress it effectively, and it will store it as literal uncompressed data. This takes very little overhead on the decompression end to copy out. ...


6

Displacement mapping can mean (but doesn't always mean) a vector displacement at each point on the surface. Height mapping implies only a scalar displacement value, i.e. each point gets pushed along its normal. The term "displacement mapping" can also be used for scalar displacements, though, so when vector displacements are discussed, people often ...


6

Well, technically speaking you can generate textures using any language. Even if you don't have any output on screen, as far as your language can represent integer/float (could get away with integers) and arrays, you are good to go. The problem though is that not every texture could be generated procedurally. You usually need a formula as a stating point to ...


6

It's easy to produce an effect like this in a pixel shader, using threshold animation. The idea is that you have a monochrome texture and apply a threshold value to it; wherever the texture is lower than the threshold, the material is colored, and where the texture is higher than the threshold the material is blank. You animate the threshold value from 0 ...


6

Basically, I think what you do is first of all create a tile for each of your terrain types that seamlessly tiles with itself. As you said there are many tutorials available on how to do this. Once you have those tiles, you can draw variants as well as transitions between different types of terrain by modifying copies of them. The only thing you need to ...


5

You never call glEnable(GL_TEXTURE_2D); to switch on texturing. And since you seem to use the fixed function pipeline that means that only the currently set color (which is white by default is used) to draw. As for why the texture dimensions are not printed correctly: the format specifier %f expects a 64 bit double value on the stack (floats are ...


5

I have a tangentially related answer in here, but the general idea is that, if you're loading and drawing textures at different times (you're not loading additional textures while you're rendering), then there are two places where what you do will affect your performance: Loading time: This is the moment where you upload your textures into memory. The ...


5

Multiple texture coordinates per mesh what is their purpose? Multiple texture coordinates set can be used to achieve different texture mapping per mesh, this helps achieve different visual effects that are otherwise hard to accomplish and may require multi-pass rendering. What scenario would these be present? For example Reflection mapping ...


5

I believe this is the line giving you trouble. position.Y = 455; The way you're doing this, the X component of the velocity is getting smaller. direction is always changing. Even though the distance is closing on the X axis, it stays the same on the Y-axis. So, when it's normalized, the Y distance is relatively greater, so X will get smaller. Something ...


5

Loading up DirectX (via SharpDX or XNA) to do the conversion is probably overkill. Why not simply decode the format on the CPU? It's simple enough. There is a DXT decoder in MonoGame you might be able to borrow. (In case the file changes, the latest revision at time of writing is here.) BC3_UNORM is equivalent to DXT5, which that will happily decode. ...


5

You might look into ImageMagick. It's open-source and contains code for resampling images using a variety of filters including Lanczos, Kaiser, Gaussian, etc. It can be used as a library linked into your code, and/or as a set of command-line tools you can call from shell scripts and suchlike.


5

The task is actually highly parallelisable on the GPU. Here is an algorithm that should work, assuming e.g. a 1024×1024 source texture ST. create a 256×256 render target, RT1 run a fragment shader that reads from ST and writes to RT1 and does the following: for each fragment in the render target get the (x,y) fragment coordinates sample 16 pixels from ...


4

Well S and T just mean U and V (or X and Y if you prefer), or in GLSL: vec4.xyzw == vec4.rgba == vec4.strq The GL_REPEAT mode has textures repeat when you go past (0,0) to (1,1) range The GL_CLAMP_TO_EDGE mode has textures stop at the last pixel when you fall off the edge. The GL_CLAMP and GL_CLAMP_TO_BORDER are depreciated because all texture borders ...


4

The problem with naively rendering a small scanline texture onto a large full-screen quad is that the texture will scale up, making what was a set of single-pixel scanlines in the texture much thicker, blurrier (depending on your interpolation method), and generally uglier. You should instead tile the texture across the quad in such a way as to preserve a ...


4

if( (NULL == strstr( (char const*)glGetString( GL_EXTENSIONS ), "GL_ARB_texture_non_power_of_two" ) ) ) //############ it points here ############// You are creating an OpenGL 3.2 context. glGetString(GL_EXTENSIONS) returns NULL because it has been deprecated in 3.0 and removed in 3.1. It was replaced by glGetStringi(GL_EXTENSIONS, i). See ...


4

Anisotropic filtering is used to diminish aliasing and blur effects of textures that are rendered in planes with angles not oblique (multiple of 90 degrees) in relation with the camera. In the shading pass you will be rendering the light volumes only, which don't have any texture attached to their geometry. Indeed, the only textures you will use are the ...


4

I've changed the shader according to the article suggested by Seth Battin. Now it performs perspectively correct quad texturing. Phew, bacon delivered: For the future generations that may never happen. The input is in a form of the line vertexes A1/A2, B1/B2 that creates diagonals (rather then sequential vertexes): public static Vector3 ...


4

Direct3D10 and Direct3D11 are very similar in terms of their API design, but 10 is a significant break from D3D9. No matter what you do you're going to have quite a bit of work ahead of you, because not only does the API surface change drastically, so to do many of the fundamental basics become more involved. The best way to protect yourself against such a ...


4

First of all, for every 3D vertex there is infinite tangent and bi-tangent vectors. The below image explains why there is an infinite number of tangent spaces for each vertex, the tangent and bitangent can have any direction in the shown plane. So inorder to properly calculate the most useful1 tangent space, we want our tangent space to be aligned such ...


4

Disclaimer: I haven't tried making a portal system, but I think this should work. From your description I gather that you are rendering the "portal camera" to a buffer then applying this buffer as the portal texture. This is what I would do for a security camera, but for a portal I think we can do something else. If you stick with this method though, then ...


4

For texture spaces, in Direct3D (0, 0) is top-left, in OpenGL (0, 0) is bottom-left. Therefore the v-coordinate will be upside down in one of these APIs. However, I wouldn't recommend negating the v-coordinate as this will only work if you're using a sampler with wrapping. You can fix the v-coordinate as follows: v = 1.0f - v;



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