# PShape with transparent texture issue

**URL:** <https://discourse.processing.org/t/pshape-with-transparent-texture-issue/23608>\
**Category:** Processing\
**Created:** [September 1, 2020, 5:07pm UTC](https://discourse.processing.org/t/pshape-with-transparent-texture-issue/23608 "2020-09-01T17:07:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![raron](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/raron/32/13651_2.png) [@raron](https://discourse.processing.org/u/raron)\
**Post date:** [September 1, 2020, 5:07pm UTC](https://discourse.processing.org/t/pshape-with-transparent-texture-issue/23608/1 "2020-09-01T17:07:21Z")

</div>

Trying to get texture with transparency on a PShape.

It seems some faces can’t see through to the face behind, but then apparently it still sees behind that again (background). Not to mention the texture is flipped on all sides, at least for the box shape (or perhaps just inside-out?).

I tried searching for it, multiple finds but they are all about the transparent objects themselves, not objects with transparent sides (that I found at least).

Also found some [hint()](https://processing.org/reference/hint_.html) settings, but the only thing that changes the visuals (apparently) is the DEPTH\_MASK setting.

Demo: (Picture with transparency from [here](https://commons.wikimedia.org/wiki/File:Processing_3_logo.png), I used 240px version).

```auto
/** Texturing tests

  hint test method from
  https://discourse.processing.org/t/program-to-test-hint-with-transparency/4361
  
  Image (used 240px version) from
  https://commons.wikimedia.org/wiki/File:Processing_3_logo.png
*/
import peasy.*;
PeasyCam cam;

PImage tex;
PShape someShape;

boolean b[] = { true, true, true };

void setup()
{
  size(600, 600, P3D);
  avoidClipping();
  cam = new PeasyCam(this, 0, 0, 0, 200);
  cam.setMaximumDistance(1000);

  tex = loadImage("240px-Processing_3_logo.png");
  someShape = createShape(BOX, 150, 100, 100);
  someShape.setTexture(tex);
}

void draw()
{
  background(32);
  cam.beginHUD();
  fill(220);
  text("DEPTH_TEST " + b[0], 20, 20);
  text("DEPTH_SORT " + b[1], 20, 40);
  text("DEPTH_MASK " + b[2], 20, 60);
  text("<- use the mouse to toggle settings", 180, 40);
  
  image(tex, 300,100);
  cam.endHUD();

  shape(someShape);
}

void avoidClipping() {
  // avoid clipping (at camera): 
  perspective(PI/3.0, (float) width/height, 1, 1000000);
}

void mousePressed() {
  int id = mouseY / 20;
  if (id < b.length) {
    b[id] ^= true; // same as b[id] = !b[id]
  }
  hint(b[0] ? ENABLE_DEPTH_TEST : DISABLE_DEPTH_TEST);
  hint(b[1] ? ENABLE_DEPTH_SORT : DISABLE_DEPTH_SORT);
  hint(b[2] ? ENABLE_DEPTH_MASK : DISABLE_DEPTH_MASK);
}

```
