SQL Server Configuration on Multiple Instance Server
Resource governor is your best best if you really need to restrict resources for each instance, although if that is your major concern, I would just avoid stacking multiple instances.

If splitting resources isn't a big concern, I would configure total memory no more then 36GB, so 16GB per instance is fine. I would still configure 8 tempdb files for each instance, and would probably set max dop to around 6, to be tested against the work load.

This makes sure neither instance, or the OS is unable to get the memory it needs, but by configuring the maxdop higher then half the cores, it will allow processes to use more then 4 cores if available, while still not allowing a single process to dominate the entire machine.

I would still allocate 8 tempdb files to the instance, because without something in place to provide a hard restriction, sql server will still be able to access all 8 cores, and could potentially generate 8 simultaneous tempdb requests.

One other thing I would verify, is that if this is running on sql server standard edition, that your VM is configured with no more then 4 sockets regardless of the number of cores.  Sql server will restrict the cpu usuage to 4 sockets, and if you use single core cpus, you could wind up with both instances trying to share the first 4 CPU's, while the other 4 are left idle.