Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Question

Using UDK's material editor, I wish to use a texture as a two-dimensional array of values for mathematical computations (basically, the color components of each pixel in the texture alter the behavior of some transformations applied to another texture).

I want to retain rather precise color values for my mathematical operations to keep their meaning, but in my experiments I noticed a heavy distortion of the color space: dark colors are darker than they should be, and light colors are lighter than they should.

Additional information

This effect is best shown by the following material, which takes a simple linear gradient texture, and applies a rounding operation on the colors:

Gradient with bands of incorrect sizes

If the colors were correctly preserved, the preview on the left should have 10 bands of equal length (a black band, a 10% gray band, a 20% gray band etc. with each band being 10% of the width of the image), however the black band is huge, the next (10% gray) one rather large, and the bands get smaller and smaller as they get lighter.

In this example, I take the red channel of the image, but taking the other channels gives similar results: The red and blue channels are identical, and the distortion is slightly different with the green channel, and taking the combination of these logically produces small bands of purple and green between any two bands.

I guess this is a compression issue with the original texure, but I don't know which parameters I should change so the colors are preserved when I use the texture in the material editor.

Gradient texture

Above is the texture I used, created with The Gimp. The colors are correct, it is a linear gradient: the color of the pixels in column 0 is (0,0,0), the pixels in the column 255 are (255,255,255) and I manually checked at many points in the image that the pixels in the column x are (x,x,x)).

Texture properties in UDK material editor

Above are the properties for this texture. Nothing special here, just the defaults. Specifically, the Adjust Brightness Curve and Adjust RGB Curve properties are set to 1.0 (by default), which seems correct since they are the power to which the HSV and RGB curves must be elevated. The distortion I observed looks a lot like if the values were raised to a given power.

share|improve this question
    
Using TC_NormalmapUncompressed in the Compression Settings field of the texture properties, I manage to get my values correctly for the Red and Green channels (didn't test alpha), but the blue channel gets completely messed up. Isn't there just a simple "don't mess with my texture" compression setting ??? –  Georges Dupéron Jan 3 '13 at 22:51
    
What is the question? –  Alex Shepard Mar 4 '13 at 23:47
    
@AlexShepard The question is: "In UDK materials, when using a texture, dark colors are darker than they should be, and light colors are lighter than they should. How can I get the correct colors?", and the answer is "turn off the SRGB setting in the texture's properties". –  Georges Dupéron Mar 7 '13 at 17:03
    
You should write the question within the body and accept your answer. –  Alex Shepard Mar 7 '13 at 18:08

1 Answer 1

up vote 2 down vote accepted

According to UDN, the SRGB setting in the texture's properties has to be turned off (false) for normal maps and other textures that need exact values.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.