Jump to: Board index » General » Fusion

How do you scale 3D material textures?

Learn about 3D compositing, animation, broadcast design and VFX workflows.
  • Author
  • Message
Offline

joemart

  • Posts: 96
  • Joined: Wed Apr 14, 2021 3:16 pm
  • Real Name: Joseph Martire

How do you scale 3D material textures?

PostTue Dec 07, 2021 4:48 am

My apologies for my ignorance, but I'm trying to understand 3D objects and its manipulation.

If I have a texture's BaseColor map, Roughness map, Normal map, Displacement map and Occlusion map, how would I go about in scaling these up and down?

I'm sure that I could use a transform node, but I'm not sure if that's the right approach, seeing as it's 3D. I recently encountered the "Texture2D" node and uses the "U" and "V" to scale up and down the materials, but when I try to scale the normal with the Texture2D node and connect it to a BumpMap node, it rejects it since it's expecting an image input. The same for the Displacement map, I try to connect it to the Displace3D node and it doesn't match since it's expecting something other than a material.

Do I have to convert these outputs into the data types that the other nodes will accept? And how exactly would I go about doing this?

Forgive my ignorance about the topic, I'm just trying to learn.
Attachments
ScalingTextures.png
ScalingTextures.png (41.93 KiB) Viewed 1000 times
Offline
User avatar

Bryan Ray

  • Posts: 2478
  • Joined: Mon Nov 28, 2016 5:32 am
  • Location: Los Angeles, CA, USA

Re: How do you scale 3D material textures?

PostTue Dec 07, 2021 3:38 pm

BumpMap's input expects an Image datatype. There's not really a practical way to convert a Material back to Image, but you can certainly scale the input image prior to the BumpMap with an ordinary Transform node. You'll probably need to change the Edges mode, depending on what you're doing. And if you want it to simulate what Texture2D does, move the Pivot to (0,0) so scaling will happen from the edge of the image like the U and V controls do.

The same goes for Displace3D.

Scaling X and Y in a Transform should exactly match scaling U and V in Texture2D. Here I've expression-linked a Transform's Size controls to Transform2D's U and V Scale to demonstrate:

