x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Make Outline material fade/hide with distance

Greetings,

I'm using a simple outline material within my PostProcess Blendables to make a custom hover/non hover effects over all props I need. Sometimes, on a big distances this looks ugly because this effect scales up with distance. So I'm interested in fading/hiding this effect from a player camera over 1000 meters or more. Is it possible to achieve and how it possible if so?

Thank you.

Product Version: UE 4.12
Tags:
more ▼

asked Aug 16 '16 at 07:28 PM in Rendering

avatar image

Medvega
28 3 5 11

avatar image Threshold Seven May 03 '17 at 09:47 PM

Would love to figure this out also.

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

Figured it out. alt text

Duplicate your outline script. Add a new Lerp node and plug it into emissive. Plug The original outline script into Lerp A. Plug the duplicate outline into Lerp B. Add the script in the image to the Alpha. Mess with the Divide and Power constant to determine the best fade from first person camera for your situation. Mine is 250000 Divide, .5 Power. On the Duplicate script (plugged into B) in my case, I just turned the parameters to 0 (line width, bloom, etc.) which effectively shuts the outline off, so it fades from the original outline to no outline in the distance. If you want to, you can compound this script and have it fade in layers, for example, near outlines could be blue, then they fade to yellow in the distance and then fade out completely far away. This fade script is similar to how I fade ground textures out in the distance.

outline fade.png (221.7 kB)
more ▼

answered May 04 '17 at 04:25 AM

avatar image

Threshold Seven
64 2 3 10

avatar image Threshold Seven May 04 '17 at 04:29 AM

You can also just unplug the view size node at the beginning of the script and the line will get thinner as the object gets farther away, but it will never fully disappear and objects far in the distance will be a clump of black lines (if you are using black as an outline). If you want to have it fade nicely to no outline at all, just plug in the regular scenetexture node into B instead of the duplicate script. I added this script to completely fade out and shut the outline off at distance however because it looks better in my scene when really far away objects do not have a black outline and the performance is much better (I'm using this as a black outline for a stylized graphic art look to all the assets in my game world with a very subtle thin line around objects in relatively close proximity, but leaving the background looking painted which is a common style in old cartoons and comics where only the objects in the foreground have a black outline. I needed the fade, because it is an open world and you can walk to objects that you see in the distance and the outline gradually fades in as you approach closer to the objects, everything from rocks to pickup items to trees)

avatar image Medvega May 17 '17 at 08:54 PM

Thank you :)

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question