设置透明度使纹理半透明
好的,所以我的问题是我在 java3d 中有一个平面,上面画有纹理。该纹理是具有 Alpha 透明度的 PNG。渲染场景时,平面上的纹理部分半透明,就好像整个图像具有一定的透明度一样。我尝试过各种纹理和透明度设置,试图让它发挥作用
Appearance ap = new Appearance();
TextureLoader tl = new TextureLoader(textImage);
Texture tex = tl.getTexture();
TextureAttributes ta = new TextureAttributes();
ta.setTextureMode(TextureAttributes.MODULATE);
TransparencyAttributes transat = new TransparencyAttributes();
transat.setTransparencyMode(TransparencyAttributes.BLENDED);
transat.setTransparency(0f);
ap.setTextureAttributes(ta);
ap.setTexture(tex);
ap.setTransparencyAttributes(transat);
shape.setAppearance(ap);
任何帮助将不胜感激
Ok, so my problem is that I have a plane in java3d that has a texture painted on it. This texture is a PNG with alpha transparency. When the scene is rendered the texture on the plane is partially translucent, as if it has some transparency over the entire image. I have played around with a variety of texture and transparency settings trying to get it to work
Appearance ap = new Appearance();
TextureLoader tl = new TextureLoader(textImage);
Texture tex = tl.getTexture();
TextureAttributes ta = new TextureAttributes();
ta.setTextureMode(TextureAttributes.MODULATE);
TransparencyAttributes transat = new TransparencyAttributes();
transat.setTransparencyMode(TransparencyAttributes.BLENDED);
transat.setTransparency(0f);
ap.setTextureAttributes(ta);
ap.setTexture(tex);
ap.setTransparencyAttributes(transat);
shape.setAppearance(ap);
Any help would be appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您不希望任何纹理有任何透明度,请尝试以下操作:
If you don't want any transparency at all for any of your texture, try this: