[libGDX] How many cameras can I create?

Is it ok to create multiple OrthographicCamera objects in libGDX?

Assume I’m trying to create a parallax screen with multiple layers. Each layer has it’s own happy story:

  • Far distant layer is showing us a sunset (5 sprites),
  • mid-layer contains a group of dancing gnomes at a party (50 sprites and animations)
  • and on front we have our Mario jumping on platforms (our game in action)

Is it a good idea to use one separated camera for each layer so I can imitate the parallax effect?
Isn’t it too heavy java object? Are there better solutions?

I really dont get why you would want to create several cameras for such a simple effect like parallax. Even if its not too heavy performance-wise, you would just over complicate your code.

I have a camera for every map layer, it makes it very easy to deal with parallax properly.
They are very lightweight objects, so no sweat !