combining 2d/3d code