Announcement

Collapse
No announcement yet.

How to fade from base color to emissive color?

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

    How to fade from base color to emissive color?

    So basically what I'm trying to achieve is when the player looks at a specific object, the object goes from it's normal base color to it's highlighted emissive color to indicate it's been activated. But I want the emissive to fade in slowly and then permanently stay that emissive color. I don't want it to fade in and out, which is just about the only kind of tutorial I can find, and I can't seem to figure this out on my own. If someone could lead me in the right direction that'd be greatly appreciated, I feel like this should be relatively simple.

    Below is the material before looking at the object:
    Click image for larger version

Name:	norm.png
Views:	1
Size:	272.4 KB
ID:	1170388

    Below is the material at the end of the fade-in:
    Click image for larger version

Name:	highlight.png
Views:	1
Size:	279.7 KB
ID:	1170389

    #2
    Use the second material, add a scalar parameter to it, plug it into your multiply node on the bottom to multiply the green by it. Set the parameter from the blueprint that you use to determine if the object is being activated. Set it to a high value when it is activated, set to zero when deactivated, use interpolation to make it fade gradually.

    Comment


      #3
      I can post a picture of my material that does something similar if the picture would be easier to follow( I tend to look at the Blueprint pictures on the tutorials as I can tell whats happening faster like that then reading it )
      Steps:
      Add a "constant" type and convert it to a parameter by right clicking and selecting "convert to parameter".
      Use a "Lerp" math node with the Albedo/Diffuse texture in slot "A" and the Emissive in slot "B" with the constant we just created in the "Alpha" slot.
      (Wait, That is not going to give emissive)

      Take 2:
      Use two sets of "Constant" parameters to drive the "Lerp" for the Albedo/Diffuse and the Emissive.
      You can use one constant parameter to drive both, You would have to subtract the param from a "1.0" constant.
      So you would use two lerp nodes: One that fades from the Diffuse to black, And one that goes from black to the emissive colour( you could throw in another constant parameter to control the amount of emissive too).

      HTH
      Never say Never, Because Never comes too soon. - ryan20fun

      Frames Per Second is NOT a proper performance metric, You should use frame time. You can read this or this as to why.
      (Profiling) Tools: RenderDoc (UE4 Plugin), NVIDIA nSight, AMD GPU PerfStudio, CodeXL
      Good articles/Series: A trip through the Graphics Pipeline 2011

      Comment


        #4
        Here is what I've quickly put together for you.
        I used Event Begin Overlap to activate the effect, you can in any way you like, just call E_Activate or E_Deactivate.
        Blueprint:
        Click image for larger version

Name:	i0kevOn.png
Views:	1
Size:	611.2 KB
ID:	1098686

        Material:
        Click image for larger version

Name:	YdQ2qqt.png
Views:	1
Size:	252.7 KB
ID:	1098687

        Comment


          #5
          Wow, thank you so much for the very detailed walkthrough, VRLtqq! I ended up going with your more simplistic first post by adding the scalar parameter to my multiply node. Below is how I ended up getting the fade in when focusing at the object, and fading out when looking away (on blur is looking away from the object).

          Click image for larger version

Name:	timeline.png
Views:	1
Size:	137.6 KB
ID:	1098715

          But strangely, the finish executing pin fires before the timeline actually finishes. So if I look at the object and look away, starting the reverse process, it still executes finish almost immediately. What could be causing this? Or is it a possible glitch?

          Comment

          Working...
          X