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"

Invert Alpha Channel Math?

I am trying to invert an alpha channel of a texture but the math seems to be coming out incorrect using a OneMinus. Is this a common problem? Does an Alpha channel us a different range than R, G, B?

I'm inputting the alpha into the roughness of a material, does roughness require a different range over base colour?


Product Version: Not Selected
more ▼

asked May 31 '14 at 07:17 PM in Rendering

avatar image

10 3 6 8

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

You cant get the best result if you plug the roughness map directly into roughness input. Try using it as the alpha of a Lerp node, then set the values within that Lerp for min. and max. roughness. This way you wont even have to invert the texture since you can just switch the input of the values as you wish.

more ▼

answered May 31 '14 at 07:29 PM

avatar image

16.8k 671 167 677

avatar image Pugzilla Jun 02 '14 at 08:38 AM

Thanks for your support Jacky, I tried Lerp but it produced the same results. I think I might have gotten to the bottom of it though, I'm not sure when or if the gamma correction is applied in the process of calculating the map. I spoke to some friends and got some advice to try and Power0.45, OneMinus then Power2.2 to essentially remove gamma correction, invert the texture then add it back on again. I'm going to try it when I get home and fingers crossed it gives me accurate results.

avatar image Pugzilla Jun 02 '14 at 05:05 PM

Well, I managed to almost get an identical result. But the solution was incredibly strange and honestly have no idea whats going on.

I had to add a Power 0.55 then invert the result with OneMinus. I have no idea why I have to use a power of 0.55 as that doesn't fit onto any known gamma value.

Is it possible I could also be causing problems with incorrect Photoshop settings?

avatar image Jacky Jun 02 '14 at 05:07 PM

Can you show us the textures and your material setup, and what exactly you want it to look like please?

avatar image Pugzilla Jun 02 '14 at 05:15 PM

So both textures where imported with SRGB ticked, one was inverted in Photoshop, the other was inverted in the material editor. Both using an output of Alpha and both previewing the result of what is going into the Roughness channel.

The reason I'm striving to get the math perfect is because PBR relies heavily on very fine values. I want to make sure those values are spot on. I know I could simply author my Roughness inverted, but its not the way I'm used to working and have a lot of art already created with it the other way around from UnrealEngine.

avatar image Jacky Jun 02 '14 at 10:01 PM

Well, i'm by no means an expert, but let me explain how i'd manage my masks and the basic material, and hopefully it'll be helpful to you.

The first thing i'd do is store the metallic and roughness maps in red and green channels of a single texture. All you need for roughness and metallic is values between 0 and 1 so you can store and get those in a single channel for each. Then use Lerp to mask the minimum and maximum values you want to have for each map and input, and that's pretty much it. Later on you can multiply and Lerp more masks to get more details if you like.

I'm still not sure why you are trying to invert the alpha so feel free to head to the forums to get more perspective on this. Not everyone checks AnswerHub so you may find more experienced people lurking around there.

avatar image Pugzilla Jun 06 '14 at 01:38 PM

Yeah I think I will re-evaluate how I'm going about breaking up my maps. Thanks for all the help guys!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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