How does transparency work with meshes?

It looks like can set an alpha value for meshes that have no textures, but it doesn’t seem to do anything. I can’t see through the mesh. And if I put a texture on that’s just a png with transparency, that only sort of works, sometimes I see through it and sometimes not.

Is there way to just get a transparent mesh?

Thanks!

You should look at setRectColor in the docs. You can set the alpha/transparency there - just set the rgb values to 255 if you want it to not affect the colour and to only change the alpha. :slight_smile:

Transparency does work with meshes. But the triangles are rendered from first one to last one, in the table index order, and the transparency impact is computed only when a triangle is rendered, so for the next triangles it will be opaque. So the transparency will work perfectly if the triangles are rendered the farthest first, the closest last. This will depend on how the triangles are ordered in the vertice table, and where you have put the camera. Net result: Some time it will be ok and some time not. You can check that in my 3d tuto: http://JMV38.comze.com/CODEAbis/server.php#3D

Hey nice collection of code examples @Jmv38 - ok if I link to your site?

.@Reefwing you are welcome! Actually there is already a link to your site in this site.

Out of curiosity, is there a performance hit regarding transparency on meshes? I’m sure I did a test a while ago and the FPS did seem to drop a bit, even with a modest sized mesh. I’d have expected the GPU to eat this sort of thing for breakfast. I’ll try and reproduce this as a test if anyone’s interested.

I’ve noticed the fps with meshes is kind of a product of (number of screen pixels with something)x(complexity of the scene), so i think the transparency has an effect too.

Thanks jvm38!

Does anybody have his tutorial code lying around in their imported Codea projects?

The link is broken now: http://jmv38.comze.com/CODEAbis/server.php#3D

I’d like to put together a collection of the most impressive/helpful projects that have been posted here over the years, and this seems like it could be one.