Author Topic: Changelog - picture heavy  (Read 5548 times)

0 Members and 1 Guest are viewing this topic.

Offline Andy ONeill

  • Equites
  • ***
  • Posts: 107
Re: Changelog - picture heavy
« Reply #105 on: May 15, 2018, 07:00:50 AM »
All modules
New Menu item template

Review and add/fix Shortcut/"hot" keys

Map Editor

Visibility toggle and opacity slider for
  •   Background
      Elevation
      Terrain



In the screen shot both the elevation map and terrain opacity are dialed down a little.
You can see the shortcut keys underlined because I've pressed the alt key.

Experienced Windows users will be used to seeing underlines like these showing shortcut or "hot" keys.
This is standard windows behaviour.
Pressing Alt, holding it and pressing another key matching one of the shortcuts invokes it.
Hence Alt+L then Alt+B would toggle the visiblity of any Background you have loaded.
You can also press Alt, L, B.
Again, this is standard windows behaviour for a menu.
You can use Notepad or office apps in this way.
Recent versions of Office give you a little black square with a white letter on it when you press alt to make these shortcuts clearer.
I may implement that later.

You can't see where the mouse is on that screen shot but it's over Elevation Map which makes it's sub menu "pop out" showing the opacity slider.

Rationalising geometry resources.
Geometries are used to define all the vectors used in the iconography.



Offline Andy ONeill

  • Equites
  • ***
  • Posts: 107
Re: Changelog - picture heavy
« Reply #106 on: May 16, 2018, 05:20:51 AM »
Map Editor

Added groundscale.
You set this in an overlay which is toggled from the layers menu.



The two sort of rifle sights can be dragged around over two points you know the distance between.
You enter that distance in meters and click the save button.
The meters per pixel and overall size of the map are then calculated.



When you save the design of a map, the position of those two points and the amount you entered are saved.
Re-load such a map and toggle the overlay and you'll see the sights in the saved position.

When you use the google elevation data there is a known distance between your two map co-ordinates.
This is used to calculate the scale.
If you calculate the bottom co-ordinates or load the elevation data then this new data will be used for groundscale.
The positions of the sights will then be calculated.
This will over-write any data you already entered.
Meaning if you wanted to use real world elevation data but at a different scale then you would first load the elevation data and then later change the scale.
Don't reload the elevation data or re-calculate the corners (if you forget then don't save your changes).


Offline Andy ONeill

  • Equites
  • ***
  • Posts: 107
Re: Changelog - picture heavy
« Reply #107 on: May 16, 2018, 01:04:56 PM »
Map Editor

Working towards allowing the user to "shape" elevation using drawing-app-like tooling.
This is not intended to be the primary way for anyone to input elevation but rather to "fix up" imported elevation data, for simplistic use in a "quick" scenario or as a back stop for someone who really doesn't want to use an image editor.

The original way of drawing the hypsometric elevation image takes a couple of seconds to run. This is OK for a one-off load but would require the whole image redrawing again in order to show any change.
It cannot be made more efficient without using a different approach.

I've added a new method which is a bit more efficient and will allow writing to parts of the image.
This is rather lower level stuff and hence tricky.
If necessary there's the potential to use pointers and "unsafe code" to make it faster again.
You might be thinking "Well just make it faster then!".
There would be a trade off though.
Such techniques come with an inherent higher risk of nastier bugs.
These might be necessary to get acceptable speed but a risk is a risk and best avoided.

 

Offline bayonetbrant

  • Chief Arrogance Mitigator
  • Administrator
  • Musketeer
  • *
  • Posts: 35811
  • Loitering With Intent
Re: Changelog - picture heavy
« Reply #108 on: May 16, 2018, 03:11:57 PM »
OK, so the important question - WHEN DO WE GET TO PLAY WITH IT?!?

;D
The key to surviving this site is to not say something which ends up as someone's tag line - Steelgrave

"their citizens (all of them counted as such) glorified their mythology of 'rights'...and lost track of their duties. No nation, so constituted, can endure." Robert Heinlein, Starship Troopers

Offline Andy ONeill

  • Equites
  • ***
  • Posts: 107
Re: Changelog - picture heavy
« Reply #109 on: May 17, 2018, 02:07:21 AM »
My guess is December.
Still quite a bit of work to do.

I've started a separate thread.

Offline bayonetbrant

  • Chief Arrogance Mitigator
  • Administrator
  • Musketeer
  • *
  • Posts: 35811
  • Loitering With Intent
