Using normalmap blue channel for greyscale mask issue

Hey, I’m trying to save some texture memory by using the blue channel of my normalmap as a mask. However, in doing so my normalmap seems to get weird black artifacts that I can’t get rid of.

Does anyone know what could be causing these black lighting errors? I believe I’ve imported the texture and set it up correctly. I could not find the settings for getting the normalmap in the correct range in the texture so I set it up…I think…in the material instead. I’ve tried a dozen different things and sometimes it almost seems to work, but in the end I get these black errors in the normalmap. It looks fine if I just use the normalmap the way it’s “supposed” to be used with the normalmap compression settings and so on.


Anyone? Is there a better way of doing this? Or a tutorial to be found somewhere?

Could be compression issue. Overal I’m not sure if it makes sense to do this. When you import 3 channel normal map and set its compression to Normal, ue4 will use BC5 compression which doesn’t store Z component. There is a separate compression for gray scale masks too. Are you doing this to minimize amount of texture samplers?

This is really counter productive way. Normal maps need to be stored two channel format. Both channels are high quality. If you don’t use compression and sampler mode normal then you get really bad looking artefacts. Better way to save memory is to use smaller textures. Normalmap even with half res texture(1/4 memory) with correct compression settings is better looking than butchered DXT1 texture.

The idea is to use the blue channel for smoothness or occlusion map and recreate the blue channel for the normal in the shader. To reduce texture sample calls (I won’t need to add one extra texture to the shader) and potentially save some memory. The actual normalmap looks fine when it comes to compression artifacts and such, I don’t see much difference, except for the black artifacts that show up in some areas, I’m thinking I might be doing something wrong in the shader giving the normalmap extreme values in some areas.

Edit/ Ah, this is sort of what I was looking for, going to see if that helps. Perhaps it won’t be worth the quality loss from dxt compression but we’ll see.

Set it up like this:

@anonymous_user_74354b6d
This is happening when sum of your R and G channels squared is more than 1, resulting in attempts to pull out square root from negative number and returning NaN. The root cause of this is essentially the fact, that your normal map was not normalized before export(yet even that can’t gurantee the same issue happening due to compression artifacts). UE4 is handling this for you internally, when you use a normal map sampler. If other sampler is used, you will have to do it yourself. One of the ways to handle it was linked in post above by @Maximum-Dev, and here is another one, virtually the same, but exactly as it is done in the engine shaders:

http://image.prntscr.com/image/3e8cb64474be40df9d4f46e8e8ad7611.png

Material Graph code:
[SPOILER]


Begin Object Class=MaterialGraphNode Name="MaterialGraphNode_28"
   Begin Object Class=EdGraphPin Name="EdGraphPin_4630"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_4629"
   End Object
   Begin Object Class=MaterialExpressionFunctionOutput Name="MaterialExpressionFunctionOutput_3"
   End Object
   Begin Object Name="EdGraphPin_4630"
      PinName="Output"
      PinFriendlyName=" "
      Direction=EGPD_Output
   End Object
   Begin Object Name="EdGraphPin_4629"
      PinName="Input"
      PinFriendlyName=" "
      PinType=(PinCategory="required")
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_39.EdGraphPin_4657'
   End Object
   Begin Object Name="MaterialExpressionFunctionOutput_3"
      OutputName="UnpackedNormals"
      A=(Expression=MaterialExpressionAppendVector'MaterialGraphNode_39.MaterialExpressionAppendVector_4')
      Id=4F3B6FEB4F169A4B476316AA86BA6BFB
      MaterialExpressionEditorX=898
      MaterialExpressionEditorY=338
      MaterialExpressionGuid=C64A6E14409D60A9E09366AA7978B68E
      Material=Material'/Engine/Transient.Material_1'
   End Object
   MaterialExpression=MaterialExpressionFunctionOutput'MaterialExpressionFunctionOutput_3'
   Pins(0)=EdGraphPin'EdGraphPin_4629'
   Pins(1)=EdGraphPin'EdGraphPin_4630'
   NodePosX=898
   NodePosY=338
   NodeGuid=4E8A27BC441310A0B6E432B49FE1E265