Code: Select all
{
   Tools = ordered() {
      Checkerboard = MacroOperator {
         CustomData = {
            Path = {
               Map = {
                  ["Setting:"] = "Macros:\\Creator\\"
               }
            },
         },
         Inputs = ordered() {
            Comments = Input { Value = "Muse Tools Library\r\nby Joe Laude\r\nwww.musevfx.com", },
            Center = InstanceInput {
               SourceOp = "CustomTool1",
               Source = "PointIn1",
            },
            CheckerSize = InstanceInput {
               SourceOp = "CustomTool1",
               Source = "CheckerSize",
               Default = 64,
            },
            Width = InstanceInput {
               SourceOp = "Background1",
               Source = "Width",
               Default = 1920,
            },
            Height = InstanceInput {
               SourceOp = "Background1",
               Source = "Height",
               Default = 1080,
            }
         },
         Outputs = {
            Output = InstanceOutput {
               SourceOp = "CustomTool1",
               Source = "Output",
            }
         },
         ViewInfo = GroupInfo { Pos = { 1430, 214.5 } },
         Tools = ordered() {
            Background1 = Background {
               CtrlWZoom = false,
               CtrlWShown = false,
               Inputs = {
                  Width = Input { Value = 1920, },
                  Height = Input { Value = 1080, },
                  ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
               },
               ViewInfo = OperatorInfo { Pos = { 0, 8.25757 } },
            },
            CustomTool1 = Custom {
               CtrlWZoom = false,
               CtrlWShown = false,
               Inputs = {
                  NumberIn1 = Input {
                     Value = 64,
                     Expression = "CheckerSize",
                  },
                  LUTIn1 = Input {
                     SourceOp = "CustomTool1LUTIn1",
                     Source = "Value",
                  },
                  LUTIn2 = Input {
                     SourceOp = "CustomTool1LUTIn2",
                     Source = "Value",
                  },
                  LUTIn3 = Input {
                     SourceOp = "CustomTool1LUTIn3",
                     Source = "Value",
                  },
                  LUTIn4 = Input {
                     SourceOp = "CustomTool1LUTIn4",
                     Source = "Value",
                  },
                  Intermediate1 = Input { Value = "(abs(floor((x-p1x)*(w/n1)))%2)", },
                  Intermediate2 = Input { Value = "(abs(floor((y-p1y)*(h/n1)))%2)", },
                  RedExpression = Input { Value = "abs(i1-i2)", },
                  GreenExpression = Input { Value = "abs(i1-i2)", },
                  BlueExpression = Input { Value = "abs(i1-i2)", },
                  NumberControls = Input { Value = 1, },
                  NameforNumber1 = Input { Value = "SquareSize", },
                  ShowNumber2 = Input { Value = 0, },
                  ShowNumber3 = Input { Value = 0, },
                  ShowNumber4 = Input { Value = 0, },
                  ShowNumber5 = Input { Value = 0, },
                  ShowNumber6 = Input { Value = 0, },
                  ShowNumber7 = Input { Value = 0, },
                  ShowNumber8 = Input { Value = 0, },
                  PointControls = Input { Value = 1, },
                  NameforPoint1 = Input { Value = "Center", },
                  ShowPoint2 = Input { Value = 0, },
                  ShowPoint3 = Input { Value = 0, },
                  ShowPoint4 = Input { Value = 0, },
                  ShowLUT1 = Input { Value = 0, },
                  ShowLUT2 = Input { Value = 0, },
                  ShowLUT3 = Input { Value = 0, },
                  ShowLUT4 = Input { Value = 0, },
                  Image1 = Input {
                     SourceOp = "Background1",
                     Source = "Output",
                  },
               },
               ViewInfo = OperatorInfo { Pos = { 0, 41.2576 } },
               UserControls = ordered() {
                  CheckerSize = {
                     INP_MinScale = 0,
                     INP_Integer = true,
                     INP_MinAllowed = 0,
                     LINKID_DataType = "Number",
                     INPID_InputControl = "SliderControl",
                     IC_ControlPage = 0,
                     INP_MaxScale = 100,
                     INP_Default = 64,
                  }
               }
            },
            CustomTool1LUTIn1 = LUTBezier {
               KeyColorSplines = {
                  [0] = {
                     [0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
                     [1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
                  }
               },
               SplineColor = { Red = 204, Green = 0, Blue = 0 },
            },
            CustomTool1LUTIn2 = LUTBezier {
               KeyColorSplines = {
                  [0] = {
                     [0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
                     [1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
                  }
               },
               SplineColor = { Red = 0, Green = 204, Blue = 0 },
            },
            CustomTool1LUTIn3 = LUTBezier {
               KeyColorSplines = {
                  [0] = {
                     [0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
                     [1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
                  }
               },
               SplineColor = { Red = 0, Green = 0, Blue = 204 },
            },
            CustomTool1LUTIn4 = LUTBezier {
               KeyColorSplines = {
                  [0] = {
                     [0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
                     [1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
                  }
               },
               SplineColor = { Red = 204, Green = 204, Blue = 204 },
            }
         },
      },
      Texture2D2 = Texture2DOperator {
         Inputs = {
            Input = Input {
               SourceOp = "CustomTool1",
               Source = "Output",
            },
            UScale = Input { Value = 1.2, },
            WrapMode = Input { Value = FuID { "Mirror" }, },
            MaterialID = Input { Value = 5, },
         },
         ViewInfo = OperatorInfo { Pos = { 1540, 214.5 } },
      },
      Transform1 = Transform {
         CtrlWZoom = false,
         Inputs = {
            Pivot = Input { Value = { 0, 0 }, },
            UseSizeAndAspect = Input { Value = 0, },
            XSize = Input { Expression = "Texture2D2.UScale", },
            YSize = Input { Expression = "Texture2D2.VScale", },
            Input = Input {
               SourceOp = "CustomTool1",
               Source = "Output",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 1540, 247.5 } },
      },
      Shape3D2 = Shape3D {
         Inputs = {
            MaterialInput = Input {
               SourceOp = "Texture2D2",
               Source = "MaterialOutput",
            },
            ["MtlStdInputs.MaterialID"] = Input { Value = 6, },
            ["SurfacePlaneInputs.SubdivisionWidth"] = Input { Value = 960, },
            ["SurfacePlaneInputs.ObjectID.ObjectID"] = Input { Value = 3, }
         },
         ViewInfo = OperatorInfo { Pos = { 1650, 214.5 } },
      },
      Displace3D1 = Displace3D {
         CtrlWZoom = false,
         Inputs = {
            SceneInput = Input {
               SourceOp = "Shape3D2",
               Source = "Output",
            },
            Scale = Input { Value = 0.0334, },
            Input = Input {
               SourceOp = "Transform1",
               Source = "Output",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 1760, 214.5 } },
      }
   }
}


The same should work for bump, but I haven't tested it.
Bryan Ray
http://www.bryanray.name
http://www.sidefx.com
Offline

joemart

  • Posts: 96
  • Joined: Wed Apr 14, 2021 3:16 pm
  • Real Name: Joseph Martire

Re: How do you scale 3D material textures?

PostTue Dec 07, 2021 10:04 pm

Bryan Ray wrote:BumpMap's input expects an Image datatype. There's not really a practical way to convert a Material back to Image, but you can certainly scale the input image prior to the BumpMap with an ordinary Transform node. You'll probably need to change the Edges mode, depending on what you're doing. And if you want it to simulate what Texture2D does, move the Pivot to (0,0) so scaling will happen from the edge of the image like the U and V controls do.

The same goes for Displace3D.

Scaling X and Y in a Transform should exactly match scaling U and V in Texture2D. Here I've expression-linked a Transform's Size controls to Transform2D's U and V Scale to demonstrate:

Code: Select all
{
   Tools = ordered() {
      Checkerboard = MacroOperator {
         CustomData = {
            Path = {
               Map = {
                  ["Setting:"] = "Macros:\\Creator\\"
               }
            },
         },
         Inputs = ordered() {
            Comments = Input { Value = "Muse Tools Library\r\nby Joe Laude\r\nwww.musevfx.com", },
            Center = InstanceInput {
               SourceOp = "CustomTool1",
               Source = "PointIn1",
            },
            CheckerSize = InstanceInput {
               SourceOp = "CustomTool1",
               Source = "CheckerSize",
               Default = 64,
            },
            Width = InstanceInput {
               SourceOp = "Background1",
               Source = "Width",
               Default = 1920,
            },
            Height = InstanceInput {
               SourceOp = "Background1",
               Source = "Height",
               Default = 1080,
            }
         },
         Outputs = {
            Output = InstanceOutput {
               SourceOp = "CustomTool1",
               Source = "Output",
            }
         },
         ViewInfo = GroupInfo { Pos = { 1430, 214.5 } },
         Tools = ordered() {
            Background1 = Background {
               CtrlWZoom = false,
               CtrlWShown = false,
               Inputs = {
                  Width = Input { Value = 1920, },
                  Height = Input { Value = 1080, },
                  ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
               },
               ViewInfo = OperatorInfo { Pos = { 0, 8.25757 } },
            },
            CustomTool1 = Custom {
               CtrlWZoom = false,
               CtrlWShown = false,
               Inputs = {
                  NumberIn1 = Input {
                     Value = 64,
                     Expression = "CheckerSize",
                  },
                  LUTIn1 = Input {
                     SourceOp = "CustomTool1LUTIn1",
                     Source = "Value",
                  },
                  LUTIn2 = Input {
                     SourceOp = "CustomTool1LUTIn2",
                     Source = "Value",
                  },
                  LUTIn3 = Input {
                     SourceOp = "CustomTool1LUTIn3",
                     Source = "Value",
                  },
                  LUTIn4 = Input {
                     SourceOp = "CustomTool1LUTIn4",
                     Source = "Value",
                  },
                  Intermediate1 = Input { Value = "(abs(floor((x-p1x)*(w/n1)))%2)", },
                  Intermediate2 = Input { Value = "(abs(floor((y-p1y)*(h/n1)))%2)", },
                  RedExpression = Input { Value = "abs(i1-i2)", },
                  GreenExpression = Input { Value = "abs(i1-i2)", },
                  BlueExpression = Input { Value = "abs(i1-i2)", },
                  NumberControls = Input { Value = 1, },
                  NameforNumber1 = Input { Value = "SquareSize", },
                  ShowNumber2 = Input { Value = 0, },
                  ShowNumber3 = Input { Value = 0, },
                  ShowNumber4 = Input { Value = 0, },
                  ShowNumber5 = Input { Value = 0, },
                  ShowNumber6 = Input { Value = 0, },
                  ShowNumber7 = Input { Value = 0, },
                  ShowNumber8 = Input { Value = 0, },
                  PointControls = Input { Value = 1, },
                  NameforPoint1 = Input { Value = "Center", },
                  ShowPoint2 = Input { Value = 0, },
                  ShowPoint3 = Input { Value = 0, },
                  ShowPoint4 = Input { Value = 0, },
                  ShowLUT1 = Input { Value = 0, },
                  ShowLUT2 = Input { Value = 0, },
                  ShowLUT3 = Input { Value = 0, },
                  ShowLUT4 = Input { Value = 0, },
                  Image1 = Input {
                     SourceOp = "Background1",
                     Source = "Output",
                  },
               },
               ViewInfo = OperatorInfo { Pos = { 0, 41.2576 } },
               UserControls = ordered() {
                  CheckerSize = {
                     INP_MinScale = 0,
                     INP_Integer = true,
                     INP_MinAllowed = 0,
                     LINKID_DataType = "Number",
                     INPID_InputControl = "SliderControl",
                     IC_ControlPage = 0,
                     INP_MaxScale = 100,
                     INP_Default = 64,
                  }
               }
            },
            CustomTool1LUTIn1 = LUTBezier {
               KeyColorSplines = {
                  [0] = {
                     [0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
                     [1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
                  }
               },
               SplineColor = { Red = 204, Green = 0, Blue = 0 },
            },
            CustomTool1LUTIn2 = LUTBezier {
               KeyColorSplines = {
                  [0] = {
                     [0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
                     [1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
                  }
               },
               SplineColor = { Red = 0, Green = 204, Blue = 0 },
            },
            CustomTool1LUTIn3 = LUTBezier {
               KeyColorSplines = {
                  [0] = {
                     [0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
                     [1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
                  }
               },
               SplineColor = { Red = 0, Green = 0, Blue = 204 },
            },
            CustomTool1LUTIn4 = LUTBezier {
               KeyColorSplines = {
                  [0] = {
                     [0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
                     [1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
                  }
               },
               SplineColor = { Red = 204, Green = 204, Blue = 204 },
            }
         },
      },
      Texture2D2 = Texture2DOperator {
         Inputs = {
            Input = Input {
               SourceOp = "CustomTool1",
               Source = "Output",
            },
            UScale = Input { Value = 1.2, },
            WrapMode = Input { Value = FuID { "Mirror" }, },
            MaterialID = Input { Value = 5, },
         },
         ViewInfo = OperatorInfo { Pos = { 1540, 214.5 } },
      },
      Transform1 = Transform {
         CtrlWZoom = false,
         Inputs = {
            Pivot = Input { Value = { 0, 0 }, },
            UseSizeAndAspect = Input { Value = 0, },
            XSize = Input { Expression = "Texture2D2.UScale", },
            YSize = Input { Expression = "Texture2D2.VScale", },
            Input = Input {
               SourceOp = "CustomTool1",
               Source = "Output",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 1540, 247.5 } },
      },
      Shape3D2 = Shape3D {
         Inputs = {
            MaterialInput = Input {
               SourceOp = "Texture2D2",
               Source = "MaterialOutput",
            },
            ["MtlStdInputs.MaterialID"] = Input { Value = 6, },
            ["SurfacePlaneInputs.SubdivisionWidth"] = Input { Value = 960, },
            ["SurfacePlaneInputs.ObjectID.ObjectID"] = Input { Value = 3, }
         },
         ViewInfo = OperatorInfo { Pos = { 1650, 214.5 } },
      },
      Displace3D1 = Displace3D {
         CtrlWZoom = false,
         Inputs = {
            SceneInput = Input {
               SourceOp = "Shape3D2",
               Source = "Output",
            },
            Scale = Input { Value = 0.0334, },
            Input = Input {
               SourceOp = "Transform1",
               Source = "Output",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 1760, 214.5 } },
      }
   }
}


The same should work for bump, but I haven't tested it.


I'll then use the transform nodes on the nodes that don't require a material output and hopefully that will work. I'll probably use the "Wrap" edge within the transform node.

The nodes work great as long as the U and V scales are above 1. If they're below 1, then some of the displacement is increased and some isn't.
Offline
User avatar

Chad Capeland

  • Posts: 3017
  • Joined: Mon Nov 10, 2014 9:40 pm

Re: How do you scale 3D material textures?

PostThu Dec 09, 2021 3:48 am

You can use 3CV to scale the UVW coordinates of your mesh.
Chad Capeland
Indicated, LLC
www.floweffects.com

Return to Fusion

Who is online

Users browsing this forum: No registered users and 49 guests