Tag Info

Hot answers tagged

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


4

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


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;


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


2

No, there is not a simpler way. As you said, you must recreate all sampler objects that are affected by a change. However, it doesn't have to be a lot of work. Typically, you can share a few samplers across many shaders. I typically have a single sampler with trilinear/aniso filtering and repeat addressing, reused for textures across all shaders. If the ...


1

I have a 'full width UI' script that deduces the aspect ratio of the screen relative to some reference screen dimensions, and adds a scale to the transform to compensate for a change in aspect ratio. Then I build my UI to the reference screen dimensions (in my case 1024 x 768). At runtime, the actual screen width is asked for, and the adjustment ratio ...


1

Without seeing your code, it's hard to give on solid answer, but here's an idea that might help you: The tail always points away from the previous piece of the snake. If we see the last piece of the snake as the tail, then the one that comes before it gives the direction of the connecting end of the tail, and the opposite direction is then the direction of ...


1

It should be either from the image file itself, or from a shader which rejects all perfectly white pixels, or something like that, but since the shader isn't the simplest thing to implement, I'll bet it's the image file. I'll also bet you made or found this image with a white background, then tried to delete that white to make the background transparent. ...


1

You have to do two things here: Create a repeating sprite Mask it with the shape For the repeating sprite you will need a texture that has POT (Power Of Two) sides, e.g. 256x256. When you load your tiled texture you need to set its parameters to repeat: CCSprite* sprite = [CCSprite spriteWithFile:@"tiled_tex.png"]; ccTexParams params; params.minFilter ...


1

You need a couple of things here - Something that will randomly spawn things Some way of knowing where sprites already exist so you don't spawn there It looks like you have a handle on the former so I will cover the latter here. For unity sprites you have a component called SpriteRenderer from which you can obtain the size of a sprite: Vector2 size = ...


1

OpenGL provides blending function. glEnable(GL_BLEND);// you enable blending function glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // then you will set flags to achieve desired blending effect. For further different usage, read http://www.opengl.org/sdk/docs/man/html/glBlendFunc.xhtml However for your particular case, the desired effect, ...


1

As Ben suggested, you could use a dummy call to glTexImage2D(). If setting a 0x0 texture doesn't work, you should be able to create a 1x1 texture. I've seen the WebKit source code do something similar to "allocate" texture IDs, and then call glTexImage2D/glTexSubImage2D to upload the actual texture data later. Of course, it's up to the driver whether it ...


1

This is possible using GL 1.x and here's how. So as you've found using vertex colors, a smooth transition is where it blends the two colors. This is a called a linear interpolation, or a "lerp" for short. It can be generalized to any dimension by operating on the elements of the vector individually and indeed colors are treated like a lerp in 3D -- blend R1 ...


1

I do not believe that this is directly possible using OpenGL 1.x. If you're using OpenGL 1.3, you can use Texture Combiners to merge two textures together in various ways, and you can even specify different sets of texture coordinates for the two textures, but I do not believe it's possible to set different opacities for the different textures per vertex ...



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