Transparent png import in Grasshopper

Hi everyone,

I have to import a transparent png file in grasshopper. I used the “Import Image” component, and locally set one existing file.
When I import the image directly in Rhino, no problem, the background is transparent, but when I import in Grasshopper, the background becomes black. I need it imported via gh so I can place it right in my model.

Thank you.

Balthazar


Would be good to see some files.

Indeed.

png import fail.gh (4.9 KB)

Those are two completely different things.
On rhino the image is imported as a surface with pre-applied material, and the material uses the original picture as texture.

On grasshopper the “Import Image” component outputs a mesh with colored vertexes! (much heavier process)
You can cull the vertexes of the mesh by a color… as it seems that alpha channel is lost, you can use black (hoping it is not used in the picture itself).


mesh_cull_vertexes_by_color.gh (10.2 KB)
(Added a c# version of the same culling … it is faster)

Note that working with meshes in this way can slow down everything… huge amount of points.

Probably there are better methods to implement actual texturing withing grasshopper…

1 Like

Thank’s a lot for clearing things up! I didn’t know it was creating a mesh… This solution is unfortunatly still too heavy for what I have to build, maybe i’m missing on something obvious.

How would you do if u had to represent approximately 6000 shrubs (grapevines) placed at specific spots determined in grasshopper ?

Is there anyway to use the surface with material in grasshopper ?

Different model/texture each other? Or just different position/orientation/scale?
If the latter, create one/some block in rhino and use grasshopper to place new instances on the rhino file. There are plenty of plugins to handle blocks. I can’t advice one in specific as i don’t use block even on rhino…

Thank’s a lot ! using blocks worked fine, I used Elefront plugin.
I actually used 4 different images and applied a random rotate and scale.

Have a good day and thank you for your help !

1 Like