Feedback/help with automated map screenshots

Discussion in 'Mapping Questions & Discussion' started by teamwork.tf, Nov 10, 2017.

  1. teamwork.tf

    teamwork.tf L1: Registered

    Messages:
    20
    Positive Ratings:
    31
    Hi, me again! I've finally got a minimum viable product for automated screenshots of a map, which are semi-automatically generated:

    screenshots from cp_sulfur_b4

    So this is an example of what those automated screenshots produce. My question to you is, do you have any feedback on this? Maybe you know some TF2 commands which render the scene better, or which angles to use in the isometric images? Just let me know!

    This is the current process used to generate the images (feedback highly appreciated):

    when the map is loaded:

    sv_cheats 1
    r_drawviewmodel 0
    cl_drawhud 0
    noclip
    mat_picmip -1
    r_lod 0

    When creating screenshots for the spectator cams:

    fog_enable 0
    fog_override 1
    r_portalsopenall 1

    {cycle through all the spectator cameras}

    When creating the level overview image:

    I estimate the center of the map (by looking at all entities in the map, excluding the 3d skybox and tournament stage). After that I use this to setpos center-x, center-y, center-z. Then I set cl_leveloverview to a scale which shows the whole map (based on the estimated bounds). I cycle through different z axis: [-2000, -1000, 0, 400, 900, 1400] (by adding these values to center-z). After taking different layers, I combine all the layers by overlaying them into a merged file, where black pixels are transparent. I encountered issues where the background became green; in that case I discard that specific image.

    When creating isometric images:

    fog_enable 1
    fog_override 0
    c_orthowidth 10000 (my screen is 1920x1080)
    c_orthoheight 5625
    camortho

    First I position the camera on the estimated center of the map, with the z-axis being +1000. Now I make screenshots from two different angles: 45 degrees and 35, rotating the camera in 4 stages around the map. Now I saw this method from the isometric forum post, but I can't seem to figure out what angle they are using. Any help on this?

    In case anyone is interested in the source code, let me know. Then I will release it on Github. You need both a Linux machine and Windows machine with TF2 on it though. The code is a bit of a mess atm. so I might need some time to clean it up.

    Edit: If you know some nice maps for me to test this on, also let me know!
     
    • Like Like x 3
    • Thanks Thanks x 1
    Last edited: Nov 10, 2017
  2. henke37

    aa henke37

    Messages:
    1,879
    Positive Ratings:
    442
    You shouldn't need to force the areaportals open unless there is some tricky I/O going on.

    Also, have you considered the devshots system?
     
    • Respectfully Disagree Respectfully Disagree x 1
  3. Crash

    aa Crash func_nerd

    Messages:
    3,151
    Positive Ratings:
    4,750
    devshots wouldn't be applicable here because it's for a system designed to work with all maps, not a new map being made that the entity could be placed in.
     
  4. fubarFX

    aa fubarFX The "raw" in "nodraw"

    Messages:
    1,608
    Positive Ratings:
    1,698
    your spheres are of impressive quality
     
    • Agree Agree x 1
  5. KubeKing

    Server Staff KubeKing dan's birthday was fun

    Messages:
    1,233
    Positive Ratings:
    1,474
    The stitching is incredible! Look at how straight these lines are. For reference, I'm facing directly downwards, which is where many stitching artifacts are usually found:

    upload_2017-11-10_15-23-41.png

    Did you use a different technique for this next screenshot? If not, you might be having issues with stitching transparent/wavy surfaces:

    upload_2017-11-10_15-23-5.png

    Also, I'd love to see your code released, though I wouldn't have any personal use for it.

    It looks like all of your photospheres are 'tilted.' The red and blue lines should be parallel:

    [​IMG]
     
    • Like Like x 1
    Last edited: Nov 10, 2017
  6. fubarFX

    aa fubarFX The "raw" in "nodraw"

    Messages:
    1,608
    Positive Ratings:
    1,698
    btw, you can get the level bounds by using vbspinfo.exe -size. (It even gives the bounds ignoring the skybox so you know it's good shit)
     
    • Thanks Thanks x 1
  7. fubarFX

    aa fubarFX The "raw" in "nodraw"

    Messages:
    1,608
    Positive Ratings:
    1,698
    worth noting
     
    • Thanks Thanks x 2
  8. teamwork.tf

    teamwork.tf L1: Registered

    Messages:
    20
    Positive Ratings:
    31
    I have looked into it, but it kept crashing on my machine. I don't know if this is linux related, but switching to the in-game spectator cam's wasn't too hard as I needed the info/commands for the isometric/level overviews anyway.

    I've done the stitching manually with ICE (from MS). I have yet to figure out how to automate the stitching, I was thinking of using Hugin or OpenPano for this, but documentation is sparse. The tiltedness in the photo seems to happen due to the stitching done by ICE when objects become too close. Still have to look into that one a bit more. ICE seems to be the only one being able to stitch spectator camera's properly, but it cannot be automated as it has no command line interface :/
     
    • Thanks Thanks x 1
  9. Fantasma

    aa Fantasma

    Messages:
    884
    Positive Ratings:
    979
    May be worth checking out this video, could get some ideas with how you could use the same ideas in TF2 as opposed to SFM.

    Another idea (however not as good as a full implementation) could be to extract and use the cubemaps in a BSP. (They're way too small to be useful turns out)


    View: https://www.youtube.com/watch?v=dres21tAHrA
     
    Last edited: Nov 11, 2017
  10. teamwork.tf

    teamwork.tf L1: Registered

    Messages:
    20
    Positive Ratings:
    31
    An update on the endeavour, I've almost completely re-written all the code, and it's now running to grab screenshots and level overviews. I've left out the automated isometric shots and photo spheres for now, as the results are not very good.

    The metadata extraction code is already published at https://github.com/teamworktf/map_data_gatherer

    The code to create automatic screenshots with that metadata is still a mess, will need some more time to make it fully automated & clean. Will release that once I've processed a large set of the maps.
     
  11. EArkham

    aa EArkham Necromancer

    Messages:
    1,568
    Positive Ratings:
    2,185
    I noticed that it doesn't update the screenshots if the map changes versions.

    Antiquity b15 and later all look like the old version of the map: https://teamwork.tf/community/map-stats#search=antiquity

    The map's look changed a lot when it went to b15, a total make over: https://tf2maps.net/threads/antiquity.15191/

    I don't know how you can resolve that automatically, short of taking new screenshots for every version which would be unnecessary 90% of the time for maps in beta or later. In antiquity's case, maybe I confused the issue further by taking it back from release candidate to beta, but it would be nice if there was an option for map owners to "force screenshot refresh" on versions.
     
  12. teamwork.tf

    teamwork.tf L1: Registered

    Messages:
    20
    Positive Ratings:
    31
    Currently the thumbnails created in community quickplay are based of the uploaded maps on Gamebanana / the workshop or TF2maps. This system is not connected yet with this project here, and i has to guess automatically which map this is. As your steam workshop submission does not contain the actual map name, it used an image provided by gamebanana: https://gamebanana.com/maps/155246

    An option to manage this on teamwork.tf is nice, but there are some technical problems. I've looked into ways of matching map owners between map-stats on the website, but at the moment there is no reliable method of doing this, as map names differ a lot and there is usually no Steam ID on the sources of where thumbnails come from. Also, as there are a lot of maps with slightly different names, the matching can be flaky at best.
     
    Last edited: Dec 8, 2017
  13. EArkham

    aa EArkham Necromancer

    Messages:
    1,568
    Positive Ratings:
    2,185
    Most people don't name their workshop entries the same as the map, so I'd think trying to match the workshop is almost never going to work if it replies on an exact name match. But the steam workshop is THE most official source you're going to get for maps, so that certainly seems like an issue that needs to be worked out.

    How are you getting the name from gamebanana? That's a super old version, so it wouldn't match up the name to the new B15+ versions anyway.

    I'd strongly recommend not using gamebanana anyway, as most serious maps never get seen there. I'm sure the admins here would work with you to allow you to get map info and authors from the map workshop section of the forums here instead.

    [Edit] I'm also probably going to be deleting the entry at gamebanana anyway, as the only reason I put it there back in the day was because I had a troll trying to take credit for some of my maps.
     
    Last edited: Dec 8, 2017
  14. teamwork.tf

    teamwork.tf L1: Registered

    Messages:
    20
    Positive Ratings:
    31
    The current thumbnail matches are good enough given the current situation. The problem is that none of the thumbnail sources, even with help from the admins/Valve can identify the exact map name for each given map in their databases. This is because they simply don't keep track of it. On the other hand we have the Game Coordinator from Valve, which only supplies one string to indicate which map is running a gameserver.

    This means our gameserver scanner has to figure out that "cp_antiquity_b18" actually is "cp_antiquity", and then find the most accurate source. But the source doesn't know the exact map name either, so this gussing games requires me some approximation techniques to at least get some reasonable results.

    And about dropping gamebanana, that's just not an option. The most played maps (and most searched for) are not hosted on TF2maps, but are on gamebanana.

    Also, if you just add the map name in the steam workshop description (not the title) would be enough for our system to pick it up. But then again, because of budget constrains and server power constraints we only update the thumbnail if someone plays on the map, so it might take weeks or months for it to be updated.
     
  15. EArkham

    aa EArkham Necromancer

    Messages:
    1,568
    Positive Ratings:
    2,185
    Done, but doesn't this mean that anyone can make a trade/surf/joke map and put someone else's map name in the description to purposely mess up someone else's thumbnail, as long as the joke map gets played more recently?
     
  16. teamwork.tf

    teamwork.tf L1: Registered

    Messages:
    20
    Positive Ratings:
    31
    Yes, but the same can be achieved by creating fake entries.
     
  17. teamwork.tf

    teamwork.tf L1: Registered

    Messages:
    20
    Positive Ratings:
    31
    Don't know if double posting is allowed, but I've just updated the site so that you can at least "own" a gamemap on the map-stats page. You can apply here: https://teamwork.tf/settings

    After it's approved you can just navigate to a map-stats page and click the claim button.
     
    • Thanks Thanks x 1