Announcement

Collapse
No announcement yet.

A text that always rendered facing the camera

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

    A text that always rendered facing the camera

    Hi!
    I want to make a text which will float above the actor. It must always face the player's camera, it shouldn't be visible through the level geometry. Also it should preferably be independent of distance (always the same size). It can be used various ways including NPC name display, damage numbers, dialog subtitle bars etc.

    This blueprint does pretty much everything I need except it's not independent of distance and also it gets affected by post processing (especially by annoying blur effect). HUD example objective text is seen through obstacles which is unacceptable.

    Click image for larger version

Name:	test.png
Views:	1
Size:	149.1 KB
ID:	1134007

    Any thoughts of improving/other ways to accomplish this? (C++ is fine too)
    Hi!

    #2
    You could use a trace node to trace from the text to the player.

    The trace will also let you control visibility.

    This will give you the correct rotation to feed back into the text.

    I'm not sure on the scale though, maybe base it of the distance between the player and the actor?

    Comment


      #3
      Wait, where is the trace node located, is it a blueprint component? Also it still be affected by effects right?
      Hi!

      Comment


        #4
        Search for trace in the palette of the graph mode, and you see a bunch of them. You can read about them in the Docs if you need to.

        Comment


          #5
          It's a blueprint component, there are a few of them.

          The "Single line trace for objects" does what i'm talking about. You will also want to "Break Hit results"

          As an aside the UE4 devs just released this blueprint tut that uses this very node for a different purpose.

          https://www.youtube.com/watch?v=WwfsWr4A894

          Hope that helps!

          Click image for larger version

Name:	traceNode.jpg
Views:	1
Size:	43.8 KB
ID:	1050074

          Comment


            #6
            Originally posted by cazblue View Post
            It's a blueprint component, there are a few of them.
            To correct, those are not components, blueprint components are the ones that you can add in the components tab. The ones you use in the graph are generally called nodes, but these (traces) in particular are more specifically functions.

            Comment


              #7
              I've made a font material which makes text face always to camera. Material set to 'unlit'.

              My font material:
              Click image for larger version

Name:	text_material.png
Views:	2
Size:	105.5 KB
ID:	1050193

              Result:
              Click image for larger version

Name:	result.png
Views:	1
Size:	492.4 KB
ID:	1050194

              Now looking at 'ConstantScalebyDistance' I would say that it can be used to make text always the same size. But how?
              Hi!

              Comment


                #8
                Originally posted by fpcompany View Post
                ...
                Now looking at 'ConstantScalebyDistance' I would say that it can be used to make text always the same size. But how?
                Were you ever able to figure this out? How can the material control the scale?

                My desire is to have a min and max scale by distance on the text, where the closer you are the text stops scaling up and locks to a fixed max size, and when you are further away the text stops scaling down and locks to a fixed min size.

                Can't find any examples using this node. Seems promising though.

                Comment


                  #9
                  Hi, You can control the scale by this way:
                  Click image for larger version

Name:	constScale.png
Views:	1
Size:	98.9 KB
ID:	1108859

                  Comment


                    #10
                    Originally posted by antondoe View Post
                    Hi, You can control the scale by this way:
                    [ATTACH=CONFIG]98888[/ATTACH]
                    Hi antondoe,

                    Could you please provide a few more details as to how you achieved the constant scale? I don't seem to be able to implement it.

                    Thank you for you help!


                    Edit: I managed to implement the scaling by updating the scale in code every tick. I'm still curious about the way to do it in the material.
                    Last edited by Psi0991; 06-24-2016, 10:14 AM.

                    Comment


                      #11
                      Hi, sorry for late reply. this trick works for planes, that aligned to camera. it's good for text. but doesn't work for complex meshes. the idea beside is to offset each vertex in vertex pass towards a camera to make it be always on same distance to screen

                      Comment


                        #12
                        You might find this useful (dropdown world->screen) - a widget component can be set to render in screen space:

                        Click image for larger version

Name:	DZqe6JW.png
Views:	1
Size:	46.7 KB
ID:	1112368
                        My current question - Getting variables from unspawned actorcomponent

                        Our game - Robots Minerals Profit! - a side-on builder game with cooperative multiplayer, made in UE4.

                        Comment


                          #13
                          Originally posted by mbelarouci View Post
                          You might find this useful (dropdown world->screen) - a widget component can be set to render in screen space:

                          [ATTACH=CONFIG]102986[/ATTACH]
                          Geez, i totally overlooked that option. Thanks !
                          Currently working on Hexawing : https://twitter.com/JohnGGranier

                          Comment


                            #14
                            [MENTION=4254]fpcompany[/MENTION] great idea, but have you tried rotating base actor around Z axis in the world? It makes text go upside-down at 180 degrees.

                            Comment


                              #15
                              Originally posted by Flashback View Post
                              [MENTION=4254]fpcompany[/MENTION] great idea, but have you tried rotating base actor around Z axis in the world? It makes text go upside-down at 180 degrees.
                              Hi there
                              Sorry for not being able to answer for so long, havent log in for awhile
                              First, I now use the '3d widget' with text inside to display NPC names because it does not get affected by post processing, lighting etc.
                              Next, on actor's tick I set widget's world rotation to camera's world rotation and then I add local z-180 degrees.
                              Hi!

                              Comment

                              Working...
                              X