private void generateZBuffer(){
		Vector3D lightSourceCopy = lightSource.clone();
		if(rotate != null)	lightSourceCopy = rotate.multiply(lightSourceCopy);
		if(lightSourceRotate != null) lightSourceCopy = lightSourceRotate.multiply(lightSourceCopy);

		Transform t = Transform.identity();
		if(translate != null) t = t.compose(translate);
		if(rotate != null) t = t.compose(rotate);
		if(scale != null) t = t.compose(scale);


		for(Polygon pOriginal : polygons){
			Polygon p = pOriginal.clone();

			p.applyTransform(t);


			if(p.getNormal().z > 0) continue;

			int polyHeight = (int)Math.floor(p.getBounds().getMaxY());

			if((polyHeight+1+(this.height/2)) < 0) continue;
			EdgeListNode edgeList[] = new EdgeListNode[polyHeight+2+(this.height/2)]; //adjusts for centred image

			parseEdge(edgeList, p.vertex(0), p.vertex(1));
			parseEdge(edgeList, p.vertex(1), p.vertex(2));
			parseEdge(edgeList, p.vertex(2), p.vertex(0));

			drawToZBuffer(p.getShade(lightSourceCopy, intensity, ambience), edgeList);
		}


	}