What would be the cheapest train between the two places for three people?
The problem here is that direct overnight train between Budapest and Venice was canceled a few years ago, so at the moment it's a bit more complicated to travel from Hungary to Italy. Nevertheless, there are a couple option which might be considered:
a) travel via Vienna (either with direct overnight trains from Vienna to Venice or daytime train+bus connection), in this case Vienna to Venice ticket can be purchased for as low as 29 euro per person (guide how to do it
http://europetrainsguide.com/Advice/How-to-Buy-Train-Tickets/Austria-OeBB.html), though since this fare is for the discounted tickets, which are in limited number per each departure, it is a good idea to buy such tickets in advance. Budapest to Vienna can be done for as low as 13 euro (guide on ticket purchase -
http://europetrainsguide.com/Advice/How-to-Buy-Train-Tickets/Hungary-MAV.html)
b) travel via Croatia and/or Slovenia. There is an everyday direct carriage from Budapest to Ljubljana (39 euro for one way ticket), though it arrives quite late, so you'll have to spend night in Slovenia and continue to Venice in the morning (either via Nova Gorica-Gorizia or Sezana-Trieste). Alternatively on July 25 there will be direct overnight train from Budapest to Ljubljana, ticket here will be a bit more expensive, but at the same time you can continue to Italy right away once you arrive to Slovenia early morning
c) travel by air. Might sound strange, but actually cheapest option can be to use low-cost airlines. First of all there is a direct RyanAir flight from Budapest to Venice-Treviso, then there is also RyanAir flight to Milan-Bergamo (from where you can easily catch cheap train to Venice), plus besides RyanAir travelers can use another low-cost airline - WizzAir, they fly from Budapest to Milan-Malpensa airport. So in total all these flights make almost an everyday cheap alternative to get from Budapest to Venice (even if it will require a few hour ride by Italian train, like from Milan/Bergamo to Venice). Though from out experience there is a small trick with purchasing tickets for low-cost flights in Europe - buying too early or too late can be rather expensive, so we would not recommend to buy now for July departure, it might be too early. Usually best prices is available 3-2 month in advance (however this observation is purely experiential, so we can't give you any guarantees)