Anyone Know Anything And Flattening A 3D Camera Render?

Anything libgdx related goes here!

Anyone Know Anything And Flattening A 3D Camera Render?

Postby BennettTristan » Tue Jan 07, 2020 1:12 pm

What I'm trying to do is make a 2D game engine for a retro topdown RPG but using all the benefits of a 3D camera.
The issue is that this tile very clearly looks printed onto a surface and isn't parallel around the edges anymore.

I swear someone once said to me that there is a way to remove the Z axis in camera rendering so although you're using a 3D camera is looks 2D but I can't remember the name of what he was talking about.10.0.0.0.1 192.168.1.254 hotmail.com


Anyone know what it might have been, or another way to make a 3D perspective camera render the image flat?
Last edited by BennettTristan on Thu Jan 09, 2020 8:21 pm, edited 1 time in total.
BennettTristan
 
Posts: 1
Joined: Tue Jan 07, 2020 1:00 pm

Re: Anyone Know Anything And Flattening A 3D Camera Render?

Postby shatterblast » Tue Jan 07, 2020 2:46 pm

I have never used PerspectiveCamera, but it might be worth a try. My only experience with such includes Blender for 3D. I think it could be possible to attempt a "fish eye" perspective from it.

I will feed one idea. You could use one Stage with a standard OrthographicCamera, where the Stage is shaped in such a way to fake 3D. You could make it look like it's at an angle by tapering the top edges and make the Stage larger than the Camera bounds. Mixing Polygon, like a rhombus, with the Stage would allow that. You would want the Stage larger than the Camera bounds.

You would need a SpriteBatch for the second part. You could maybe mix a PerspectiveCamera for a 3D-ish look if it works. This would rely on mostly transparent stuff, except for your visuals themselves. With this Stage and the PerspectiveCamera, you would need to render to a FrameBuffer. After that, you would process the FrameBuffer back into your primary SpriteBatch. If you get mass black from that, then you will need to make sure both filtering is on and use GL30, which does by default. Even though Android uses GL20, it enables the filtering by default as well. iOS also does I think. You can do all this within one cycle of the render() method.

Of course, the idea is experimental and might appear super wonky, but it should work. This assumes that PerspectiveCamera does what you want.

1) https://libgdx.badlogicgames.com/ci/nig ... amera.html
2) https://libgdx.badlogicgames.com/ci/nig ... uffer.html
Last edited by shatterblast on Tue Jan 07, 2020 2:57 pm, edited 1 time in total.
shatterblast
 
Posts: 653
Joined: Sun Jul 06, 2014 1:14 pm

Re: Anyone Know Anything And Flattening A 3D Camera Render?

Postby tomski » Tue Jan 07, 2020 2:56 pm

Perhaps you are talking about ortho vs perspective? https://docs.unity3d.com/ru/current/Man ... rview.html See the two screenshots here. In which case, you just use Ortho instead of Perspectivecamera
tomski
 
Posts: 913
Joined: Wed Jun 26, 2013 6:06 pm

Re: Anyone Know Anything And Flattening A 3D Camera Render?

Postby shatterblast » Tue Jan 07, 2020 2:58 pm

tomski wrote:Perhaps you are talking about ortho vs perspective? https://docs.unity3d.com/ru/current/Man ... rview.html See the two screenshots here. In which case, you just use Ortho instead of Perspectivecamera

Yeah, but he's talking about 2D. I just have no idea how PerspectiveCamera will treat 2D.
shatterblast
 
Posts: 653
Joined: Sun Jul 06, 2014 1:14 pm


Return to Libgdx

Who is online

Users browsing this forum: Majestic-12 [Bot] and 1 guest