How do I make my camera go in ortho mode?


I need to know how to make me look in ortho mode using jme3…

Any idea how?

rootNode, render nor renderManager got any simular option :confused:

Have you tried camera.setParallelProjection() ?

Yea, didnt make any diffrence :confused:

Also, I tried to do a cube transparent with texture…

But just like pararellprojection, mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);

did Not work :frowning:

Idk whats wrong?!

I seen people saying these things works,

here on this forum, but it doesnt for me!

How come?

You need to attach your camera to the renderManager in ortho mode

renderManager.setCamera(cam, true);

the true is for ortho mode
that what i do to render a full screen quad

I am not sure I understand what exactly you're trying to do.

Are you trying to make a GUI, so you need ortho mode? Or do you want to have 3D elements without perspective?

Ahh okej!!

I did that now, but it doesnt work :frowning:

My code:


renderManager.setCamera(cam, true);;

Didnt work…

Oh and not really, Im not making a gui :stuck_out_tongue:

If I use 2D then rotating an image takes LOADS of cpu!

But in 3D, its not problem :smiley:

You still haven't told us what you were trying to do.

Ortho mode means different things depending on context. Are you trying to rotate images? In that case you can use ortho mode for Gui/2D, see the TestOrtho example in jme3.

Yea, 2D sorta :smiley:

The orthotest is not really what I want tho.

I want to create 3D objects, being able to use jBullet

and then set the camera to Orthoview!

So for example:

I have 10 cubes put in a row with a bit distance between them

I look from top-down view and see them all

What I see is 10 IDENTICAL cubes!

I do not see any side except the top, not even a little!

That sorta ortho I am looking for :slight_smile:

Okay, then parallel projection is what you're looking for. I tried it myself actually, and noticed that it won't work if the camera is already set in perspective mode.

Here's some code that sets correct parallel projection:

        float aspect = (float) cam.getWidth() / cam.getHeight();
        float size   = 1f;
        cam.setFrustum(-1000, 1000, -aspect * size, aspect * size, size, -size);

The "size" variable decides the size of the frustum, larger frustum size means objects will appear smaller on the frustum, while smaller frustum means objects will appear larger.
I also added a test to demonstrate capability of parallel projection.

Wheres the test?

Because for me, even if I make the fustrum 1000000

It doesnt change the size of objects… Weard…

Ahh, Size did it!

So now I got size 3.

But all objects disappear except a cube (the ground)

Is this some setting I gota reset?

Perhaps a setting to enable to render all objects?

Momoko_Fan have you tried that code?

Because for me, I'v modded this with all values possible.

All I get is the background, And sometimes a small flash of some of the objects…

Yeah I tried the code. There's some sort of issue with the frustum culling for parallel projection cameras. You can disable it for your rootNode using setCullHint(CullHint.Never), this might reduce performance a bit, but it will allow you to see all the objects. Later on I'll commit a fix and you would be able to remove that line.

I commited the test as well, btw.

That is awsome :smiley:

Thank you very, VERY, much :slight_smile: