Jump to content
Eternal Lands Official Forums
Sign in to follow this  
mikeman

Why not perspective projection?

Recommended Posts

I was looking at the camera code, and I was wondering, is there a particular reason why orthographic projection was chosen? Why not go for the more realistic perspective projection? Has it something to do with pathfinding or visibility tests as they're currently implemented?

Share this post


Link to post
Share on other sites

It's an 'Isometric' view.

 

I think that it gives the game some diversity compared to the plain old first person view.

Share this post


Link to post
Share on other sites

No, when I say perspective projection, I mean still a third-person view, but more "3D", with perspective, so that it feels you're inside a real 3D world instead of wathcing a chess board from above. Something like this:

 

http://img180.exs.cx/img180/8194/elproj9bg.jpg

 

I just think isometric view gives the game a little "outdated" appearance, but it's just my opinion.

Share this post


Link to post
Share on other sites
No, when I say perspective projection, I mean still a third-person view, but more "3D", with perspective, so that it feels you're inside a real 3D world instead of wathcing a chess board from above. Something like this:

 

http://img180.exs.cx/img180/8194/elproj9bg.jpg

 

I just think isometric view gives the game a little "outdated" appearance, but it's just my opinion.

Heh, that actually looks quite good. Certainly distorted but it could be amended :P

 

I see what you mean, and in this case I dont know. Im not a developer.

Share this post


Link to post
Share on other sites

Hmm, I like that actually :-)

 

My guess as to why this wasn't done is that it'd mean more work with all of the calculations involved.

Share this post


Link to post
Share on other sites

That does seem really neat! Although as placid mentioned, it's also distorted. If you can make it work, and Entropy agrees..I think we should give it a try :)

Share this post


Link to post
Share on other sites

I would argue that orthographic is still better for EL. EL is not seen from a person's perspective, which is what perspective projection attempts to do. If there was a first person view mode, then perspective would be appropriate. I don't think you'll be able to make it look "right" as an overhead/isometric view.

 

Just my opinion, of course, since I'm not working on EL anymore. Just thought I'd try to chime in since I'm finally learning 3d graphics (yeah I know, bad timing :) )

Share this post


Link to post
Share on other sites
I would argue that orthographic is still better for EL. EL is not seen from a person's perspective, which is what perspective projection attempts to do. If there was a first person view mode, then perspective would be appropriate. I don't think you'll be able to make it look "right" as an overhead/isometric view.

Not at all, you shouldn't confuse perspective projection with first-person view. I don't know much about MMORPGs, but most 3D strategy games have perspective projection in an overhead view. Simply put, perspective projection makes the objects that are further from the camera to look smaller, just like in reality. It is heavily used in first-persons because obviously there's no alternative for them, but you could as easily put a camera above the terrain.

 

The screenshot look distorted simply because I forgot to take into account the window ratio. Here's what is should look like more or less:

http://img132.exs.cx/img132/671/elp22oc.jpg

 

 

Btw, I'm not saying that I would do it, working on skeletal animation "eats" enough time for me right now. Just dropping an idea. If anyone decides to do it, he should also modify some other code too, like visibility tests and the like.

Share this post


Link to post
Share on other sites

Perspective view was considered, but then discarded because of the following reasons:

1. It's slower (more stuff in the frustrum, mipmap issues, etc.)

2. It's hard to terminate some maps (seeing blacknes in the horizon is not nice).

3. You see more ahead of you, which means the server should send players from further away, which means more bandwidth and more CPU wasted for the server.

Share this post


Link to post
Share on other sites
1. It's slower (more stuff in the frustrum, mipmap issues, etc.)

 

In today's day of GeForces and whatnot, performance really isn't an issue. However, I definitely could see wanting to make it an option, for just this reason.

 

2. It's hard to terminate some maps (seeing blacknes in the horizon is not nice).

3. You see more ahead of you, which means the server should send players from further away, which means more bandwidth and more CPU wasted for the server.

 

Add a fog effect that makes anything beyond a certain distance impossible to see, and cull at that distance. I've seen a lot of first-person and third-person games with very large landscapes do this, and it seems to be the "generally accepted" way.

Edited by roothorick

Share this post


Link to post
Share on other sites

In today's day of GeForces and whatnot, performance really isn't an issue. However, I definitely could see wanting to make it an option, for just this reason.

