jerome Posted June 18, 2015 Share Posted June 18, 2015 Hi, Say I have a mesh with a material and this material is textured with an image.I can obviously set the material.alpha property in order to make my mesh transparent.mesh.material.alpha = 0.6;Now, if the image used for the texture has an alpha channel and I want to apply it on the mesh, I can set it with : mesh.material.alpha = 1.0;mesh.material.diffuseTexture.hasAlpha = true;This will let transparent all the parts of the image with related alpha values. I'm just wondering if we could add/combine an extra alpha value to set the alpha of non-transparent parts of the image (as we do with material.alpha = val; ). Well, this would affect all the image pixels of course but the result would just be visible on parts non yet transparent. Quote Link to comment Share on other sites More sharing options...
RaananW Posted June 18, 2015 Share Posted June 18, 2015 Works great. Load material "mat_784764" here - http://materialeditor.raananweber.com/. Setting alpha makes the non-alpha parts of the texture be transparent. Quote Link to comment Share on other sites More sharing options...
Temechon Posted June 18, 2015 Share Posted June 18, 2015 Hi Jerome, With an opacity texture ? http://www.babylonjs-playground.com/#1MFDDU#2 Quote Link to comment Share on other sites More sharing options...
jerome Posted June 18, 2015 Author Share Posted June 18, 2015 I was not clear.Here is your modified example : http://www.babylonjs-playground.com/#1MFDDU#3 Now I would like to give an alpha value to the tree leaves, make them slightly transparant Quote Link to comment Share on other sites More sharing options...
RaananW Posted June 18, 2015 Share Posted June 18, 2015 like this? http://www.babylonjs-playground.com/#1MFDDU#4 Quote Link to comment Share on other sites More sharing options...
jerome Posted June 18, 2015 Author Share Posted June 18, 2015 thank you !seems to work as I can see the box through the leaves : http://www.babylonjs-playground.com/#1MFDDU#5 but can we set this alpha value then ? [EDIT] spoke too fast : material.alpha does the job http://www.babylonjs-playground.com/#1MFDDU#6 Thaannnnks you both guys Quote Link to comment Share on other sites More sharing options...
jerome Posted June 19, 2015 Author Share Posted June 19, 2015 what exactly does the getAlphaFromRGB from a png image ?I just can't see the difference with or without it ... Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 19, 2015 Share Posted June 19, 2015 This parameter is only used for OpacityTexture where alpha could come either from Alpha channel or from luminance computed from RGB Quote Link to comment Share on other sites More sharing options...
jerome Posted June 19, 2015 Author Share Posted June 19, 2015 oki doki so mesh.diffuseTexture.getAlphaFromRGB is a non-sense Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 19, 2015 Share Posted June 19, 2015 At least it has no effect Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.