Raised This Month: $51 Target: $400
 12% 

Converting colors (3 to 1)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Hellkong
Member
Join Date: Nov 2021
Old 03-15-2024 , 13:12   Converting colors (3 to 1)
Reply With Quote #1

As the title said,

The issue I don't know how to convert 3 values of colors to 1, let's say yellow ( R = 255, G = 255, B = 0), in the 255 one color value is 111 ( I didnt calculate this, I have a pic that has every value from 0 to 255).

I want to know how to calculate that.
Hellkong is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 03-15-2024 , 13:17   Re: Converting colors (3 to 1)
Reply With Quote #2

What? Rgb is 3 colors, red, green and blue. What do you mean 1 value? For rgb you always need 3.
__________________
Jhob94 is offline
Hellkong
Member
Join Date: Nov 2021
Old 03-15-2024 , 15:47   Re: Converting colors (3 to 1)
Reply With Quote #3

Quote:
Originally Posted by Jhob94 View Post
What? Rgb is 3 colors, red, green and blue. What do you mean 1 value? For rgb you always need 3.
Yes, I know, an example is best way to describe:

I am using random values to make random color to an entity (glow), and this chance we've got this value

PHP Code:
static Float:fColors[3]
fColors[0] = 255.0
fColors
[1] = 255.0
fColors
[2] = 0.0

set_pev
(Entpev_rendercolorfColors)
// And ofcourse render mode 
and I am using pev_colormap as well as one of the textures of the model has the flag, basically coloring the same color, the issue is pev_colormap is 0-255, one value... not three dimensions.
Hellkong is offline
WATCH_D0GS UNITED
Senior Member
Join Date: Jan 2023
Old 03-15-2024 , 16:19   Re: Converting colors (3 to 1)
Reply With Quote #4

Quote:
Originally Posted by Hellkong View Post
PHP Code:
static Float:fColors[3]
fColors[0] = random_num(0,255)
fColors[1] = random_num(0,255)
fColors[2] = random_num(0,255)

set_pev(Entpev_rendercolorfColors)
// And ofcourse render mode 
__________________
💻Know Our New Blog👄
🔗tube2downs.blogspot.com
WATCH_D0GS UNITED is offline
Hellkong
Member
Join Date: Nov 2021
Old 03-15-2024 , 17:04   Re: Converting colors (3 to 1)
Reply With Quote #5


You didnt get me, that was just an example of the color yellow, the issue is converting the 3 dimensions of the color values to 1 dimension so I can spawn the same color in pev_colormap

X value / 3 is not the solution for sure, it will give another color in pev_colormap.

pev_rendercolor = 3 dimensions RGB 0-255 0-255 0-256
pev_colormap = 1 dimension 0-255


Edit : correct, its random_float

Last edited by Hellkong; 03-15-2024 at 17:09.
Hellkong is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 03-15-2024 , 17:31   Re: Converting colors (3 to 1)
Reply With Quote #6

pev_colormap is not what you think it is
https://forums.alliedmods.net/showpo...01&postcount=7
__________________
Jhob94 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 03-16-2024 , 04:27   Re: Converting colors (3 to 1)
Reply With Quote #7

Search hue to RGB colors
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Hellkong
Member
Join Date: Nov 2021
Old 03-16-2024 , 08:43   Re: Converting colors (3 to 1)
Reply With Quote #8

I believe this is what I want, I've searched a bit and it's complicated maths, can you give me direct calculation?
I am using random RGB floats for each dimension.
Hellkong is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 03-16-2024 , 10:06   Re: Converting colors (3 to 1)
Reply With Quote #9

I already gave you the answer of how colormap works.
Watch this video, maybe it helps you understand what colormap does
__________________
Jhob94 is offline
Hellkong
Member
Join Date: Nov 2021
Old 03-16-2024 , 13:04   Re: Converting colors (3 to 1)
Reply With Quote #10

Here ya go a model I use for more clarification, spawn an entity with the glow render mode, make random color values and see how to figure out the same color :
Attached Files
File Type: zip box.zip (47.7 KB, 5 views)

Last edited by Hellkong; 03-16-2024 at 13:06.
Hellkong is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:39.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode