【问题标题】:Setting transparency makes textures translucent设置透明度使纹理半透明
【发布时间】:2010-09-25 17:13:10
【问题描述】:

好的,所以我的问题是我在 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);

任何帮助将不胜感激

【问题讨论】:

    标签: java java-3d


    【解决方案1】:

    如果您不希望任何纹理具有任何透明度,请尝试以下操作:

    TransparencyAttributes tAttr = new TransparencyAttributes();
    tAttr.setTransparencyMode(NONE);
    ap.setTransparencyAttributes(tAttr);
    

    【讨论】:

      猜你喜欢
      • 2016-03-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-26
      • 1970-01-01
      • 1970-01-01
      • 2021-11-01
      • 1970-01-01
      相关资源
      最近更新 更多