As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [color]

Color is the visual perception of light by humans into named categories, commonly "red," "green," and "blue."

Filter by
Sorted by
Tagged with
1 vote
1 answer
460 views

Gameobjects disappearing when changing renderer.material.color

I'm generating an array of objects using this code: ...
Aurasphere's user avatar
0 votes
2 answers
3k views

Monogame - how to make a smooth color transition with Color.Lerp()?

I would like to know how to dynamically change a color. My code: ...
PowerUser's user avatar
  • 222
1 vote
1 answer
9k views

How to get a pixel color from a specific sprite on touch (unity)?

I have a 2 layers of a different sprites. How can i get a pixel color from lower sprite? I know how to get touch and world coordinates, but i have no idea what to do next. ...
What Ever's user avatar
7 votes
1 answer
803 views

Cycling through colors with the same brightness

Ok. So I have a game I am working on with a bunch of colored particles. Each of them gets their own color however they are all close to a specific shade. To explain that better I am using the HSV ...
J.Doe's user avatar
  • 289
-2 votes
2 answers
403 views

How do I properly combine the colors of different lights?

Let's say I have 4 light colors: (0.6,0.0,0.0), (0.0,0.6,0.0), (0.1,0.1,0.1), (0.1,0.1,0.1) And now I want to combine them properly. I can't add them together, ...
skprime's user avatar
  • 105
5 votes
3 answers
4k views

UI Text Won't Change Color in Unity 5

In Unity 5 on Windows 10, I try to change the text color from the Inspector and in scripts, but the color won't change. Here are some screenshots of my Text objects open in the inspector, with there ...
jasper's user avatar
  • 51
3 votes
1 answer
432 views

Is this converting from or to premultiplied alpha?

I found this code buried under some rocks: ...
jzx's user avatar
  • 3,795
3 votes
0 answers
171 views

Bitmap font engine: When is color modulation not supported?

I am developing a bitmap font renderer for a 2D game using SDL 2. (If it matters, I'm using Debian 8 "jessie".) I had planned on storing the glyphs as a grayscale image, translating gray levels to ...
Damian Yerrick's user avatar
4 votes
1 answer
2k views

How to reduce color space in a post-processing material in Unreal Engine 4

I'm trying to get an old-school Quake 1 look going in UE4. I am currently using this blueprint in order to get a retro style large pixel filter. In game (might need to zoom in to see the difference)...
Devan Buggay's user avatar
1 vote
1 answer
483 views

How do I make a 2D sprite flash green when tapped?

I have a sprite that is based on an image of a gray circle. When the user touches the sprite, I want the sprite to flash green, as in I want the circle to appear to turn green for 0.2 seconds. I tried ...
R. Rincón's user avatar
1 vote
2 answers
923 views

SDL_LoadBMP into glTexImage2D results in scewed colors

I read up on this but i can not find the error. Some suggest switching the format from RBA to RGBA but the surface data says it is 3 byte data. Here are snippets and results of my source. Loading ...
Johannes's user avatar
  • 113
2 votes
1 answer
415 views

Math behind XNA's spriteBatch.draw() color parameter?

I'm trying to make a shader that changes the color of a sprite the way the XNA spriteBatch.draw() color parameter changes color. I don't know exactly what it is called (the closest word I can think of ...
Quintin Steiner's user avatar
4 votes
2 answers
2k views

Color key or transparent images?

Ive seen a lot of people make sprite sheets magenta instead of transparent and then they make the magenta transparent using code. What is best (Performance) to use transparent images or use a color (...
user avatar
3 votes
1 answer
2k views

How can I use a lookup table for brightness and contrast?

Currently, I implemented a rudimentary brightness and contrast algorithm that changes brightness and contrast pixel by pixel. This was super inefficient performance wise and the algorithm looked a bit ...
Kala J's user avatar
  • 149
13 votes
8 answers
33k views

How to Color.Lerp between multiple colors?

I have found it rather difficult to find a solution to this in the Unity documents. Color.Lerp(Color a, Color b, float t) is a function that gradually changes a ...
Zee's user avatar
  • 922
0 votes
2 answers
82 views

How to determine areas of pixels of different colors or luminosities?

I want to create a program that determines all the areas of a given picture that have a different color, or the same color with different luminosities. Are there known algorithms that do this job ? I ...
user avatar
0 votes
1 answer
276 views

Is it possible to store diffuse and normal maps in the same texture area and preserve SRGB/linear space?

Usually, one would want to upload texture data to OpenGL with GL_SRGB* for the internalformat of a texture, and ...
ocharles's user avatar
  • 125
0 votes
1 answer
309 views

Why does RGB order differ between color formats?

On the reference page for SurfaceFormat, it indicates that the Bgra4444 format is an unsigned format which is 16-bits long, with 4 bits per color with alpha. ...
Kyle Baran's user avatar
1 vote
2 answers
4k views

Getting a color value from a coord

My goal is to get a RGB value of a pixel based of off a X,Y coordinate. I have been working on AIs for a small project attempting to make a bot that can pass through a maze. I want to get the pixel ...
Ryan's user avatar
  • 111
0 votes
1 answer
5k views

In Pygame, how can I check if an object is touching a color?

Is there a way to tell if a sprite is touching a specific color on the screen, maybe given as a hex code. I know you can do pygame.sprite.collide for sprites, but ...
pepper5319's user avatar
2 votes
0 answers
3k views

Easy way to set face colors with indexed VBOs?

I'm loading OBJs, which lend themselves well to setting up as indexed VBOs, since each vertex is only defined once and then a face definition will reference the same vertex more than once when they ...
winduptoy's user avatar
  • 131
2 votes
1 answer
501 views

How can I tint a Texture2D with a gradient?

I am working on a lighting system for my game. Instead of lighting each tile completely with only one color, I want to create a gradient on that tile so to make the lighting look more dynamic and ...
Zambonie's user avatar
3 votes
1 answer
4k views

How do I multiply two RGBA colours?

I have two RGBA integers. What procedure should I perform on them to return the multiplied colour? Do I need to split the RGBA integer into its component integers (R, G, B, A)? I'm using this for a ...
Shaun Wild's user avatar
-2 votes
1 answer
2k views

GLSL- How to change a certain color of a sprite, to another color passed into the shader?

There are sprites, with certain pixels being bright pink, and a shader dyes these pink or grayscale pixels to a custom color determined by the player. For example, a character looks normal except for ...
user50286's user avatar
  • 509
0 votes
1 answer
757 views

How to make it two seconds for Time.time?

...
Mark's user avatar
  • 1
33 votes
8 answers
6k views

Do complementary shadows make sense for games?

According to color theory, shadows work better if they don't use pure blacks or grays, but instead use a color that's complementary to the color of the object casting that shadow. That is, if you ...
congusbongus's user avatar
  • 14.8k
0 votes
1 answer
507 views

How does Texture2D.GetData return coloured pixels?

I'm trying to work out how the pixels are stored in the returned array but I'm not having a lot of luck (and thus my calculations don't seem to be working). I realize that the pixels are stored in ...
Scott's user avatar
  • 277
23 votes
6 answers
5k views

Algorithm to modify a color to make it less similar than background

I'm creating a demo of 20 balls bouncing each other, with a background filled with a solid color. Color for each ball is chosen randomly with randint(0, 255) for ...
MestreLion's user avatar
0 votes
1 answer
111 views

OpenGL strange rendering problem when buffers have different sizes

I have encountered a very odd error in my program, "odd" in the sense that everything the API says suggests that the error should not occur. I have a bunch of 2D un-indexed vertex data, and I want to ...
kevin james's user avatar
4 votes
1 answer
768 views

cost of texture change vs color change

How would I go about determining the difference in cost between changing the render color of an object every frame vice changing the texture (same sheet, just changing the source rectangle) every ...
David Torrey's user avatar
4 votes
2 answers
3k views

Palette reduction to pre-defined palette

I'm writing a bunch of GLSL effects for fun, but I can't wrap my head around this. Basically, I want to reduce a texture's palette into a pre-defined set of colors. For example, a post-processing ...
manabreak's user avatar
  • 1,048
16 votes
7 answers
4k views

What does the term "channel" mean when used in regards to computer graphics?

I was studying terminology for computer graphics, and this statement came up that confused me. The image can have alpha channels for transparency. I tried searching for the meaning of the term "...
Stync's user avatar
  • 311
14 votes
3 answers
3k views

How do I simulate color blindness for accessibility testing?

Is there an application I can download (or some configuration of Windows, or something) that will let me see how my game will appear to users with different color-blindnesses? There are already good ...
ashes999's user avatar
  • 11.3k
10 votes
2 answers
4k views

Is white the best base color to start with when planning to shade sprites within Unity?

I'm looking into prototyping a game in Unity which will consist of solid square sprites / tiles. I figure I can represent different types of objects with different colors for each of the tiles in the ...
SpartanDonut's user avatar
  • 2,937
4 votes
2 answers
1k views

Best way to blend colors in tile lighting? (XNA)

I have made a color, decent, recursive, fast tile lighting system in my game. It does everything I need except one thing: different colors are not blended at all: Here is my color blend code: ...
ben's user avatar
  • 117
2 votes
2 answers
6k views

What is the correct way to reset and load new data into GL_ARRAY_BUFFER?

I am using an array buffer for colors data. If I want to load different colors for the current mesh in real time what is the correct way to do it. At the moment I am doing: ...
Geto's user avatar
  • 157
9 votes
4 answers
9k views

Colorize with a given color a texture

I have a texture and I want to "colorize" it with a given color, lets say cyan (#00ffff) or purple (#800080). What I want to do, ...
Pacha's user avatar
  • 439
2 votes
2 answers
439 views

How can I read the color of a specific pixel in XNA?

I want a way to find out if, for example, the pixel at Vector2(2, 5) on the game window is color Color.Red, or some other color ...
ApachePilotMPE's user avatar
2 votes
1 answer
2k views

Why am I not getting an sRGB default framebuffer?

I'm trying to make my OpenGL Haskell program gamma correct by making appropriate use of sRGB framebuffers and textures, but I'm running into issues making the default framebuffer sRGB. Consider the ...
Aaron Rotenberg's user avatar
1 vote
1 answer
419 views

XNA 4: GetData from Texture2D and Set it into Texture3D with specific order

I am trying to convert my color grading 2d lookup texture into 3d LUT. When I simply use: ColorAtlas.GetData(data); ColorAtlas3D.SetData(data); I get this: I ...
cubrman's user avatar
  • 1,551
4 votes
1 answer
199 views

Problem building a color grading map

I am trying to build a default color grading map into a 1024x32 RenderTarget. Here is my shader code: ...
cubrman's user avatar
  • 1,551
4 votes
1 answer
2k views

When should I use color keying vs PNG transparency?

SDL (and other toolkits) can use color keying to make a certain color in an image transparent. Alternatively, you could load a PNG image that supports transparency. When should I use which?
user44066's user avatar
0 votes
1 answer
421 views

How to blend bullet sprite from white to yellow in libgdx

Does anyone have a clue that will make my bullet sprite fade from yellow to white? As the bullet is created it will be white but when it trails on it will turn yellow. Any ideas how? Is it a simple ...
G3tinmybelly's user avatar
0 votes
1 answer
599 views

Creating a gradient for a texture - Why is the color becoming dark on one side?

Updated While debugging I looked at the lerp and it was calculating into a negative number at the start. So I added in checks for to low or high a value, and that seems to have fixed it. I'll answer ...
Thraka's user avatar
  • 455
0 votes
1 answer
742 views

How do you calculate a gradient value within multiple colors (gradient stops)

In WPF/Silverlight XAML you can have a brush with multiple gradient stops at different points along the color line. I was able to replicate this behavior with two colors, a single color lerp, from ...
Thraka's user avatar
  • 455
1 vote
1 answer
741 views

How do I find two points at an angle on opposite sides of a circle?

With reference to my previous question: I'm using micklh's answer, which works perfectly. However, it calculates the gradient based on two points, a starting point and an ending point. I want to ...
Thraka's user avatar
  • 455
1 vote
2 answers
2k views

Sprite collision with color?

Is this possible? To elaborate, I am making a PacMan offshoot. Essentially it is a "zoomed in" version of the game, but the board is randomly generated. I have 11 .png files each to be used as a ...
Nick's user avatar
  • 11
2 votes
2 answers
81 views

2 Images, same object: tone difference and alignment

I would like to know a software which helps in post-production to calculate the general color/tone difference of 2 images. The images contain the same object, but arn't shot from the same position. ...
Markus Siebeneicher's user avatar
5 votes
3 answers
11k views

How do I create a color picker with variable hue and saturation?

I am trying to create a Color Picker similar to that of MS Paint. Unfortunately, I can't figure out the algorithm for saturation. This is what my current algorithm creates. Anytime I try to perform ...
Lemmings20's user avatar
0 votes
1 answer
269 views

XNA Float values don't work as parameter

With the Microsoft XNA Framework I can change the color of a tinted texture by changing it's integer values like so: ...
Anthonʎ's user avatar