How to place Transparent glass over human body..idea request

stances

Any idea how to get this done in processing. I can load the human figure as an .obj file but to get the transparent slab of glass to be

  • Frontal
  • Sagittal
  • Transverse

As seen in the image. Any ideas?

i not have a good 3D object, but start easy:

float ang = 0;

void setup() {
  size(400,400,P3D);
  noStroke();
  hint(ENABLE_DEPTH_SORT);
}

void draw(){
  background(200,200,0);
  translate(width/2,height/2);
  rotateY(ang);
  fill(0,0,200,50);
  rect(-100,-100,200,200);
  rotateX(2*ang);
  fill(200,0,0);
  box(40);
  ang +=0.01;
}

Thanks so much. I take it enabling the depth sorting helps considerably?

1 Like

I find that using OPENGL also does a nice job albeit the transparency is gone.

import processing.opengl.*;



float ang = 0;

void setup() {
  size(400,400,OPENGL);

  noStroke();
 // hint(ENABLE_DEPTH_SORT); //enables the effect
}

void draw(){
  background(128,128,128);
  translate(width/2,height/2);
  rotateY(ang);
  fill(0,0,200,50);
  rect(-100,-100,200,200);
  
  rotateX(2*ang);
  fill(200,0,0);
  box(40);
  
  
  ang +=0.01;
}

sorry, while

OPENGL is deprecated

i actually not know if there could be differences to P3D already??

Yes I prefer Processing 1.5.1 version as it has some great features that the new versions deprecated like you said.

sounds like a misunderstanding,

anyhow if you work with other than current version better tell us in your topic?

Hello,

The posted code runs the same with P3D as the renderer; in this case OPENGL is replaced with P3D.

Some insight into what Processing is doing behind the scenes here:

I clicked on OPENGL to show the warning:

Some additional references related to OPENGL:
https://github.com/processing/processing/wiki/Advanced-OpenGL
https://github.com/processing/processing/wiki/Advanced-OpenGL-in-Processing-2.x
https://github.com/processing/processing/wiki/OpenGL-Issues

https://processing.org/reference/environment/
https://processing.org/tutorials/rendering/
https://processing.org/tutorials/p3d/
https://processing.org/tutorials/pshader/

:slight_smile:

1 Like