Then implement it. It's open source.

 

Add a fog effect that makes anything beyond a certain distance impossible to see, and cull at that distance. I've seen a lot of first-person and third-person games with very large landscapes do this, and it seems to be the "generally accepted" way.

 

The fog way is very hackish, and looks bad. I'd rather have a clean isometric projection, then a foggy perspective projection.

Share this post


Link to post
Share on other sites
In today's day of GeForces and whatnot, performance really isn't an issue.

Bullshit. That's the same thing people said when the 286 came out - and then they started to make bloated slow programs, and soon everything required a 386, which allowed even more bloat and even slower code, and a few years later even a 486 wasn't enough.

 

EL already once forced me to buy a new computer (including graphics card), because the maps got more complex, and my old graphics card which used to have 15-35 FPS would in some places go down to about 1 FPS.

Share this post


Link to post
Share on other sites

Leelo, EL is a little slow, but I really don't think it's because it pushes the envelope or reaches the graphics card to its limits(although it's very impressive what the developers have done so far with so little resources). I get higher framerates from HL2 and the difference between the quality of the graphics of the 2 games is enormous. I really think that if someone decided to seriously optimize the engine, the gain in performance would be huge. For instance, I see that it tests every object in the map to determine whether it's visible or not. More complex maps cause a linear drop in performance. Implementing a space partitioning method would eliminate that problem. Another example: today I found out that when rendering animated models, backface culling isn't even enabled. There are many things that can be fixed.

 

It's just the way it is: Gameplay is by far the most important factor, but today's games need good graphics.

Edited by mikeman

Share this post


Link to post
Share on other sites

I believe EL could use some optimization too. Who wants to do it? :blink: And I somehow got this idea that Cal3D might improve performance drops related to lots of people on the screen at once.

 

What I'm arguing against is the "640K will be enough for anybody" mentality, that some people seem to have, when they want to add every possible slowdown that might look just a little bit good ("Performance really isn't an issue" - yes it is).

Share this post


Link to post
Share on other sites
Bullshit. That's the same thing people said when the 286 came out - and then they started to make bloated slow programs, and soon everything required a 386, which allowed even more bloat and even slower code, and a few years later even a 486 wasn't enough.

 

EL already once forced me to buy a new computer (including graphics card), because the maps got more complex, and my old graphics card which used to have 15-35 FPS would in some places go down to about 1 FPS.

There's two distinct sides of the coin, and you completely missed one of them. Computers are getting faster and faster whether you like it or not, and people want ways to use that power. Want proof? Look at commercial games, especially mainstream FPS games. Less than a decade ago, everyone was playing the original Doom, with graphics that today can only be described as "classic". Fast forward to today, Doom 3 is out, which taxes just about every computer on the market to its absolute limit to bring stunning visuals that as little as two years ago were unfathomable. And people love the game largely for that very reason -- they're being shown what their $1k+ computer can REALLY do, and they're eating it up.

 

Because it is such a two-sided coin, I'm supporting it being an option -- slower system? Don't use it.

 

BTW mikeman, would you mind publishing your patch for perspective view? It's nice to have something to go on.

Share this post


Link to post
Share on other sites
BTW mikeman, would you mind publishing your patch for perspective view? It's nice to have something to go on.

Meh, it's nothing more than setting the projection matrix with gluPerspective and placing the camera. Pathfinding doesn't work, and objects that should appear don't.

 

draw_scene.c:

void Move()
{


   int i;
for(i=0;i<max_actors;i++)
 {
 	if(actors_list[i] && actors_list[i]->actor_id==yourself&& actors_list[i]->tmp.have_tmp)
   {
   	float x=actors_list[i]->tmp.x_pos+0.25f;
   	float y=actors_list[i]->tmp.y_pos+0.25f;
   	float z=-2.2f+height_map[actors_list[i]->tmp.y_tile_pos*tile_map_size_x*6+actors_list[i]->tmp.x_tile_pos]*0.2f+sitting;
   	//move near the actor, but smoothly

   	if (perspective)

   	{cx=-x+move_horz*sin(degtorad(rz));
   	cy=-y+move_horz*cos(degtorad(rz));
   	cz=-z-move_vert;
   	camera_x_speed=0;
   	camera_x_frames=1;
   	camera_y_speed=0;
   	camera_y_frames=1;
   	camera_z_speed=0;
   	camera_z_frames=1;
   	} 
else
{    	camera_x_speed=(  (x)  -(-cx))/16.0;
   	camera_x_frames=16;
   	camera_y_speed=(  (y)  -(-cy))/16.0;
   	camera_y_frames=16;
   	camera_z_speed=((z)-(-cz))/16.0;
   	camera_z_frames=16;
}

   	


   	break;
   }
 }

...

 

 

gl_init.c:

void resize_window()
{
...

if (!perspective) glOrtho( -1.0*zoom_level*window_ratio, 1.0*zoom_level*window_ratio, -1.0*zoom_level, 1.0*zoom_level, -40.0, 40.0 );
else gluPerspective(15.0*zoom_level,window_ratio,0.2,2000);

...

}

Edited by mikeman

Share this post


Link to post
Share on other sites

I had an optimization idea - while I was playing without accelerated graphics I noticed that when you rotate the view, the nametags and healthbars rotated first, then the world view rotated, then the nametags and healthbars corrected themselves. Might the rotation work faster if the nametags and healthbars were removed before rotation and re-added after the world had rotated?

Share this post


Link to post
Share on other sites
There's two distinct sides of the coin, and you completely missed one of them. Computers are getting faster and faster whether you like it or not, and people want ways to use that power. Want proof? Look at commercial games, especially mainstream FPS games. Less than a decade ago, everyone was playing the original Doom, with graphics that today can only be described as "classic". Fast forward to today, Doom 3 is out, which taxes just about every computer on the market to its absolute limit to bring stunning visuals that as little as two years ago were unfathomable. And people love the game largely for that very reason

Disagree on just about every point.

 

- Computers don't get faster. People are forced to buy new computers, because the old one suddenly got too slow, not faster.

 

- "Use that power" is not the same as "make my brand new computer slow". It's supposed to be fast, that's why I bought it. If people wanted their new computer to be just as slow as the old one, they wouldn't have bought a new one.

 

- people are complaining that games nowadays are all graphics and no gameplay.

Share this post


Link to post
Share on other sites
Guest Glen Coe

Note: This post will also answer some things in my other thread. By the way: I would never start a flame war. I speak about: "THINK, if you have to stick at c."

=== ============ ===

 

Computers don't get faster.

That is of course wrong. And if you are the knowledged person, i've perceived you so far, then you will agree to this. (Never heard on an exhibition, that Intel was proud to show the customers the next generation and much more slower (hurray!) processor)

 

"Use that power" is not the same as "make my brand new computer slow". It's supposed to be fast, that's why I bought it. If people wanted their new computer to be just as slow as the old one, they wouldn't have bought a new one.

That is of course right. :)

 

people are complaining that games nowadays are all graphics and no gameplay.

 

Hm... that is a complicated statement. I remember, that some friends really moan about the missing gameplay. But you can not deny it, that these new games have exceptional sales figures. And if you take pearls like Mafia, the Baldur's Gate series, even HL2 or WC3, KOTOR and so on... see, there is also a bunch of high playable games on the market.

 

Of course I am sometimes missing the days of Monkey Island 1+2, of System Shock 1 and Ultima Underworld 1+2 (a cheers to Looking Glass), of Civ 1 and Railroad Tycoon 1. I am sometimes missing the hunt for the last cycle in this damned completely assembler written font pixelation routine for mode X. I am missing sometimes the Turbo Pascal 7.0 environment with its fastblown compiler and groundbreaking debugging features. I remember my hate to the graphics industry, that they not enhance the SVGA-Modes, but transfer the transformation, lighting and drawing calculation to the graphic card.

...

But these days are gone. Now I am working for 4 years at a firma in the automation industry. I must fight with this interesting (but then very slow) XML-DOM-thingy. I must eat the pills of atl, mfc and now c#. I have to convert from java to c to c++. I have to work with asp and php, and now we must slowly move to whidbey and longhorn. I own a geforce4 at home and a WinXP Home Edition... and i am satisfied with that. Why? At least we have to give it a try. We must allow the science, the youth, the mankind to advance. I had to learn, that I have to lay my scepticism aside and try to work WITH the newest invention.

 

@mikeman:

Yesterday I tried your idea. And yes, it looks interesting. But I can understand the points mentioned by Entropy. On the other side is it an interisting option. BTW, I only changed gluOrtho to gluPerspectivef(45.0f, ratio,0.1,1000) with a following glTranslatef(0,0,-8) to get a nice over-shoulder perspective. Additional I changed the limits for the camera-down- and -up-angles. So it was possible to to look nearly horizontal, which gives a nice world view.

 

Just my two cent (hm... yes, another three ^^)

Glen Coe.

Share this post


Link to post
Share on other sites

BTW, I only changed gluOrtho to gluPerspectivef(45.0f, ratio,0.1,1000) with a following glTranslatef(0,0,-8) to get a nice over-shoulder perspective.

 

Yes, I tried that too in the beginning, but since the game uses the camera coords for other stuff too(like calculating what objects it should render) besides just altering the matrices, I had to set the camera position in worldspace, so I won't get it all messed up(the game thinking the camera is in one position, the renderer draws the scene from another).

 

Btw, what I found really weird is that the camera translation is:

 

glTranslatef(cx,cy,cz);

 

And the camera is positioned in a "negative" worldspace. Like, if we wanted to place the camera in the player's pos, we would have to do:

 

cx=-player.x;

cy=-player.y;

cz=-player.z;

 

I've never seen it like this. Usually, camera pos is just like any other coord, and you just use glTranslatef(-cx,-cy,-cz).

Share this post


Link to post
Share on other sites

glTranslatef(cx,cy,cz);

That's a matter of taste. I don't remember why I decided to use this method, but it was something about convenience. I like it as it is.

 

For instance, I see that it tests every object in the map to determine whether it's visible or not. More complex maps cause a linear drop in performance.

 

Tha usually goes in paralel with the OpenGL rendering code, so it doesn't really slow down the game. I did tests.

 

Another example: today I found out that when rendering animated models, backface culling isn't even enabled. There are many things that can be fixed.

 

Hmm, then someone removed it. I remember specifically putting in there, except for transparent actors.

 

 

That is of course wrong. And if you are the knowledged person, i've perceived you so far, then you will agree to this. (Never heard on an exhibition, that Intel was proud to show the customers the next generation and much more slower (hurray!) processor)

He is right, computers do not get faster. New computers are faster than old computers, but unless you get a new computer, the computer you already have is not going to be faster.

 

 

Anyway, if someone feels like optimizing EL, please do. For years I tried to find out why it is so slow, and couldn't put my finger on the problem.

Share this post


Link to post
Share on other sites

For instance, I see that it tests every object in the map to determine whether it's visible or not. More complex maps cause a linear drop in performance.

 

Tha usually goes in paralel with the OpenGL rendering code, so it doesn't really slow down the game. I did tests.

 

In parallel? What do you mean by that?

 

-EDIT: Ah, just got it.

Edited by mikeman

Share this post


Link to post
Share on other sites
Guest Glen Coe
He is right, computers do not get faster. New computers are faster than old computers, but unless you get a new computer, the computer you already have is not going to be faster.

 

Uhm... I get the point. *grins* The devil is in the details. Of course... the SAME computer can not growing faster. I thought, it was clear that I spoke about computer GENERATIONS. Anyway, you both are right. Sorry to Leeloo.

 

@optimization:

I would do it, 'cause it is my favourite area. But I only have access to VC 6.0 and 7.1 on my WinXP computer. So I must not provide any patches. I couldn't give the warranty, that it was coded in clean C and that it compiles under Linux and GCC.

 

Glen Coe.

Share this post


Link to post
Share on other sites

Well, you are very welcome to provide patches and submit them to Berlios.de - A GCC user can then make them compile cleanly and merge them :-).

 

Otherwise you can of course get DevC++ if you want to do that yourself.

Share this post


Link to post
Share on other sites
He is right, computers do not get faster. New computers are faster than old computers, but unless you get a new computer, the computer you already have is not going to be faster.

 

Uhm... I get the point. *grins* The devil is in the details. Of course... the SAME computer can not growing faster. I thought, it was clear that I spoke about computer GENERATIONS. Anyway, you both are right. Sorry to Leeloo.

The problem with that is that it requires people to buy new computers. I don't think EL should be the game that makes hardware vendors earn more money, Doom3 and every new version of Windows are already bad enough at forcing upgrades, that they get accused of having a secret agreement about wasting ressources just to make people buy new hardware.

 

EL should not make more money for ATI and nVidia than it does for Entropy.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×