Announcement

Collapse
No announcement yet.

UI Render To Texture

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    Wow slowJusko ! Your work is great ! I just need sth like that !

    I have some question about your tutorial.
    1.First, Did you use SetExternalTexture() ? is this your pipeline : sceneCapture2dActor => a TextureRenderTarget2D => HUD ?
    or you use UILoader. I knew UILoader as a Scaleform componet for flash-side to show Texture2Ds . Is that what you used ? If yes, I cant make it to show a TextureRenderTarget2D !
    2. How you remove around your mesh ? UILoader.alpha=255 ? I cant get it.

    In another word, What is need in addition to Matt Doyle tutorial of setExternalTexture() , to make around area of target mesh transparent ( instead of "clear color" of camera) like youe weapons in bottom of screen?

    I will be glad if anyone else help me too. And maybe a more detailed tutorial ( preferably AS2 )

    Thanks for answering my noobie but life-saving questions




    More:
    This is what I've done:

    1.


    2.


    3.

    Leave a comment:


  • replied
    ok...here is my GFX Class

    Code:
    class SLGFxPortraitHUD extends GFxMoviePlayer;
    
    Var TextureRenderTarget2D PortraitRT;
    var GFxClikWidget MyScaleformRTTObject;
    
    //Called from STHUD'd PostBeginPlay()
    function Init2(PlayerController PC) {
     //Start and load the SWF Movie
     Start();
     Advance(0.f);
    
    }
    
    
    
    //Called every update Tick
    function TickHUD() 
    {
        /*local UserPawn USP;
    
        //We need to talk to the Pawn, so create a reference and check the Pawn exists
        USP = UserPawn(PlayerOwner.Pawn);
        if (USP == None) 
        {
            return;
        }
    */
        
    }
    
    function SetRenderTexture()
    {
       SetExternalTexture("portrait",PortraitRT);
    }
    
    
    function SetMyRTTTexture(string NewTexturePath)
    {
        local string FinalTexturePath;
        
        FinalTexturePath = "img://" $ NewTexturePath;
        
        MyScaleformRTTObject.SetString("source", FinalTexturePath);
    }
    
    event bool WidgetInitialized(Name WidgetName, Name WidgetPath, GFxObject Widget)
    {
        local bool bResult;
        
        switch(WidgetName)
        {
            case 'MyScaleform_RTT':
                MyScaleformRTTObject = Widget;
                bResult = true;
                break;
        }
        
        return bResult ? bResult : Super.WidgetInitialized(WidgetName, WidgetPath, Widget);
    }            
    
    
    DefaultProperties
    {
     //this is the HUD. If the HUD is off, then this should be off
     bDisplayWithHudOff=false
     //The path to the swf asset we will create later
     MovieInfo=SwfMovie'SL_HUD.HUD.SLPortrait'
     //Just put it in...
     bGammaCorrection = false
     portraitRT=TextureRenderTarget2D'SL_HUD.HUD.PortraitRT'
    
            SubWidgetBindings.Add((WidgetName="MyScaleform_RTT",WidgetClass=class'GFxObject'))
    }

    Leave a comment:


  • replied
    With out seeing it in context, I have no idea why it is saying MyScaleformRTTObject is a 'type' then

    Leave a comment:


  • replied
    Ya I do have that

    Leave a comment:


  • replied
    It should be a GFxClikWidget variable.
    Code:
    var GFxClikWidget MyScaleformRTTObject;
    Not sure why it'd be complaing about it being a 'type'.... ?

    Leave a comment:


  • replied
    I'm getting this errer:

    Code:
    C:\UDK\UDK-2012-10\Development\Src\SLGame\Classes\SLGFxPortraitHUD.uc(49) : Error, Unrecognized type 'MyScaleformRTTObject'

    Leave a comment:


  • replied
    That was strange.
    Fixed/update the video link.
    Should now show what I was talking about.
    Streaming render of your head is replaced with a rockets view when one is fired.
    The scaleform object does not change - just the texture being sent to it.

    Leave a comment:


  • replied
    You mean your video?

    Leave a comment:


  • replied
    I tried swapping the "source" of UILoader based GFXObject.
    Works fine for your basic rectangle (see video).

    If you can't wait for me to upload it somewhere, send me your e-mail

    Leave a comment:


  • replied
    Thanks, slow jusko...but not sure how to implement that (probably didnt ask the question right)...this is what I needed:
    http://forums.epicgames.com/threads/...2#post31537392

    Leave a comment:


  • replied
    Originally posted by weiping.zhao View Post
    Hi,
    It is really a good tutorial.
    I have tried it, it works great on PC. But it shows nothing on xbox360.
    Do you know what could be the issues?
    I have no experience with the xbox360 & UDK.
    All I can do is suggest that it is a 360 related Scaleform/UScript issue that you'd need to talk to Epic/someone with 360 experience to fix.

    Originally posted by Kelt'ar View Post
    Noice, but how do you get this guy to switch between capture actors?
    Should just be able to change the 'source' of the loader.

    Enable the callback in your RTT loader:
    Code:
                    // If you need to turn them on/off etc, enabled this.
                    RTTLoader.enableInitCallback = true;
    Catch it in WidgetInitialized(), then call SetString():
    Code:
    var GFxClikWidget MyScaleformRTTObject;
    
    function SetMyRTTTexture(string NewTexturePath)
    {
        local string FinalTexturePath;
        
        FinalTexturePath = "img://" $ NewTexturePath;
        
        MyScaleformRTTObject.SetString("source", FinalTexturePath);
    }
    
    event bool WidgetInitialized(Name WidgetName, Name WidgetPath, GFxObject Widget)
    {
        local bool bResult;
        
        switch(WidgetName)
        {
            case 'MyScaleform_RTT':
                MyScaleformRTTObject = Widget;
                bResult = true;
                break;
        }
        
        return bResult ? bResult : Super.WidgetInitialized(WidgetName, WidgetPath, Widget);
    }            
    
    defaultproperties
    {
        SubWidgetBindings.Add((WidgetName="MyScaleform_RTT",WidgetClass=class'GFxObject'))
    }

    ^ Untested.
    First thing I thought of and it seems logical.

    I don't use the RTT's in Scaleform for any sort of remote camera - just the inventory/loadout manipulation. As a result, can just swap out the actors that are in front of the SCA's view. The only extra tweak I do is to adjust the the SCA's FOV and nearplane depending on the size of the actor in front of it.

    Leave a comment:


  • replied
    Noice, but how do you get this guy to switch between capture actors?

    Leave a comment:


  • replied
    Hi,
    It is really a good tutorial.
    I have tried it, it works great on PC. But it shows nothing on xbox360.
    Do you know what could be the issues?

    Leave a comment:


  • replied
    My bad - I was assuming prior knowledge of using render targets.
    With prior knowledge, its good as-is :P
    I should really get a good place to upload stuff.

    Leave a comment:


  • replied
    Which blog "is good as-is"?

    A reminder: i came to this thread when you mentioned elsewhere that there were clues about rendering to texture in here.
    (And by "render", I mean "display a 3d staticmesh on it")
    My goal is to show them in the same way that the Content Browser does.


    In your blog at http://krisredbeard.wordpress.com/tu...exture/‎ (and above) you mention the existance of class'TextureRenderTarget2D', but it isnt made clear how you actually *use* one, once you have gotten an instance of it.

    Leave a comment:

Working...
X