The Infinity Blade Forums Have Moved

We've launched brand new Infinity Blade forums with improved features and revamped layout. We've also included a complete archive of the previous posts. Come check out the new Infinity Blade forums.
See more
See less

Switch to fullscreen - terrain vanishes

  • Filter
  • Time
  • Show
Clear All
new posts

  • Switch to fullscreen - terrain vanishes

    So if your camera is looking at terrain and you switch to full-screen (either with alt+enter or setres)... it vanishes. Sometimes it breaks apart and you see a crazy amount of tearing and polygons extending, but suffice to say bad things happen. This also occurs if you switch resolutions, or "tab back and fourth" from a full-screen window. This does not happen in the editor, only when launched from the command line.

    Now, if the player rotates their camera AWAY from the effected area and then looks back: everything looks right!

    Now I could be a cheap-ass and spin the player camera on purpose when they resize the screen, but thats the definition of ultra ghetto. Whats the proper way to do this?

    function OnScreenResize()
    private function RebufferMap()
    	local Terrain terrainData;
    	// Get any terrain that may exist
    	foreach class'WorldInfo'.static.GetWorldInfo().Game.AllActors(class'Terrain', terrainData )
    		`log( "TERRAIN DATA " @ terrainData );
                    terrainData.MagicFunctionThatReCachesAllVisibleMapInfo(); // ??

  • #2
    Don't think I ever heard anyone having this issue before. Which UDK build are you using? Does the log say anything?

    An alternative over the rotating camera on purpose could be hidding the terrain right before the switch and then making it visible again after (not sure if that makes any difference, can't test right now).


    • #3
      Unfortunately this is a known issue. I believe the best way to "fix" this is to simply switch to Landscape.


      • #4
        Terrain doesn't like screen size changes, I doubt there's anything you can do with it since it can be seen in AAA titles that used terrain as well.

        It usually works itself out if you just move the camera around a bit.


        • #5
          I am using UDK-2011-10 ... aka the last working build of UDK if you are using scaleform!

          I tried toggling the camera before I posted this, but that did not work. However toggling the terrain DOES work. Unfortunately doing a:

          private function OnScreenResize(bool hide)
          	local Terrain terrainData;
          	local ISOGame game;
          	game = class'ISOGame'.static.GetGame();
          	// Get any terrain that may exist
          	foreach game.AllActors(class'Terrain', terrainData )
          function PostRender()
              if( sizeHasChanged ) OnScreenResize();
          will randomly crash UDK, im going to need to come up with a creative solution to invoke that call given I dont know of (and am not sure there is) a standard event that gets fired off when the screen is resized.


          • #6
            So I came back to this problem recently and figured out a solution. There is no way that I have found where you can tell the terrain to "Refresh" itself according to the existing viewport. Sucks. However if the camera moves away for a second or two and then moves back the terrain will refresh.

            In my case I have a floating camera (not attached to a pawn). So here is basically what I do

            last = pc.Location;
            hell = loc;
            hell.Z = -100000;
            pc.SetLocation( hell )
            (wait 2 seconds)

            The other tricky part is there is no generic method in UDK (that I have found) that acts as a register to notify you the full screen viewport has changed sizes. However you can ask your UDKViewportClient "IsFullScreenViewport()". If you store the current status you can detect a change manually.


            • #7
              I would say the code sounds like a "dirty" method to get your job done. That's just me though.
              I had the same issue for quite some time till I ended up with exporting my terrain actors once each game map was completed and had them edited into static mesh actors(game supported on mobiles that way too). If your terrain actor is huge though that's not a solution. Landscape sounds like a better one.


              • #8
                Sorry, I didn't see the other post before the last one, so not sure what causes the crash. I assume you checked your logs etc.
                You could also try class'WorldInfo'.static.GetWorldInfo() instead of the GetGame() function. (Shouldn't make a difference, just trying to find reasons for the crash)
                Also the parameter for the call to OnScreenResize() is missing?

                Why does your sizeHasChanged bool from the post before not work to determine when the size changes?

                Edit: @ThePriest909 don't think that's a better solution and it is a lot more work and timeconsuming than those ~6 lines (also works for every terrain not just the one for a single map)


                • #9
                  1,find DefaultEngine->Engine.Engine then add "bPauseOnLossOfFocus=True"
                  2,overwrite the function in your hud class
                  event OnLostFocusPause(bool bEnable)
                  // do something when window active or deactive
                  3, when bEnable == false(window is actived),
                  then pull your camera to infinite pos for one frame,for example,
                  cam.Z = -100000;
                  just like Gedden 's solution, then next frame pull camera to normal pos

                  i test it , work fine, but any more official solution?