32 bits : how many colors ?

Blitz3D Forums/Blitz3D Beginners Area/32 bits : how many colors ?

RemiD(Posted 2015) [#1]
Hello,

Can anyone explain how many writable/readable colors there are in 32 bits ?
I suppose 2^24 or 256*256*256 = 16777216 colors

I want to be sure that with most computers (recent enough), each color is identifiable precisely from 0,0,0 to 255,255,255.

Thanks,


Floyd(Posted 2015) [#2]
32-bit graphics are 24-bit color, as you said, and 8-bit alpha.

I don't know how many PCs don't support 24-bit color. The high end machine I bought in 1993 did.


Yasha(Posted 2015) [#3]
In the highly unlikely event you actually find a machine that doesn't support 32-bit graphics, I think the idea is that the graphics context will fail to be created with that option, rather than lie to you about pixel values.


xlsior(Posted 2015) [#4]
I want to be sure that with most computers (recent enough), each color is identifiable precisely from 0,0,0 to 255,255,255.


You can do that on pretty much all computers sold within the past decade, and the vast majority of those sold since the late 90s as well -- but depending on what you're hoping to accomplish, be aware that regardless of what the video card outputs, some low-end LCD panels will actually display less colors than that -- some panels will automatically down-convert a 32-bit video signal to a 16-bit (5-6-5 bits) or 18-bit (6-6-6 bits) display mode, with some automated dithering and colorspace smoothing thrown in to hide the resulting banding.

Nothing you can do about that, though.


RemiD(Posted 2015) [#5]
@all>>thanks for the infos

@xlsior>>i plan to color different simplified meshes with different colors, set them to fullbright, then in the mainloop, hide all renderers, show the simplified meshes, define a small viewport, then render the scene with only the simplified meshes, then analyze the pixels of the image of the capture to check which simplified meshes are visible or not.
if each target (simplified mesh) is colored in one specific color, it will allow the bot to identify if he can see a target and which target it is.


Matty(Posted 2015) [#6]
Something to.be wary of with that method is that anti aliading coukd mess with.the.colors at the.boundaries and as far as I know blirz3d has.very poor control over the anti aliasing settings.


RemiD(Posted 2015) [#7]
Ok i have tested and it works but it is necessary to use simplified meshes in fullbright and to not use textures so that it is possible to know precisely what will be the color of each simplified mesh (obstacles or targets)


RemiD(Posted 2015) [#8]
Here is a demo of what i was talking about :
http://rd-stuff.fr/AI-light-capture-(sight)-201501131050EXE.zip

Each small image over each humanoid (white cylinder) represents the last capture of the environment that this humanoid has made (with the camera positionned/oriented at his eyes position/orientation and a small viewport of 100x75).

When you press the space key, it randomly selects a humanoid and makes a capture with the camera positionned/oriented at his eyes position/orientation.
(The last capture has a pink frame around it)

Before a capture is made, the lights are hidden, the obstacles are colored with a dark ambientlight, the targets (humanoids) are precolored with each a different bright grey color from 245,245,245 to 255,255,255 and in fullbright
Then the capture is made with renderworld().
Then the pixels of the image of the last capture are analyzed :
->"PixelsCount" represents the number of pixels which are identified has targets (humanoids)
->"ColorsCount" represents the number of different colors which have been identified (=the number of different targets)
Then with each identified color it is possible to retrieve what are the visible targets (humanoids)

"LCMsTime" represents the milliseconds time it takes to capture the environment with renderworld()
"RPFMsTime" represents the milliseconds time it takes to analyze the pixels of the image of the capture with readpixelfast()

Very cool and fast enough if i update only the capture of one bot per frame :)


Matty(Posted 2015) [#9]
A similar technique can be used perform pick commands on animated meshes. ...including md2s.