Transparencies outside image boundaries with mixpict and colorpict (email copy)

Just for the record, I sent this email to the wrong address so I am copying
it again just in case it is useful for somebody else. I have also included
the original attachments.

Hi Greg,

Thanks for that. The tiling option with match is not what I was looking for
at the moment because I am using a site map, but I will keep it mind for
other projects. However, your suggestion about mixfunc was very useful,
although the result was a bit unexpected. The bits that were supposed to be
transparent were actually picking up the white plastic material receiving
bound_image as a modifier. If I changed it to red plastic, the background
of the image became red. It works for me, others should be aware of this
potential effect. On another note, I was trying to change void (second
material) for another material in mixfunc but I was getting an error. I
wonder why. Finally, I figured out how to make it work with rectangular
images. Thanks!

Victor

<img src=’/uploads/default/original/1X/327f71f83f24d44660239bc3202971f4fbd44cd8.png’ width=‘387’ height=‘302’>

Hi Victor,

Did you try replacing "pic_u" and "pic_v" with "match_u" and "match_v" in
your original description? If all you care about is avoiding the black
borders, this should give you a reasonable-looking result by tiling the
image over the terrain.

The other option is to use a mixfunc to clip to the edges of your pattern,
i.e.:

void colorpict image
15 clip_r clip_g clip_g image.hdr picture.cal pic_u pic_v
0
0

void mixfunc bound_image
4 image void "if(and(inside(0,pic_u,1),inside(0,pic_v,1)),1,0)" picture.cal
0
0

bound_image plastic terrain
0
0
5 1 1 1 0 0

···

------

This is assuming your picture is square. If not, then you need to adjust
the upper bound of pic_u or pic_v, whichever is larger.

Cheers,
-Greg

P.S. The double-quotes above aren't strictly necessary, but they allow
spaces in the formulas for readability if desired.

*From: *Victor LRG <[email protected]>

*Date: *September 28, 2017 2:20:29 AM PDT

Dear all,

I am trying to map an image to a terrain, but as the terrain is larger than
the image I am getting black borders beyond the limits of the image. I
thought about using mixpict to create a transparency but it is not really
working outside the image boundaries. I wonder if there is any other option
apart from cutting the terrain so it is smaller than the image. I have
provided details below.

Thanks,

Victor Lopez-Rioboo Gil

#Standard mapping (standard_mapping.png)
void colorpict image
15 clip_r clip_g clip_g image.hdr picture.cal pic_u pic_v
0
0
image plastic terrain
0
0
5 1 1 1 0 0

#Transparency test (transparency_test.png)
void colorpict image
15 clip_r clip_g clip_g image.hdr picture.cal pic_u pic_v
0
0
void mixpict mixImage
15 image void noblack image.hdr transparency.cal Px Py
0
0
mixImage plastic terrain
0
0
5 1 1 1 0 0

In transparency.cal I just have one line:
noblack(r,g,b) = if(max(r,max(g,b))-FTINY, 1, 0);

With this method I just manage to get two white bands (almost) outside the
image. It looks like the system is somehow mapping only within the limits
of the image in the two main directions.

Hi Victor,

You can mix between two materials (or a material and "void") or two non-material modifiers. You can't mix between a non-material and a material.

Glad you got it to work.

-Greg

···

From: Victor LRG <[email protected]>
Date: September 29, 2017 8:20:48 AM PDT

Just for the record, I sent this email to the wrong address so I am copying it again just in case it is useful for somebody else. I have also included the original attachments.

Hi Greg,

Thanks for that. The tiling option with match is not what I was looking for at the moment because I am using a site map, but I will keep it mind for other projects. However, your suggestion about mixfunc was very useful, although the result was a bit unexpected. The bits that were supposed to be transparent were actually picking up the white plastic material receiving bound_image as a modifier. If I changed it to red plastic, the background of the image became red. It works for me, others should be aware of this potential effect. On another note, I was trying to change void (second material) for another material in mixfunc but I was getting an error. I wonder why. Finally, I figured out how to make it work with rectangular images. Thanks!

Victor

------------------

Hi Victor,

Did you try replacing "pic_u" and "pic_v" with "match_u" and "match_v" in your original description? If all you care about is avoiding the black borders, this should give you a reasonable-looking result by tiling the image over the terrain.

The other option is to use a mixfunc to clip to the edges of your pattern, i.e.:

void colorpict image
15 clip_r clip_g clip_g image.hdr picture.cal pic_u pic_v
0
0

void mixfunc bound_image
4 image void "if(and(inside(0,pic_u,1),inside(0,pic_v,1)),1,0)" picture.cal
0
0

bound_image plastic terrain
0
0
5 1 1 1 0 0

------

This is assuming your picture is square. If not, then you need to adjust the upper bound of pic_u or pic_v, whichever is larger.

Cheers,
-Greg

P.S. The double-quotes above aren't strictly necessary, but they allow spaces in the formulas for readability if desired.

From: Victor LRG <[email protected]>
Date: September 28, 2017 2:20:29 AM PDT

Dear all,

I am trying to map an image to a terrain, but as the terrain is larger than the image I am getting black borders beyond the limits of the image. I thought about using mixpict to create a transparency but it is not really working outside the image boundaries. I wonder if there is any other option apart from cutting the terrain so it is smaller than the image. I have provided details below.

Thanks,

Victor Lopez-Rioboo Gil

#Standard mapping (standard_mapping.png)
void colorpict image
15 clip_r clip_g clip_g image.hdr picture.cal pic_u pic_v
0
0
image plastic terrain
0
0
5 1 1 1 0 0

#Transparency test (transparency_test.png)
void colorpict image
15 clip_r clip_g clip_g image.hdr picture.cal pic_u pic_v
0
0
void mixpict mixImage
15 image void noblack image.hdr transparency.cal Px Py
0
0
mixImage plastic terrain
0
0
5 1 1 1 0 0

In transparency.cal I just have one line:
noblack(r,g,b) = if(max(r,max(g,b))-FTINY, 1, 0);

With this method I just manage to get two white bands (almost) outside the image. It looks like the system is somehow mapping only within the limits of the image in the two main directions.

_______________________________________________
Radiance-general mailing list
[email protected]
https://www.radiance-online.org/mailman/listinfo/radiance-general