|
|
On 01/05/2024 16:05, Bald Eagle wrote:
> When I try it with that last peach color, using if(EvalPigmentColor =
> ExcelByteColor/255), it doesn't work.
ok, ok, I understand better the problem.
I quickly coded a test. The result (of little interest) is attached, but
I think the problem lies in the precision/tolerance of the calculations.
I defined the pigment like this (but you know this) :
#declare pigmentSize = 5;
#declare myPigment = pigment {
image_map {
png "excel rgb colors"
map_type 0
interpolate 2
}
scale pigmentSize
}
The purpose of the test is to give a greater height for pixels whose
color is peach. Several tries and it didn't work.
I created this macro, which compares the source color with the chosen
color, introducing a "tolerance" variable :
#macro CheckColor(thisCol, targetCol, tol)
((abs(thisCol.red*255-targetCol.red)<=tol) &
(abs(thisCol.green*255-targetCol.green)<=tol) &
(abs(thisCol.blue*255-targetCol.blue)<=tol) )
#end
Two variables:
#declare TargetColor = rgb <248, 203, 173>; // peach color
#declare Tolerance = 16; // this parameter is very very sensitive
In the image constitution, I retrieve the color of the source image:
#declare myRGB = eval_pigment(myPigment, <xIndex, zIndex, 0>);
If the color is close to the one defined, I make a higher box:
box {
<2*xIndex-steep, 0, 2*zIndex-steep>, <2*xIndex + steep,
0.05*(CheckColor(myRGB, TargetColor ,Tolerance)?10:1), 2*zIndex + steep>
pigment { color myRGB }
}
This is where the value of the tolerance variable is important !
With value lower than 16 (about 6%) here, there's no higher box.
The code looks bad :(
This "large" tolerance value causes artifacts to appear elsewhere in the
image.
Maybe it's the wrong way...
Can any of this help you?
--
Kurtz le pirate
Compagnie de la Banquise
Post a reply to this message
Attachments:
Download 'be.png' (163 KB)
Preview of image 'be.png'
|
|