Results 1 to 9 of 9
  1. #1
    MSgt. Shooter Person
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    186

    Default 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?

    Code:
    function OnScreenResize()
    {
    	super.OnScreenResize();
    	_minimap.RebufferAll();
    
    
    	RebufferMap();
    }
    
    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. #2
    Redeemer
    Join Date
    Dec 2008
    Location
    Germany
    Posts
    1,562

    Default

    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).
    Youtube - UnrealEverything

    2B || !(2B)

  3. #3
    Palace Guard

    Join Date
    Jun 2007
    Location
    Christchurch
    Posts
    3,781

    Default

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

  4. #4

    Default

    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.
    I'm making a game!

    http://www.desura.com/games/modulated
    Click the link above to read more!

  5. #5
    MSgt. Shooter Person
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    186

    Default

    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:

    Code:
    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 )
    	{
    		terrainData.SetHidden(true);	
    		terrainData.SetHidden(false);	
    	}
    }
    
    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. #6
    MSgt. Shooter Person
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    186

    Default

    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

    Code:
    last = pc.Location;
    hell = loc;
    hell.Z = -100000;
    
    class'Engine'.static.PlayLoadMapMovie();
    pc.SetLocation( hell )
    
    (wait 2 seconds)
    
    pc.SetLocation(last);
    class'Engine'.static.StopMovie(true);

    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. #7
    Redeemer
    Join Date
    Nov 2009
    Location
    Crete
    Posts
    1,044

    Default

    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. #8
    Redeemer
    Join Date
    Dec 2008
    Location
    Germany
    Posts
    1,562

    Default

    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)
    Last edited by UnrealEverything; 07-22-2012 at 03:26 PM.
    Youtube - UnrealEverything

    2B || !(2B)

  9. #9

    Default

    1,find DefaultEngine->Engine.Engine then add "bPauseOnLossOfFocus=True"
    2,overwrite the function in your hud class
    event OnLostFocusPause(bool bEnable)
    {
    Super.OnLostFocusPause(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?
    Last edited by keeponshoot; 01-17-2013 at 03:42 AM.


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.