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

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 ...


10

The PNG files are small because they are compressed. When the images are loaded into memory they are uncompressed and therefore take up more space.


9

Try changing the filterMode to Point: t.filterMode = FilterMode.Point;


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

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 ...


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

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 ...


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

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

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 ...


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 ...


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

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;


4

About a decade ago, GL_TEXTURE_2D_ARRAY wasn't widely available, people could only get an array of 2D textures using texture atlases. This means that people stored the data in a faily big 2D texture and when they wanted to fetch a texel, they offseted the texture coordinates with a function of the slice value (the "depth"). This worked well, since the 2D ...


3

Simple answer: the tool is right, this is proper behavior for a volume texture. Long answer: A volume texture is a 3D-texture in which mipmaps shrink in all three dimensions. So if you have a 16*16*16 texture, the next miplevel is 8*8*8, and then 4*4*4, etc, down to 1*1*1. If the dimensions aren't the same, then you still have each one (this is the same ...


3

Not exactly: texture arrays are declared in HLSL as Texture2DArray for Texture2D and not as an array of texture, so it is quite different. They are almost acting as a 3D texture, where the z is a slice of the 2D Texture (in terms of uv, it is the w dimension). The difference with 3D texture is that they are not supporting trilinear interpolation between the ...


3

So, you've probably read this: MipLevels Type: UINT The maximum number of mipmap levels in the texture. See the remarks in D3D11_TEX1D_SRV. Use 1 for a multisampled texture; or 0 to generate a full set of subtextures. Yay, DirectX is going to do the dirty work for once! Hah. The devil is in the details. How so? Well, it said it is going to ...


3

Resolved! effect.texture2d0.envMode = GLKTextureEnvModeDecal; It is related to the Texture Environment Parameters, i.e. how OpenGL combines the diffuse color of the material with the texture value. As described here: khronos.org/opengles/sdk/1.1/docs/man/glTexEnv.xml. If I'm right that GLKit instruction should correspond to: glTexEnvi(GL_TEXTURE_ENV, ...


3

It looks like you're applying way too much noise. You want to multiply the noise value by a small factor so it has a very small amplitude, corresponding to just a few pixels of distortion. Right now you're distorting it so much that every pixel is being sent to a completely different location in the texture, just making a hash of the whole thing. Also, ...


3

A simple method using only Photoshop: Crop the image vertically to remove anything that should be below the horizon (ie. not part of the sky dome) Scale up the height of the image to make it square Filter -> Distort -> Polar Coordinates


3

No can do; the format and array size are both members of the D3D11_TEXTURE2D_DESC structure, so an ID3D11Texture2D will always have the same format for any value of array size. Depending on how you use the texture, you could create different shader resource views specifying subranges of the full array, provided the SRV format is compatible with the texture ...


3

This is expected behaviour. If you look over your code, you'll see that you're getting a new texture name, binding it, then calling glTexSubImage. The problem here is that when you call glTexSubImage the texture does not actually exist yet. Textures are not created by glGenTextures; all that glGenTextures does is give you a free texture object name for ...



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