Tag Info

Hot answers tagged

47

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


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

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

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


4

glRotatef(GLfloat angle, Glfloat x, GLfloat y, GLfloat z); The Above function is what you need for your purpose. It " multiplies the current matrix by a rotation matrix", as the OpenGL documentation says. Here's how you use it- angle is the angle you want to rotate. (Duh.) The next three parameters define the axis around which you would like to rotate. You ...


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


3

A line is a list of connected points. For each point you'll need to calculate the X-Texture coordinate of that point, the Y coordinate will always be 0 for the upper point and 1 for the lower point. After you have defined how long one texture segment is you can do so by stepping through all the segments you have generated and noting how much distance you ...


3

You can convert .dds to .tga with a variety of tools, such as the command-line NVIDIA texture tools, the NVIDIA Photoshop plugins if you have Photoshop, or the image editor built into recent Visual Studio versions.


3

You absolutely can combine them! Many 3D games contain an image for the characters body and one for the head, and some combine the two for a single texture for the entire a model. Here's an example of a whole head's texture: Also check out this PDF if you'd like to learn more about texture mapping in general.


3

This effect can be achieved by drawing the blood in two layers. The bottom layer is the black border and the top layer is the red blood. Note that actual "layers" are not required, as long as the drops can draw in two phases, all black, followed by all red. Each droplet draws its shape as a black sprite. Then after all black shapes are drawn, they each draw ...



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