End Object
Begin Object Class=MaterialGraphNode Name="MaterialGraphNode_29"
   Begin Object Class=EdGraphPin Name="EdGraphPin_4632"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_4631"
   End Object
   Begin Object Class=MaterialExpressionFunctionInput Name="MaterialExpressionFunctionInput_3"
   End Object
   Begin Object Name="EdGraphPin_4632"
      PinName="Output"
      PinFriendlyName=" "
      Direction=EGPD_Output
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_30.EdGraphPin_4633'
   End Object
   Begin Object Name="EdGraphPin_4631"
      PinName="Preview"
      PinType=(PinCategory="optional")
   End Object
   Begin Object Name="MaterialExpressionFunctionInput_3"
      InputName="NormalMap_R_G"
      Id=2A8148DE42ECD1A056B4719B60161A41
      InputType=FunctionInput_Vector2
      PreviewValue=(X=0.720000,Y=0.560000,Z=0.000000,W=1.000000)
      bUsePreviewValueAsDefault=True
      MaterialExpressionEditorX=-590
      MaterialExpressionEditorY=354
      MaterialExpressionGuid=1A50A413480465E52EE7A8B1E8F62721
      Material=Material'/Engine/Transient.Material_1'
   End Object
   MaterialExpression=MaterialExpressionFunctionInput'MaterialExpressionFunctionInput_3'
   Pins(0)=EdGraphPin'EdGraphPin_4631'
   Pins(1)=EdGraphPin'EdGraphPin_4632'
   NodePosX=-414
   NodePosY=402
   NodeGuid=C1BB5C614700F4854D2481BB46B08AA1
End Object
Begin Object Class=MaterialGraphNode Name="MaterialGraphNode_30"
   Begin Object Class=EdGraphPin Name="EdGraphPin_4635"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_4634"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_4633"
   End Object
   Begin Object Class=MaterialExpressionMultiply Name="MaterialExpressionMultiply_6"
   End Object
   Begin Object Name="EdGraphPin_4635"
      PinName="Output"
      PinFriendlyName=" "
      Direction=EGPD_Output
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_31.EdGraphPin_4636'
   End Object
   Begin Object Name="EdGraphPin_4634"
      PinName="B"
      PinType=(PinCategory="optional")
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_32.EdGraphPin_4639'
   End Object
   Begin Object Name="EdGraphPin_4633"
      PinName="A"
      PinType=(PinCategory="optional")
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_29.EdGraphPin_4632'
   End Object
   Begin Object Name="MaterialExpressionMultiply_6"
      A=(Expression=MaterialExpressionFunctionInput'MaterialGraphNode_29.MaterialExpressionFunctionInput_3')
      B=(Expression=MaterialExpressionConstant'MaterialGraphNode_32.MaterialExpressionConstant_10')
      ConstB=2.000000
      MaterialExpressionEditorX=-64
      MaterialExpressionEditorY=432
      MaterialExpressionGuid=3BC34D9F4CF7DAB9B3DFEEA9C582CB06
      Material=Material'/Engine/Transient.Material_1'
   End Object
   MaterialExpression=MaterialExpressionMultiply'MaterialExpressionMultiply_6'
   Pins(0)=EdGraphPin'EdGraphPin_4633'
   Pins(1)=EdGraphPin'EdGraphPin_4634'
   Pins(2)=EdGraphPin'EdGraphPin_4635'
   NodePosX=-16
   NodePosY=416
   NodeGuid=6044932C42FC3BADD8679FA3775E6DE5
