Copying/Modifying Surface Color Values
wowie
Posts: 2,029
Hi,
I wonder if anyone can help me. I'm working on a script based of Casual's mcjSpreadTex - https://sites.google.com/site/mcasualsdazscripts5/mcjspreadtex
I've modified it so it copies color values, which then can be applied to other channels. However, I want to some operations to it ie. clamp color to a minimal value of 32 rather than 0 and retarget colors above values (say, 255,192,128 to 160,120,80). I'm thinking retargeting is done by converting the values from RGB to HSV and then changes/clamps the colors to a value of 67. Is that possible? Or do I have to work with the original RGB values.
Thanks.
Comments
Once you have a
Color
object, you can get the HSV code from thergb
property.Then you could make adjustments to that value, then set it back:
I hope this puts you on the right track.
Thanks.
Will try it out.
here's the list of properties a Color has
if we're lucky, all those can be written to
i know r,g,b are numbers between 0 and 255
now lets see what 'value' is for full-intensity white
the answer is 255
now lets see if it can be written to
yes, it workks perfectly !
Yeah. I thought that's the way to go. Glad it worked and a lot less to write compared to doing it with RGB values. I'll try putting that into the script you've made.
OK just tried it and it works. I've also found 0.67 was too high. Had to be set to 0.6275 so max value of any color is 160.
Thanks Jacques!
Here's the edits I've made.
Just need to input the texture operations. Right now, it only works on colors.
Made some changes. Now instead of multiplying color values, it is now clamped so the max values are always 160 of the highest color value.
So, from this:
To this: