HOW TO MAKE A V3 INTO FLOAT2 FOR SWITCH? (MAT DYNAMIC MASK)

Hello guys! :upside_down_face:

I tried to make this static mask into a vector parameter, because I need a dynamic mask to set in runtime, but I don’t know how to iterate on them to obtain a float2 compatble with my switch node.
The Obj mapping masked result is in multiply with txt tiling, then into the switch. (The other switch pin is from UV Coord x Tiling X/Y. )

Can someone help me with this math?

Object mapping:

Switch UV/OBJ Mapping

I’m stuck at this point

Thank y’all so much!

First thing is your vector is a float4 not a float3. It has rgba so red, green, blue and alpha. Those are 4 channels. The white top output node is the float 4 vector. You can either break that, or just use the separate channels that are below it.

You cannot condense the vec4 into a single float. If the other interaction is a vec3 then just use a vec3 in place of the vec4 or pass it through a component mask so the amount of inputs are the same.

1 Like

Not sure if it is what you want, but:

  • use component mask to split/separate component into R G B for both vector 3
  • then multiply R from one source with R from other, and so on
  • then combine results , there is append node that does it.
1 Like

@3dRaven
but my vector parameter would be the “component mask”. I need a dynamic mask setted in runtime trought bp with other parameters. This is my problem. And also, I did it digiting “3” and clicking, so this is not a v3? :thinking:

@Nawrot
Since this material is instantiated on different slots of the same mesh which is composed of multiple meshes/faces, each of which will therefore refer to a combination of 2 different axes to use the obj mapping instead of the uv mapping, I have to mask on r,g,b,a, a pair of 2 in a variable and dynamic way. Precisely in reference to the geometry of the material slot. Because if I use a static mask, some meshes/faces will have incorrect texturing relative to their orientation.

Make picture of WHOLE material, also pictures or explanation of whole setup for meshes etc.
I have feeling that there is easier/different approach to whole setup.

You can/should watch this, as it has many common tricks to what i think you are trying to do:

But again, whole material pic, and setup, and results you need.

1 Like

@Nawrot
the material I’m working on is a bit complex, give me a moment so I’ll explain it in brief.

is a mat I made to have only one mat to instance for each interior mesh i’ve in the map.

There’s a scalar parameter “Mapping” that say "this instance mat, use UV mapping or Object mapping (like in Blender node). This helps me a lot to customize and reuse the same txts more times keeping perf lower.

So, in the top : UV Coord - Multiply - Tiling (V2 param)
In the bottom : Abs World Position - Transform to Local - divide x 100 (to gain obj in meters) - (static mask component I want make dynamic like other params) - Multiply - Tiling

In the middle : Switch between UV Map and Obj Map Throught “Mapping” scalar.

Below Switch : A custom rotate where forinstancerandom choose the + or - of the same value I give in runtime. (Scalar param “Txt_Rot”)

After rotator : A material function I made to use Txt Atlas/Txt2darray, so this material can be instanced in adaptive way.

@Nawrot
@3dRaven

UV/OBJ Mapping:


SWITCH/CUSTOM ROTATOR/FUNCTION

That’s all about my mat. Now I need a way to make the mask component (I’ve already) accssble via bp. But I don’t know how to do it properly without compromising the switch node.

@Nawrot @3dRaven

I hope is clear enough.

I got a solution that’s working for me. But I’ll let the thread unsolved if someone know a better way to do the same thing.

Anyway, I found this function :


That separate and masks any single channel of vector by itself. So, gives back 3 masked constant.

So, I appended each of them to obtain any possible comb of v2. Then , a switch node with 3 input pins. The switch value is a scalar I set via bp in runtime.

It’s working.

Let me know. @Nawrot @3dRaven

Great you found solution, and i still unsure what your setup is. :wink:

1 Like

But I sent all screens and explained what each section does :sweat_smile:
Tell me, what more info you need? Maybe I’m missing something (I’m really tired srry)
@Nawrot

Well without recreating your whole material here, i could not make out what real problem was (more like how to test if my idea works).

This @Nawrot