External View Selection

An area for discussing new ideas and additions to Oolite.

Moderators: another_commander, winston

User avatar
Redspear
---- E L I T E ----
---- E L I T E ----
Posts: 1471
Joined: Thu Jun 20, 2013 10:22 pm

External View Selection

Post by Redspear »

Typically, a ship has several predefined external viewpoints, accessed and cycled through by pressing the 'v' key.
Might it be better if they could also operate in a fashion similar to internal views?
e.g. v+1 = 1st external view, v+2 = 2nd external view etc.

I appreciate that external views are not necessarily as consistent or predictable as their internal counterparts but cycling through 'v' has been a (very minor) annoyance since I first discovered this game.
"With our thoughts, we make the world" :-) - - - Game too slow for you? Masslock Compensators - - - Trouble getting out of trouble? Indestructible Injectors

another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 5512
Joined: Wed Feb 28, 2007 7:54 am

Re: External View Selection

Post by another_commander »

Would it not be much better if we could use the mouse to rotate the camera around the ship on any external view? This requires some wild quaternion math, but I had this idea of selecting mouse external freelook mode by, say, toggling Caps Lock On while in external view (we did put the functionality in to be used after all) and then moving the mouse up/down to position the camera along a reference meridian, or roll left/right to rotate the equator of a sphere with radius equal to that specified by the external view. The camera would move along the sphere's equator using something like Shift+mouse left/right or the yaw controls and would be oriented in a way so as to always face the ship. Mousewheel could be used to adjust the radius of the sphere on which the camera is moving on or, in other words, the camera distance from the ship we are observing.

This is what I would imagine it would look like (random image fished from the internet used for example purposes). The equator and meridian where the camera moves are defined by its starting position. By rolling the camera, the thing would look like in the second image. This way we would be able to put the camera wherever we want and get some glorious views of our ship.
Image Image

With Caps Lock Off, we could keep things the way they are now, i.e. control and move the ship in external view as usual.

This is just all ideas at this moment, with no actual timeframe for implementation (need to mentally prepare before attempting a dive into the kind of maths behind it :-)), but I thought I'd just throw it here, since the subject of external views was brought up.

User avatar
Norby
---- E L I T E ----
---- E L I T E ----
Posts: 2560
Joined: Mon May 20, 2013 9:53 pm
Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
Contact:

Re: External View Selection

Post by Norby »

What I missing is a zoom function in external views, etiher by mousewheel or pgup/down. This need vectors only:

Code: Select all

camera.position = ship.position.add(view_position_in_shipdata.multiply(1/zoom));

User avatar
pagroove
---- E L I T E ----
---- E L I T E ----
Posts: 3035
Joined: Wed Feb 21, 2007 11:52 pm
Location: On a famous planet

Re: External View Selection

Post by pagroove »

I like your thinking Another_Commander :).
A freely movable external view would be very cool. Also for making video's.
For P.A. Groove's music check
https://soundcloud.com/p-a-groove
Famous Planets v 2.7. (for Povray)
Image
http://aegidian.org/bb/viewtopic.php?f=4&t=13709

User avatar
kanthoney
Commodore
Commodore
Posts: 281
Joined: Thu Nov 07, 2013 10:21 pm

Re: External View Selection

Post by kanthoney »

There's an external_views branch up on github. In an external view switch on caps lock, then roll/pitch/yaw using the keyboard to rotate the view and page up/down to zoom in and out. There's an obvious glitch in that the ship suddenly jumps from somewhere near the bottom of the screen to the middle when you start rotating around, and a_c will probably find another half dozen things I've missed.

another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 5512
Joined: Wed Feb 28, 2007 7:54 am

Re: External View Selection

Post by another_commander »

Hot damn! This is exactly what I was imagining! And it was done in just a few hours! Mr. Digital Sorcerer, my compliments. Well done.

I was planning to hit bed early tonight, but no no no, not after this... ;-)

Built the branch, played with it a bit (you can bet it will be a while with the new toy) and first impressions are excellent. I love the fact that pausing the game does not affect the view manipulation and you can still move around the scene in stop-time. The only little glitch that I found, apart from the already mentioned jump, was that when the camera is very close to the model, it sometimes clips through it as it rotates. I guess this could be maybe solved by adjusting the minimum distance to something like half of that of the model's largest dimension?

