Announcement

Collapse
No announcement yet.

Setting material functions via c++

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

    Setting material functions via c++

    Hi, how do i set material functions (material attributes) via c++ during runtime? I could only set parameters like scalar, vector or texture for a material but didnt see set for material functions.
    What i was trying to do is to blend two different materials together via material attributes. Since these two materials are pretty unique (lava, whirl pool...), changing basic scalar, vector or texture doesnt cut it.
    Or is there another way to approach this. Any advice is appreciated. Thanks in advance.

    Click image for larger version

Name:	MA.png
Views:	122
Size:	457.1 KB
ID:	1531937

    #2
    You can't change the nodes in materials at runtime - you can only change parameters of built materials. Materials are compiled to HLSL from those nodes, and this has to be done before they are used anywhere anyway.

    The solution here would be to simply change the material that is applied to the surface using it.

    Comment


      #3
      Thanks for the advice. That was what i was afraid of. I have managed to work around the situation by tackling individual BaseColor, roughness ..... from the selected Material Attributes. It is not pretty and pretty heavy on the instructions.

      Click image for larger version

Name:	MA_Functions..PNG
Views:	148
Size:	495.5 KB
ID:	1532018

      Comment


        #4
        There's a material in the free Content Examples that does the same thing based on height map. Might be worth looking at.

        Comment


          #5
          Thanks. The rocket example in the content examples didnt allow material changes during runtime.

          Comment

          Working...
          X