End Object
Begin Object Class=MaterialGraphNode Name="MaterialGraphNode_31"
   Begin Object Class=EdGraphPin Name="EdGraphPin_4638"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_4637"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_4636"
   End Object
   Begin Object Class=MaterialExpressionSubtract Name="MaterialExpressionSubtract_3"
   End Object
   Begin Object Name="EdGraphPin_4638"
      PinName="Output"
      PinFriendlyName=" "
      Direction=EGPD_Output
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_35.EdGraphPin_4644'
      LinkedTo(1)=EdGraphPin'MaterialGraphNode_35.EdGraphPin_4645'
      LinkedTo(2)=EdGraphPin'MaterialGraphNode_39.EdGraphPin_4655'
   End Object
   Begin Object Name="EdGraphPin_4637"
      PinName="B"
      PinType=(PinCategory="optional")
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_33.EdGraphPin_4640'
   End Object
   Begin Object Name="EdGraphPin_4636"
      PinName="A"
      PinType=(PinCategory="optional")
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_30.EdGraphPin_4635'
   End Object
   Begin Object Name="MaterialExpressionSubtract_3"
      A=(Expression=MaterialExpressionMultiply'MaterialGraphNode_30.MaterialExpressionMultiply_6')
      B=(Expression=MaterialExpressionConstant'MaterialGraphNode_33.MaterialExpressionConstant_11')
      MaterialExpressionEditorX=48
      MaterialExpressionEditorY=432
      MaterialExpressionGuid=74B15C544F5FFFD46F9073B71B9A97EB
      Material=Material'/Engine/Transient.Material_1'
   End Object
   MaterialExpression=MaterialExpressionSubtract'MaterialExpressionSubtract_3'
   Pins(0)=EdGraphPin'EdGraphPin_4636'
   Pins(1)=EdGraphPin'EdGraphPin_4637'
   Pins(2)=EdGraphPin'EdGraphPin_4638'
   NodePosX=96
   NodePosY=416
   NodeGuid=19C7583C41D1D7AD6BF7F79097BB6EFC
End Object
Begin Object Class=MaterialGraphNode Name="MaterialGraphNode_32"
   Begin Object Class=EdGraphPin Name="EdGraphPin_4639"
   End Object
   Begin Object Class=MaterialExpressionConstant Name="MaterialExpressionConstant_10"
   End Object
   Begin Object Name="EdGraphPin_4639"
      PinName="Output"
      PinFriendlyName=" "
      Direction=EGPD_Output
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_30.EdGraphPin_4634'
   End Object
   Begin Object Name="MaterialExpressionConstant_10"
      R=2.000000
      MaterialExpressionEditorX=-160
      MaterialExpressionEditorY=480
      MaterialExpressionGuid=124751F4404EC346725846A33C1A0177
      Material=Material'/Engine/Transient.Material_1'
   End Object
   MaterialExpression=MaterialExpressionConstant'MaterialExpressionConstant_10'
   Pins(0)=EdGraphPin'EdGraphPin_4639'
   NodePosX=-112
   NodePosY=464
   NodeGuid=35DC5F47474526A211F524A2F42EA393
End Object
Begin Object Class=MaterialGraphNode Name="MaterialGraphNode_33"
   Begin Object Class=EdGraphPin Name="EdGraphPin_4640"
   End Object
   Begin Object Class=MaterialExpressionConstant Name="MaterialExpressionConstant_11"
   End Object
   Begin Object Name="EdGraphPin_4640"
      PinName="Output"
      PinFriendlyName=" "
      Direction=EGPD_Output
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_31.EdGraphPin_4637'
   End Object
   Begin Object Name="MaterialExpressionConstant_11"
      R=1.000000
      MaterialExpressionEditorX=-16
      MaterialExpressionEditorY=528
      MaterialExpressionGuid=7CACE24648B68B7B325A209FB4D35F91
      Material=Material'/Engine/Transient.Material_1'
   End Object
   MaterialExpression=MaterialExpressionConstant'MaterialExpressionConstant_11'
   Pins(0)=EdGraphPin'EdGraphPin_4640'
   NodePosX=32
   NodePosY=512
   NodeGuid=A92A29B343355C94875CBEB5880F19C2
