Generating qudits with d=3,4 encoded on two-photon states