Color RGB on a texture

771
8
11-18-2019 07:22 AM
KennethLindhardt1
Occasional Contributor

Hi, is it possible you read a pictures combined RGB values. I’m trying to figure out a way to determine how light or dark a texture is, and I was wondering if I could do something similar like when you read the RGB values on for ex. A rooftop from the map layer?

 

Thanks.

0 Kudos
8 Replies
NicolaiSteinø
Occasional Contributor

Hi Kenneth, as I understand your question, I guess what you're after is the brightness value, which you can access through the brightness channel in the New map layer… > Obstacle / Mapping / Terrain dialogue window just as you access the red / green / blue and other channels.

Best,

Nic

0 Kudos
KennethLindhardt1
Occasional Contributor

Hi Nicolai, nice to hear from you again. No it’s not exactly what I need, but you are right, that I need the brightness channel I just need it on a completely standard .jpg texture like facade textures.

Thanks.

0 Kudos
CherylLau
Esri Regular Contributor

I don't understand exactly what you want, but I can say that it is not possible to access the RGB values in a texture image or the average brightness of the image from within CGA.

Nicolai's answer is the only way I can think of to access the RGB values in images.

0 Kudos
KennethLindhardt1
Occasional Contributor

Hi Cheryl. Thank you for the answer. Yes in this thought, I would need to access the texture  brightness information. It would be more a nice to have, than a need to have. If it was possible, it would be a step less to calculate urban heat island effect, since you would calculate the square meters of light and dark materials. 

0 Kudos
CherylLau
Esri Regular Contributor

That's a good use case.  Thanks for sharing.

If you have a texture in one layer and initial shapes in another layer, for each shape you could access the texture's RGB values by connecting rule attributes to layer attributes.  This would probe the texture at the xz location that corresponds to the center of the shape's scope.

However, if you have a texture that is used within a cga rule (for example, if you put it on a facade or any part of a generated model), you won't be able to access its RGB values in the middle of rule derivation.  This is what I was saying is not possible, which is, I think, what you want.

If you only care about textures that appear in the xz plane (e.g. roof), then one far fetched idea would be to generate your models with the texture, then convert them to shapes (so that they are in another layer called A).  Then, you can create another layer B containing shapes, where each roof is divided into multiple shapes (at your desired sampling resolution).  Then, the each roof shape in B can sample the texture by connecting through layer attributes to layer A.  But, this won't work for vertical facades, and it's a tedious workflow.

0 Kudos
DevinLavigne
Occasional Contributor III

Hey Kenneth. Hope all is well. Here is what I do for my roofs - I have taken several shingle textures into Photoshop where I have desaturated them and made them black and white. Then inside of CityEngine, I write the texture and the RGB value. This allows me to get many different roof colors with only one "texture". Is that what you are looking for?

0 Kudos
KennethLindhardt1
Occasional Contributor

Hi Devin. Yes everything is very well here, hope the dame for you. 

Thank you for your answer. 

No, I don't think it's it  

When we calculate urban heat island effect, I would like to look at 2 parameters. Light and dark material. 

The darker material the more heat it will produce. 

It's not the biggest issue, I was just curious. 

If you have fifty shades of red bricks and fifty shades of yellow bricks, it could just be nice if I could calculate if it would be categorized light or dark, from the brightness in the texture you use at material. 

It would skip one manual process. 

0 Kudos
AlanKlys
Occasional Contributor

Could you perhaps use python to determine image brightness and encode it into the filename of the images you are dealing with? Suggests he who is terrible at python   Not ideal but theoretically it would work for what you need.

0 Kudos