End Object
Begin Object Class=MaterialGraphNode_Comment Name="MaterialGraphNode_Comment_2"
   Begin Object Class=MaterialExpressionComment Name="MaterialExpressionComment_12"
   End Object
   Begin Object Name="MaterialExpressionComment_12"
      SizeX=352
      SizeY=240
      Text="Convert from 0 to1  into -1 to 1 range"
      CommentColor=(R=0.987289,G=1.000000,B=0.622549,A=1.000000)
      MaterialExpressionEditorX=-144
      MaterialExpressionEditorY=352
      MaterialExpressionGuid=586F7A2D4C99C49B206945A9EC76D337
   End Object
   MaterialExpressionComment=MaterialExpressionComment'MaterialExpressionComment_12'
   CommentColor=(R=0.987289,G=1.000000,B=0.622549,A=1.000000)
   NodePosX=-144
   NodePosY=352
   NodeWidth=352
   NodeHeight=240
   NodeComment="Convert from 0 to1  into -1 to 1 range"
   NodeGuid=DB7CCA424AE492F74D13B2B1CA073C93
End Object
Begin Object Class=MaterialGraphNode_Comment Name="MaterialGraphNode_Comment_3"
   Begin Object Class=MaterialExpressionComment Name="MaterialExpressionComment_13"
   End Object
   Begin Object Name="MaterialExpressionComment_13"
      SizeX=272
      SizeY=272
      Text="Input Normal map red and green"
      CommentColor=(R=0.533571,G=0.815740,B=1.000000,A=1.000000)
      MaterialExpressionEditorX=-432
      MaterialExpressionEditorY=320
      MaterialExpressionGuid=3CBC8AA04ADF444C3CDED89E388EE768
   End Object
   MaterialExpressionComment=MaterialExpressionComment'MaterialExpressionComment_13'
   CommentColor=(R=0.533571,G=0.815740,B=1.000000,A=1.000000)
   NodePosX=-432
   NodePosY=320
   NodeWidth=272
   NodeHeight=272
   NodeComment="Input Normal map red and green"
   NodeGuid=E0234C5A418ED78C5C3775ACE7BD992A
End Object
Begin Object Class=MaterialGraphNode Name="MaterialGraphNode_35"
   Begin Object Class=EdGraphPin Name="EdGraphPin_4646"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_4645"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_4644"
   End Object
   Begin Object Class=MaterialExpressionDotProduct Name="MaterialExpressionDotProduct_3"
   End Object
   Begin Object Name="EdGraphPin_4646"
      PinName="Output"
      PinFriendlyName=" "
      Direction=EGPD_Output
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_36.EdGraphPin_4647'
   End Object
   Begin Object Name="EdGraphPin_4645"
      PinName="B"
      PinType=(PinCategory="required")
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_31.EdGraphPin_4638'
   End Object
   Begin Object Name="EdGraphPin_4644"
      PinName="A"
      PinType=(PinCategory="required")
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_31.EdGraphPin_4638'
   End Object
   Begin Object Name="MaterialExpressionDotProduct_3"
      A=(Expression=MaterialExpressionSubtract'MaterialGraphNode_31.MaterialExpressionSubtract_3')
      B=(Expression=MaterialExpressionSubtract'MaterialGraphNode_31.MaterialExpressionSubtract_3')
      MaterialExpressionEditorX=240
      MaterialExpressionEditorY=448
      MaterialExpressionGuid=E95A386F4D0C0B5B12CAF3B309C82777
      Material=Material'/Engine/Transient.Material_1'
   End Object
   MaterialExpression=MaterialExpressionDotProduct'MaterialExpressionDotProduct_3'
   Pins(0)=EdGraphPin'EdGraphPin_4644'
   Pins(1)=EdGraphPin'EdGraphPin_4645'
   Pins(2)=EdGraphPin'EdGraphPin_4646'
   NodePosX=258
   NodePosY=450
   NodeGuid=568E42C241EED66D0263ACA39492CB2F