Also, I think it would be great if mouse could also be used for moving the camera, as an alternative to keyboard. Mousewheel should definitely be set to the zoom in/out, but these are just fine tuning details that can be taken care of in due time. The big part of the work is already here and boy is it looking good!

I predict some awesome screenies appearing once this hits master.

User avatar
kanthoney
Commodore
Commodore
Posts: 281
Joined: Thu Nov 07, 2013 10:21 pm

Re: External View Selection

Post by kanthoney »

another_commander wrote:I love the fact that pausing the game does not affect the view manipulation and you can still move around the scene in stop-time.
I completely planned it that way, of course. Ahem.

I've removed the jump, but I'm not sure I've done it the best way as the view rotates around a point in space above the ship. I'm not sure what else to do though.

If you move to a side view and pan the camera up and down, there's some nasty flickering, which I think is a lighting bug somewhere else in core that occurs if the camera has a z-coordinate of exactly zero. I'll dig into that.

Feel free to play with the controls. And thanks for the comments!

another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 5512
Joined: Wed Feb 28, 2007 7:54 am

Re: External View Selection

Post by another_commander »

This is a little example of the new toy. All three images below are the exact same scene, taken from different angles using the rotating camera.
Image

Image

Image

Not bad at all... One thing that I believe would be a nice to have, would be possibility to pan the camera slightly left/right/up/down. Doesn't need to be much, just a bit so that the ship we are rotating around could be maybe positioned also towards the edges of the screen. But that's not something urgent (or even a requirement), of course.

I may try to play a bit with controls tomorrow, if I can get a chance. For now, good stuff and well done.

User avatar
Norby
---- E L I T E ----
---- E L I T E ----
Posts: 2560
Joined: Mon May 20, 2013 9:53 pm
Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
Contact:

Re: External View Selection

Post by Norby »

another_commander wrote:when the camera is very close to the model, it sometimes clips through it as it rotates. I guess this could be maybe solved by adjusting the minimum distance to something like
collisionRadius?

User avatar
Norby
---- E L I T E ----
---- E L I T E ----
Posts: 2560
Joined: Mon May 20, 2013 9:53 pm
Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
Contact:

Re: External View Selection

Post by Norby »

kanthoney wrote:If you move to a side view and pan the camera up and down, there's some nasty flickering, which I think is a lighting bug somewhere else in core that occurs if the camera has a z-coordinate of exactly zero.
I think shaders switch between a dark and a light mode. A workaround if you skip a little angle around 0 (I do the same in Gallery OXP), a solution if somebody with shader knowledge define the border a bit away from 0 (I prefer the lighter mode for an extra 1 degree). Would be even better in addition if could make more light levels than the current 2.

User avatar
phkb
Commodore
Commodore
Posts: 2528
Joined: Tue Jan 21, 2014 10:37 pm
Location: [p]laying [h]ard and [k]icking [b]utt somewhere in G7...

Re: External View Selection

Post by phkb »

another_commander wrote:This is a little example of the new toy.
This. Looks. Awesome. :shock: :D

User avatar
Redspear
---- E L I T E ----
---- E L I T E ----
Posts: 1471
Joined: Thu Jun 20, 2013 10:22 pm

Re: External View Selection

Post by Redspear »

Er, yeah, that'll do :lol:

Looks really good. Nice work chaps :D
"With our thoughts, we make the world" :-) - - - Game too slow for you? Masslock Compensators - - - Trouble getting out of trouble? Indestructible Injectors

another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 5512
Joined: Wed Feb 28, 2007 7:54 am

Re: External View Selection

Post by another_commander »

Just noticed something while testing the feature on a lower-end PC. The camera rotates pretty nice and fast while the framerate is high, but it slows down quite a bit if the framerate drops. This is most likely because the movement functions do not take delta_t into account. I think we need to introduce it in a fashion similar to what we have for standard control input, in order to ensure that the game still runs at a normal pace, even when fps drops.

I didn't realize this during yesterday's testing, because the computer I was using had an NVidia that was running the game at 60 fps steady.

User avatar
kanthoney
Commodore
Commodore
Posts: 281
Joined: Thu Nov 07, 2013 10:21 pm

Re: External View Selection

Post by kanthoney »

Camera panning added (use shift and arrow keys).

User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2303
Joined: Fri Jul 14, 2006 12:29 pm
Location: Wales

Re: External View Selection

Post by Griff »

Wow, that is excellent! Fantastic work!

Post Reply