Cant wire up DistanceTex to another?

Am i being stupid but why cant i wire this up? I have two DistanceTex that i want to multiply together to control a Blend materials mask but Max wont let me wire them up? I effectively want to say ‘Distance from object A * Distance of object B’ .. that seems relatively simple and logical to me?

Works fine on my end. Which 3ds Max version is that? Try plugging it directly into the map slot of the VRayCompTex.

Ah ok.. it seems the issue is coming from the type of objects im using in the VrayDistanceTex Objects list. If i point it to a Forest Pack source (some rocks ive scattered) it wont let me wire it to my material blend. If i remove those objects from the list it will allow it to be wired up.. How is FP / Vray detecting and preventing this?

Alhough it seems even if it wire it up to a non-forest pack asset i still cant get the math to work.. if i want to subtract B from A (ie where the teapot is B vs the spline is A) i only ever see the result of the second wired parameter in the blend.

A - B using a VrayCompTex


​​

I think you need to “Add” in that case (as in Add the VRayDistanceTex’s results to get both the “teapot area” and the spline). I suggest you play around with the distance tex’s result (put it in a separate VrayMtl, so you can see the black and white results) before using it as a mask. It will be clearer.

Maybe a circular reference is preventing it. Also, try referencing the scattered objects, not the FP node (based on what I tested, you can’t select a FP object as a reference).

I wanted to only render the Path where the teapot wasnt.. However i did as you said and ive notice my result was wrong in vRay GPU but when i swatched to CPU the result was correct.. which is a bit annoying.

Maybe a circular reference is preventing it. Also, try referencing the scattered objects, not the FP node.

I did try this as well, but alas no joy. I feel like im fighting a losing battle here trying to make materials that can control my FP instances.

Using the VRayDistanceTex as a source map for a Gradient Ramp will make it work in V-Ray GPU.

Example of CPU vs GPU results..

Whats odd is the DistanceTex seems to randomly stop working between renders as well.. only a forced restart of max will 100% resolve it. ​​

Check my previous post. Otherwise, choosing either the Scatter node or the instanced model object as a reference doesn’t seem to work for VRayDistanceTex. Seems logical for it to work, so I’ll log it for dev investigation.

Thanks.. your method worked.

Also it seems you were right about a depency loop using FP scatter objects as a source for the DistanceTex .. if you try and assign it to a material that is the scatter mesh you get this error.


I guess ill have to contact iToo :frowning:

And it seems Chaos Scatter wont even let you assign a Scatter object as the VrayDistance Objects source :frowning:

̶̶̶Y̶̶̶e̶̶̶s̶̶̶,̶̶̶ ̶̶̶n̶̶̶o̶̶̶t̶̶̶i̶̶̶c̶̶̶e̶̶̶d̶̶̶ ̶̶̶t̶̶̶h̶̶̶a̶̶̶t̶̶̶.̶̶̶ ̶̶̶I̶̶̶’̶̶̶l̶̶̶l̶̶̶ ̶̶̶l̶̶̶o̶̶̶g̶̶̶ ̶̶̶a̶̶̶n̶̶̶ ̶̶̶i̶̶̶s̶̶̶s̶̶̶u̶̶̶e̶̶̶ ̶̶̶f̶̶̶o̶̶̶r̶̶̶ ̶̶̶t̶̶̶h̶̶̶i̶̶̶s̶̶̶,̶̶̶ ̶̶̶b̶̶̶e̶̶̶c̶̶̶a̶̶̶u̶̶̶s̶̶̶e̶̶̶ ̶̶̶i̶̶̶t̶̶̶ ̶̶̶s̶̶̶e̶̶̶e̶̶̶m̶̶̶s̶̶̶ ̶̶̶l̶̶̶i̶̶̶k̶̶̶e̶̶̶ ̶̶̶o̶̶̶n̶̶̶e̶̶̶.̶̶̶ ̶I̶ ̶w̶a̶s̶ ̶r̶e̶f̶e̶r̶r̶i̶n̶g̶ ̶t̶o̶ ̶t̶h̶e̶ ̶s̶o̶u̶r̶c̶e̶ ̶o̶b̶j̶e̶c̶t̶,̶ ̶n̶o̶t̶ ̶t̶h̶e̶ ̶S̶c̶a̶t̶t̶e̶r̶ ̶n̶o̶d̶e̶.̶ ̶I̶n̶ ̶C̶o̶r̶o̶n̶a̶,̶ ̶c̶h̶o̶o̶s̶i̶n̶g̶ ̶t̶h̶e̶ ̶o̶r̶i̶g̶i̶n̶a̶l̶ ̶o̶b̶j̶e̶c̶t̶s̶ ̶a̶s̶ ̶a̶ ̶r̶e̶f̶e̶r̶e̶n̶c̶e̶ ̶m̶a̶k̶e̶s̶ ̶i̶t̶ ̶w̶o̶r̶k̶ ̶f̶o̶r̶ ̶t̶h̶e̶ ̶i̶n̶s̶t̶a̶n̶c̶e̶s̶,̶ ̶t̶o̶o̶.̶

̶T̶h̶a̶t̶’̶s̶ ̶e̶x̶p̶e̶c̶t̶e̶d̶,̶ ̶h̶e̶n̶c̶e̶ ̶w̶h̶y̶ ̶y̶o̶u̶ ̶c̶a̶n̶’̶t̶ ̶s̶e̶l̶e̶c̶t̶ ̶t̶h̶e̶ ̶S̶c̶a̶t̶t̶e̶r̶ ̶n̶o̶d̶e̶ ̶a̶s̶ ̶a̶ ̶r̶e̶f̶e̶r̶e̶n̶c̶e̶

EDIT: Spoke too soon. My original assumption was correct. In Corona you can select the ChaosScatter node in their DistanceTex, but VRayDistanceTex doesn’t allow it. I’ve logged the issue (internal bug-tracker ID: VMAX-15130) for developer investigation.

In the meantime, the workaround is to convert the scatter instanced to Max geometry and pick them manually in the VRayDistanceTex.

Yes but not very practicle when i have 100k’s of them :smile:

So iToo have suggested the fix for the dependency loop is to duplicate your scattered surface and make one render only, the other scatter on only.. Which works! BUT.. not with GPU, even if you plug it into a gradient ramp like you suggested @hermit.crab


Spheres are scattered with FP and the Cube is just static mesh. Appreciate this might not be Vray bug and an iToo one? But i dont know who needs to be made aware for a fix.


VrayGPU_FP_ScatterFistanceTex_Bug.zip (141 KB)

It does work, but not for the ForestPack node (probably related to the issue mentioned above, check my edited last post). The wokraround is similar → right-click on the forest object and convert to mesh (it will create 1 mesh for all the objects, not ideal because the objects won’t be instances and will consume more memory). I’ll add a note about this in the already logged issue.

Thanks for your help.