End Object
Begin Object Class=MaterialGraphNode Name="MaterialGraphNode_36"
   Begin Object Class=EdGraphPin Name="EdGraphPin_4648"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_4647"
   End Object
   Begin Object Class=MaterialExpressionOneMinus Name="MaterialExpressionOneMinus_3"
   End Object
   Begin Object Name="EdGraphPin_4648"
      PinName="Output"
      PinFriendlyName=" "
      Direction=EGPD_Output
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_37.EdGraphPin_4649'
   End Object
   Begin Object Name="EdGraphPin_4647"
      PinName="Input"
      PinFriendlyName=" "
      PinType=(PinCategory="required")
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_35.EdGraphPin_4646'
   End Object
   Begin Object Name="MaterialExpressionOneMinus_3"
      Input=(Expression=MaterialExpressionDotProduct'MaterialGraphNode_35.MaterialExpressionDotProduct_3')
      MaterialExpressionEditorX=336
      MaterialExpressionEditorY=448
      MaterialExpressionGuid=9EDF28EC40FE499BA6A94BB79CA3C290
      Material=Material'/Engine/Transient.Material_1'
   End Object
   MaterialExpression=MaterialExpressionOneMinus'MaterialExpressionOneMinus_3'
   Pins(0)=EdGraphPin'EdGraphPin_4647'
   Pins(1)=EdGraphPin'EdGraphPin_4648'
   NodePosX=354
   NodePosY=450
   NodeGuid=0A1A43E44916D8713589E288CB74214D
End Object
Begin Object Class=MaterialGraphNode Name="MaterialGraphNode_37"
   Begin Object Class=EdGraphPin Name="EdGraphPin_4652"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_4651"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_4650"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_4649"
   End Object
   Begin Object Class=MaterialExpressionClamp Name="MaterialExpressionClamp_3"
   End Object
   Begin Object Name="EdGraphPin_4652"
      PinName="Output"
      PinFriendlyName=" "
      Direction=EGPD_Output
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_38.EdGraphPin_4653'
   End Object
   Begin Object Name="EdGraphPin_4651"
      PinName="Max"
      PinType=(PinCategory="optional")
   End Object
   Begin Object Name="EdGraphPin_4650"
      PinName="Min"
      PinType=(PinCategory="optional")
   End Object
   Begin Object Name="EdGraphPin_4649"
      PinName="Input"
      PinFriendlyName=" "
      PinType=(PinCategory="required")
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_36.EdGraphPin_4648'
   End Object
   Begin Object Name="MaterialExpressionClamp_3"
      Input=(Expression=MaterialExpressionOneMinus'MaterialGraphNode_36.MaterialExpressionOneMinus_3')
      MaterialExpressionEditorX=432
      MaterialExpressionEditorY=448
      MaterialExpressionGuid=902DB7CB484FA6A36CC8938FE1F8743C
      Material=Material'/Engine/Transient.Material_1'
   End Object
   MaterialExpression=MaterialExpressionClamp'MaterialExpressionClamp_3'
   Pins(0)=EdGraphPin'EdGraphPin_4649'
   Pins(1)=EdGraphPin'EdGraphPin_4650'
   Pins(2)=EdGraphPin'EdGraphPin_4651'
   Pins(3)=EdGraphPin'EdGraphPin_4652'
   NodePosX=450
   NodePosY=450
   NodeGuid=D2F968F14B5512614020B4B93A277B28
