Announcement

Collapse
No announcement yet.

Rendering pixels to a Render Target 2D VERY slow and/or does not work

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

    Rendering pixels to a Render Target 2D VERY slow and/or does not work

    Hi,

    I have included a blueprint graph that renders to every pixel in a render target 2D. It works if the render target is 256x256 (if a little slow) but totally fails at 512x512.

    I understand that the DrawTexture node is not ideal for setting each pixels color but Unreal does not seem to have a DrawPixel function.

    I have tried this same technique in C++ also but it just does the same.

    The problem is, Unreal seems to let the DrawTexture function queue up a load of drawitems and then when you run EndDrawCanvasToRenderTarget it succeeds at 256 resolution but fails at 512.

    When it fails, the editor just hangs and never recovers.

    Any ideas would be appreciated.

    I tried this blueprint in UE 4.23 and 4.24 but both are the same.
    Last edited by 3dev; 12-12-2019, 10:51 AM.

    #2
    It is not something that you should be doing at all and no surprise that attempting to draw 262144 times in a single frame would not work.

    Comment


      #3
      For simple Color gradients, you are better off using DrawMaterial and using a designated Material

      Comment


        #4
        Thanks for your replies guys.

        Perhaps I should add some context to this:

        The blueprint to render this texture is only to be used from the editor via a "Render Texture" button to produce one single texture. If not this way, then I need a way to create a texture myself using code. Unfortunately, out of the box, Unreal Engine does not seem to offer this functionality.

        The gradient that this renders is only for demonstrating the blueprint successfully rendering to the render target across the entire array of pixels with a unique color.

        As an example, how would a custom noise be rendered to the texture with a calculation performed per pixel? Especially if you wanted to evaluate some kind of data or mathematical calculation to create the final pixels color.

        In my mind it is perfectly fine to create a texture in this way in the editor. I would not dream of doing this kind of rendering during game play :/

        Any suggestions would be welcomed, thank you.
        Last edited by 3dev; 12-12-2019, 05:38 PM.

        Comment


          #5
          Originally posted by 3dev View Post
          Thanks for your replies guys.

          Perhaps I should add some context to this:

          The blueprint to render this texture is only to be used from the editor via a "Render Texture" button to produce one single texture. If not this way, then I need a way to create a texture myself using code. Unfortunately, out of the box, Unreal Engine does not seem to offer this functionality.

          The gradient that this renders is only for demonstrating the blueprint successfully rendering to the render target across the entire array of pixels with a unique color.

          As an example, how would a custom noise be rendered to the texture with a calculation performed per pixel? Especially if you wanted to evaluate some kind of data or mathematical calculation to create the final pixels color.

          In my mind it is perfectly fine to create a texture in this way in the editor. I would not dream of doing this kind of rendering during game play :/

          Any suggestions would be welcomed, thank you.
          That is... terrible, ugly, dirty and hacky, But it works ><. Should just copy over the data instead. In case if for some reason you wish to proceed, split the work done into multiple frames, like doing only one texture column per frame over times rows frames and you will be fine.

          Comment


            #6
            I didn't realize there was a way to "copy over the data"?

            Are you saying there is a way to create the data structure necessary to just render it once to the render target? or somehow manipulate a texture array of colors?

            Comment


              #7
              Originally posted by 3dev View Post
              I didn't realize there was a way to "copy over the data"?

              Are you saying there is a way to create the data structure necessary to just render it once to the render target? or somehow manipulate a texture array of colors?
              Yep, but that is not something you can do in blueprints alone.

              Comment

              Working...
              X