Easy way to "fade" a map input?

Node-based Shader Editor

Easy way to "fade" a map input?

Postby jurassic_queer » Wed Aug 30, 2017 10:20 pm

I'm trying to create a shader that has a grunge node that can be faded on and off on top of a texture, but I haven't found a way to really do that. I'm using packed materials, so I'd have my albedo, normal, and a packed texture containing AO, metallic, and gloss. On top of that I want a global dirt layer I can control with a slider that has a mask for the dirt so it doesn't turn on as a solid block of color.

Currently, I'm either getting weird overly saturated colors if I try to use floats and multiple/add and just trying to multiply it over the texture itself ends up really dark. I'd like to control both how much "fade" the dirt has and also value. I've been really struggling trying to get anything that feels like a Photoshop overlay style filter and nothing adequately allows tuning the opacity of a single map.

This would be used for stuff like amount of dirt on ground pieces or just applying some overall grunge to something that is clean elsewhere without needing to make 2 texture variants.
jurassic_queer
 
Posts: 11
Joined: Thu Jul 20, 2017 4:40 pm

Re: Easy way to "fade" a map input?

Postby Amplify_Borba » Thu Aug 31, 2017 11:13 am

Hello!

Would it be possible for you to send us a sample of your shader so we can better understand how you're trying to achieve this?

Thanks!
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Easy way to "fade" a map input?

Postby jurassic_queer » Thu Aug 31, 2017 6:37 pm

Image

In short, I have 4 Substance sample inputs that Lerp together using a packed mask that contains a black and white mask each on RGB and a metallic mask on A. Metallic amount is driven by a multiply and a float, Smoothness is its own single float, and each Albedo map has a color input that can be multiplied on top of it for simple color adjustments. Substance Sample is used to conveniently keep Albedo and Normal tiling together and within the material itself I can plug in any texture maps I want.

Image

The masks end up looking like this, saved as a .tif with alpha. Each channel is just a B&W mask that drives one of the Substance Sample inputs and the Alpha channel controls the metallic mask, if it needs metallic at all. Things that don't require a mask for Metallic, either because they have none or the whole thing is metallic, are just driven through the Metallic slider. Pretty straightforward there.

Image

I have to rename and re-organize things through a text editor because it only wants to accept the names of the base Substance Sample (and for some reason blank Substance Samples don't work? Only have Albedo) and organizes them alphabetically. A bit annoying because it overrides those names every time I save the shader.

Image

Now, what I want is to take the existing graph I have and, here's where I'm stuck, have another Texture Sample for a dirt/grunge that I can overlay on top of the albedo with a slider to adjust how much dirt there is. I don't want the grunge texture to be a solid color on top of the albedo, it needs a mask to break it up and allow the existing textures to be seen through it. Adjusting both how MUCH dirt there is AND the opacity of the dirt itself.

Image

For example, this Substance material that I have has a slider for patina on this metal, and it goes from zero grunge to 100% grunge. I don't need something that adjusts the mask's coverage like this example, just a slider where 0 = no grunge, .5 = 50% opacity grunge, and 1 = 100% opacity grunge.

I hope that helps explain what I'm trying to do! So far nothing has really given me the results I want. It seems like something that should be pretty straightforward, and it certainly is with other shader options like Substance Designer. I feel like I'm either missing something or what I want sounds easier on paper than it is in practice.
jurassic_queer
 
Posts: 11
Joined: Thu Jul 20, 2017 4:40 pm

Re: Easy way to "fade" a map input?

Postby Amplify_Borba » Fri Sep 01, 2017 1:36 pm

Thank you for the additional information!

I'm sending you a sample in attachment that might be helpful, you may also check out our "Snow Accumulation" sample as it should also be perfect for what you're trying to achieve.

Please let me know if either of them were useful!
Attachments
MixExample.zip
(3.18 KiB) Downloaded 163 times
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Easy way to "fade" a map input?

Postby jurassic_queer » Tue Sep 05, 2017 4:26 pm

This makes a lot of sense! See, I knew it was something relatively simple and I just wasn't thinking of it in the right way. Thanks so much, I'm going to try this on my main shader as soon as Unity finishes opening.

The Snow Accumulation shader is actually one I keep finding myself going back to for a pretty wide variety of shaders. Though I was curious, is there a way to invert Y when using World Normals or Vertex Position? Having the ability to project from beneath an object would be very useful.
jurassic_queer
 
Posts: 11
Joined: Thu Jul 20, 2017 4:40 pm

Re: Easy way to "fade" a map input?

Postby Amplify_Borba » Tue Sep 05, 2017 5:17 pm

jurassic_queer wrote:This makes a lot of sense! See, I knew it was something relatively simple and I just wasn't thinking of it in the right way. Thanks so much, I'm going to try this on my main shader as soon as Unity finishes opening.

The Snow Accumulation shader is actually one I keep finding myself going back to for a pretty wide variety of shaders. Though I was curious, is there a way to invert Y when using World Normals or Vertex Position? Having the ability to project from beneath an object would be very useful.


Glad to be of help!

You may use the "One Minus" node in order to invert a value, in the following screenshot I've added the node to invert the output of Y in the World Normal in order to achieve what I believe is your intended result.

On a side note, you may hold ALT to drag a node onto a line in order for it to automatically connect, and the opposite applies as well.
Attachments
OneMinus.jpg
OneMinus.jpg (139.34 KiB) Viewed 3429 times
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Easy way to "fade" a map input?

Postby jurassic_queer » Tue Sep 05, 2017 7:43 pm

Thank you! Time to reconfigure some shaders and use the One Minus in there. Very useful!
jurassic_queer
 
Posts: 11
Joined: Thu Jul 20, 2017 4:40 pm

Re: Easy way to "fade" a map input?

Postby Amplify_Borba » Wed Sep 06, 2017 9:52 am

jurassic_queer wrote:Thank you! Time to reconfigure some shaders and use the One Minus in there. Very useful!


No worries, glad to be of assistance!

Have you had the chance to rate and review Amplify Shader Editor? It would be awesome if you could share your experience with the Unity community, the Unity Asset Store thrives on user interaction and direct feedback.
Every bit helps, your feedback is extremely valuable to us!

Feel free to get back in touch if you have any further issues or questions!
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am


Return to Amplify Shader Editor

Who is online

Users browsing this forum: No registered users and 0 guests

cron