End Object
Begin Object Class=MaterialGraphNode Name="MaterialGraphNode_38"
   Begin Object Class=EdGraphPin Name="EdGraphPin_4654"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_4653"
   End Object
   Begin Object Class=MaterialExpressionSquareRoot Name="MaterialExpressionSquareRoot_4"
   End Object
   Begin Object Name="EdGraphPin_4654"
      PinName="Output"
      PinFriendlyName=" "
      Direction=EGPD_Output
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_39.EdGraphPin_4656'
   End Object
   Begin Object Name="EdGraphPin_4653"
      PinName="Input"
      PinFriendlyName=" "
      PinType=(PinCategory="required")
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_37.EdGraphPin_4652'
   End Object
   Begin Object Name="MaterialExpressionSquareRoot_4"
      Input=(Expression=MaterialExpressionClamp'MaterialGraphNode_37.MaterialExpressionClamp_3')
      MaterialExpressionEditorX=640
      MaterialExpressionEditorY=448
      MaterialExpressionGuid=2E4CF79D455F5A4B895E9EBE9E440C74
      Material=Material'/Engine/Transient.Material_1'
   End Object
   MaterialExpression=MaterialExpressionSquareRoot'MaterialExpressionSquareRoot_4'
   Pins(0)=EdGraphPin'EdGraphPin_4653'
   Pins(1)=EdGraphPin'EdGraphPin_4654'
   NodePosX=658
   NodePosY=450
   NodeGuid=9F67C5E1480E77D793CDF291A8ACE162
End Object
Begin Object Class=MaterialGraphNode Name="MaterialGraphNode_39"
   Begin Object Class=EdGraphPin Name="EdGraphPin_4657"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_4656"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_4655"
   End Object
   Begin Object Class=MaterialExpressionAppendVector Name="MaterialExpressionAppendVector_4"
   End Object
   Begin Object Name="EdGraphPin_4657"
      PinName="Output"
      PinFriendlyName=" "
      Direction=EGPD_Output
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_28.EdGraphPin_4629'
   End Object
   Begin Object Name="EdGraphPin_4656"
      PinName="B"
      PinType=(PinCategory="required")
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_38.EdGraphPin_4654'
   End Object
   Begin Object Name="EdGraphPin_4655"
      PinName="A"
      PinType=(PinCategory="required")
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_31.EdGraphPin_4638'
   End Object
   Begin Object Name="MaterialExpressionAppendVector_4"
      A=(Expression=MaterialExpressionSubtract'MaterialGraphNode_31.MaterialExpressionSubtract_3')
      B=(Expression=MaterialExpressionSquareRoot'MaterialGraphNode_38.MaterialExpressionSquareRoot_4')
      MaterialExpressionEditorX=786
      MaterialExpressionEditorY=338
      MaterialExpressionGuid=E1D37E494825DA16C0883E9AD30ED071
      Material=Material'/Engine/Transient.Material_1'
   End Object
   MaterialExpression=MaterialExpressionAppendVector'MaterialExpressionAppendVector_4'
   Pins(0)=EdGraphPin'EdGraphPin_4655'
   Pins(1)=EdGraphPin'EdGraphPin_4656'
   Pins(2)=EdGraphPin'EdGraphPin_4657'
   NodePosX=786
   NodePosY=338
   NodeGuid=48DCA11D47A50F53B6598F81679E39CE
End Object
Begin Object Class=MaterialGraphNode_Comment Name="MaterialGraphNode_Comment_4"
   Begin Object Class=MaterialExpressionComment Name="MaterialExpressionComment_14"
   End Object
   Begin Object Name="MaterialExpressionComment_14"
      SizeX=512
      SizeY=176
      Text="Safe Normal B  calculation"
      CommentColor=(R=0.634080,G=1.000000,B=0.970122,A=1.000000)
      MaterialExpressionEditorX=240
      MaterialExpressionEditorY=400
      MaterialExpressionGuid=705EE25047CBCB6A42590290B073343A
   End Object
   MaterialExpressionComment=MaterialExpressionComment'MaterialExpressionComment_14'
   CommentColor=(R=0.634080,G=1.000000,B=0.970122,A=1.000000)
   NodePosX=240
   NodePosY=400
   NodeWidth=512
   NodeHeight=176
   NodeComment="Safe Normal B  calculation"
   NodeGuid=5A07D57340BA92FDE61E16AB1026A2C5
