If a game designer usse an image of an M4A1 ar, and a Glock and models the guns then put them into a game, can the designer be successfully sued, either by the gun maker or by the artist who created the images? What is the relevant law in such a case?
The image is almost surely protected by copyright. The model used in the game would probably be a derivative work of the original image. As such, permission from the copyright holder on the original image would be required. In the absence of such permission, the copyright holder could sue for infringement, and have a reasonable chance of winning. Whether such a holder would choose to sue cannot be predicted. It would depend on whether the holder ever learned of the infringement in the first place, whether it could be proven, and the degree of damages that might plausibly be claimed. It would also depend on the holder's attitude toward such circumstances.
In addition, the gun makers might claim trademark infringement. This would depend on how recognizable the guns are, and what trademarks the makers have secured protection on. If a logo is visible and recognizable, that would strengthen a claim by the maker. On the conditions described in the question, trademark infringement seems a bit unlikely, but exact details will matter in such a case, so one cannot be confident in any generic answer on that point.
There are 2 things at work here:
- copyright on the picture
- trademark on the look of the guns
Let's settle the two things part by part:
Is it likely to identify the picture(s) the gun was modeled after?
Let's say we model a generic AK-47. There are about 37-million hits of "AK-47 pictures" on google. Identifying that a specific picture was the source for the modeling is very slim unless the picture pictures a very unique gun, for example, a pink hello kitty design is rather more unique with just 3 million google finds (many of them references to the same object).
The chance to identify the original picture used to design a model is so slim, that it is probably unlikely that the maker of the photo could sue successfully.
Is it likely to get into a trademark lawsuit?
That is an entirely different Boat. Back in 2016, Electronic Arts was sued over the use of a helicopter look and feel by the manufacturer. They settled the case as far as I know, but this litigation was very expensive. The argument of the helicopter manufacturer was that "the attack helicopters were used as part of the main advertisements for the game and a core gameplay feature, making it not nominative use."
Glock is one of the hard litigators club, going after any company that produces items that look alike their guns - handling props, softairs, toys: they go after physical lookalikes. I would hold it not beyond Glock (who also have registered 17 active US trademarks for the use in pretty much all physical items, including the look of their guns), to go after a game that they see either using their guns for promotion or it how they don't want it to be depicted. For example, they might go after you if your depiction of the Glock would be unreliable or cheap, or maybe claims it is made fully of polymer or used by terrorists...
A sensible way would be to have a lawyer contact Glock to ask them for reference drawings and features that you should include for giving them a feature in the game. Be prepared that Glock might want to negotiate licensing fees in return.
I learned of a case where AMG sued Avtivision. The case got decided somewhat recently: The court applied the "Polaroid"-test and came to the conclusion, that no, it is not trademark infringement to not license the HUMVEE.
A point not made in the other answers is that it is impossible to copyright facts. So if the 3d model only represents the shape of the gun, the photographer whose work was used to derive cannot claim copyright over those aspects.
However 3d models often also include texture data in the form of pixel maps, typically derived from photographs. If this is done for the gun then it would be possible to show that the textures were derived from particular photographs and the derivative work argument would apply.
None of this applies to the manufacturer's rights of course.