Re: Changelog - picture heavy
« Reply #110 on: May 17, 2018, 04:09:14 AM »
The key to surviving this site is to not say something which ends up as someone's tag line - Steelgrave

"their citizens (all of them counted as such) glorified their mythology of 'rights'...and lost track of their duties. No nation, so constituted, can endure." Robert Heinlein, Starship Troopers

Offline Andy ONeill

  • Equites
  • ***
  • Posts: 107
Re: Changelog - picture heavy
« Reply #111 on: May 19, 2018, 10:15:41 AM »
Map Editor

I've added a quick n dirty prototype method to view and change the size of the area you paint with in the map editor.
Choose Drawing options and hover over one.
You will see a tooltip with the current size and a representation of that.
There are two rectangles.
The upper one is at 0.5 pressure which is what you get from a mouse.
The bottom one is at 1 pressure which you get if you press hard with a stylus or use the widening option on river.
Scroll the mouse wheel up or down in increase or decrease the size by 1 px.
This currently "works" for all of the options but is only meaningful for line.

Researching options to improve contour drawn elevations - so they give a gradual slope rather than a step.

All
Minor improvement to bevelled frame.


Offline Andy ONeill

  • Equites
  • ***
  • Posts: 107
Re: Changelog - picture heavy
« Reply #112 on: May 22, 2018, 04:14:52 AM »
Map Editor

Fixed Bug failed to reset isbusy flag/indicator on re-opening saved map

Prototype greyscale calculation.

This uses the data from contours.
You need to set low and high so it "knows" the expected range of black through to white.
Set all the parameters, click the calculate button and you get a grey layered effect initially.


Checking the blurred box adds a gaussian blur effect which will then result in a slope rather than cliff when converted to elevation values

Note that the contour line will be towards the edge of the gradient rather than the "top" and hence the expected elevation will be somewhat inside it.
Often the exact elevation at a point isn't really going to matter so much so that few metres won't have any noticeable effect.
If this will be an issue for a map you're drawing, you can either draw your contours slightly further out or give them a higher value.

Hiding the terrain ( which is just contour lines in this case ):


I then have some code which grabs the pixels and translates the grey scale into metres.
Then redoes the hypsometric elevation picture


This is still very much a prototype and needs more work.
But.
The results look pretty good. Certainly way better than cliff edges.

Note:
This is never going to be as sophisticated as you can do using the likes of photoshop. On the other hand, probably good enough for most purposes with an almost zero learning curve.
And... this is just one option. 
You'll still be able to import an image created externally.
Or at least you will once I write that part.

Offline Andy ONeill

  • Equites
  • ***
  • Posts: 107
Re: Changelog - picture heavy
« Reply #113 on: Yesterday at 04:30:56 AM »
Map Editor

Remove "old" code which set elevation based purely on contour height when saving a map.
Save new generated elevations
Respect default height
Limit input of (GreyScale elevation) values to numbers

Bug fixing and refactoring greyscale code.

Greyscale image import.
You now select between using Contours or Picture to generate a greyscale based set of elevations.
You can do both but whichever values you save last will be used.

Although a greyscale picture of the right proportion is advisable, this should handle any image you have.
That includes coloured ones.  These will be translated to greyscale based on tone.
If the picture is the wrong sort of shape it will be stretched.




Note that no particular validation is done on what you enter in this view.
If you set a low higher than the high then bad things are going to happen.

The interval is not used for anything yet.
The plan is to speed up allocating a value to contour height.
I may instead move this to the contours option settings.

Offline Andy ONeill

  • Equites
  • ***
  • Posts: 107
Re: Changelog - picture heavy
« Reply #114 on: Today at 03:21:19 AM »
Hypsometric Elevation Image

Optimising algorithm which creates the bitmap.
Exactly how this works is pretty technical stuff involving building a huge array of bytes with 4 per pixel holding blue, green, red and alpha values.

Rather than working out each colour to use for an elevation dynamically I've built a collection of 255 colours.
I then work out which of those 255 "bands" any elevation would be in and use that colour.
The downside of this is that I can't now easily make this user configurable.
OTOH the processing savings are significant.

This may read as pretty dry stuff but it's huge.
Overall, the changes cut building one example picture down from a rather stately 2.68 seconds to 4 milliseconds.
That makes rebuilding the entire image as someone "shapes" a hill or valley practical and should just be a brief flicker rather than noticeable wait.