Hello Forum. I am trying to render grass and other visuals similar to the method used in Minecraft and Zelda Ocarina of Time.
Normally in P3D the invisible part of the image renders over top of the the other images, and disabling the depth test causes the images to be seen through all objects.
I also have a distance sort method for the images but it only improves it a little bit.
Here are both of them in effect. In the second picture, images that are far behind the player are rendering on top of the player and other objects.
and the first one kinda speaks for itself.
The code:
class Decor {
PVector position;
PImage image;
float sizeX = 50;
float sizeY = 50;
float rot = random(TWO_PI);
Decor(PVector p) {
position=p;
}
void update() {
pushMatrix();
translate(position.x, position.y, position.z);
//rotateY(camAngle);
rotateY(rot);
image(image, -sizeX/2, -sizeY/2, sizeX, sizeY);
rotateY(HALF_PI);
image(image, -sizeX/2, -sizeY/2, sizeX, sizeY);
popMatrix();
}
}
Everything is PShape, PImage
Does anyone know how to fix this?