End Object
Begin Object Class=MaterialGraphNode_Comment Name="MaterialGraphNode_Comment_5"
   Begin Object Class=MaterialExpressionComment Name="MaterialExpressionComment_15"
   End Object
   Begin Object Name="MaterialExpressionComment_15"
      SizeX=336
      SizeY=288
      Text="Result"
      CommentColor=(R=0.092031,G=0.166421,B=0.285000,A=1.000000)
      MaterialExpressionEditorX=768
      MaterialExpressionEditorY=288
      MaterialExpressionGuid=4E0D8CCD4E8323B32A4D3B958D9A076C
   End Object
   MaterialExpressionComment=MaterialExpressionComment'MaterialExpressionComment_15'
   CommentColor=(R=0.092031,G=0.166421,B=0.285000,A=1.000000)
   NodePosX=768
   NodePosY=288
   NodeWidth=336
   NodeHeight=288
   NodeComment="Result"
   NodeGuid=C09D40044C00F557DE7C20BA9E7A29D6
End Object


[/SPOILER]
As a conclusion, I should mention that you need to turn sRGB off for your texture, and use linear color sampler. Additionally, it would be best to use ALPHA and GREEN channels for R and G normal channels, respectively, retaining blue or red channel for mask.

[MENTION=37019]Jenny Gore[/MENTION] There is a bulk of situations, where DXT compression will be vastly superior to BC, in terms of performance/quality loss trade-off. And no, if done right, you should not see any artifacts, apart from usual compression block squares, but you are right, that this move would be effective in cutting down sampler count and not as good at memory saving.

There are always artifacts when using this scheme. DXT1 compression is not per channel but per color. So all three channels are compressed with assumption that they do correlate. Each block only store two endpoints as 16-bit rgb color. Then each texel use 2-bit indice to interpolate value between these endpoints. This does mean that normal direction is affecting blue channel and other way around. Which is not correct at all. Even the fact that normal x and y is affecting each other is not correct. DXT1 also only use 5-bit for red and 6-bit for green which is not enough for any smooth surfaces.
Normal map compression aka BC5 use 8-bit uncorrelate endpoints for red and green. It’s also use 3-bit for indices. It’s superior format in every way.

I think you are missing the point. It is pretty obvious that BC5 is better for storing normals. That is if you completely ignore where and how those normal maps will be used.

Breakdown for a typical 2k texture setup:


BC1 Normal map , BC1 BaseColor, - 1 additional mask,  ~ 5.5 Mb , 2 samplers

BC3 Normal map , BC1 BaseColor, - 2 additional masks, ~ 8.1 Mb, 2 samplers

BC3 Normal map , BC3 BaseColor - 3 additional masks, ~ 10.9 Mb, 2 samplers

BC5 Normal map , BC1 BaseColor - 0 additional masks, ~ 8.1 Mb, 2 samplers

BC5 Normal map , BC3 BaseColor - 1 additional mask, ~ 10.9 Mb, 2 samplers

BC5 Normal map , BC1 BaseColor, BC1 Masks - 3 additional masks, ~ 10.9 Mb, 3 samplers 

Disregarding visual loss, doing what OP intended to saves you ~2.8 Mb on each 2k texture, not even speaking about extra sampler.

Neither all objects in the game have smooth reflective surface nor all of them are meant to occupy whole screen space.
Distant terrain, detail maps,noise masks and anything that requires blending of several texture layers, coupled with need for multiple masks. These are perfect candidates for packing normal map with extra masks.
Additionally in situations where you are:

  • Memory bound
  • Bandwidth bound
  • Fetch bound
  • Hitting sampler limit

BC5 advantages become non-existent.

You said “if done right, you should not see any artifacts”. But it can’t be done right because of compression scheme BC1 use. Cross channel talk is real problem. You get far better quality with lower memory consumption if you just use bit lower texture size(quarter size) for normal map and mask. It will use one sampler more but it will be artifact free.

Hey guys, just wanted to say thank you for the answers and that I got it working. There are some compression artifacts like you said but it might be manageable since my object is pretty gritty and grimy.