I’m looking for help with texture mapping when using VRay material.
I have a model with several pipes of varying length and diameter, the image attached shows the issue.
I would like the VRay material to be the same scale on each pipe, regardless of the pipe length or diameter. The braided material should always look the same.
I’ve spent some reasonable time trying to resolve, so I must be missing something. Any help greatly appreciated.
You could see if WCS mapping works well enough? Or you need to scale the texture mapping to reflect the size, which can be scripted up.
Thank you for your response.
Please can you elaborate on the WCS mapping when using a VRay material. I can only find reference to this in a Rhino material. Am I missing something in the RhinoTexture Mapping of the pipes?
I have some experience with scripting in Python, what exactly needs to be scaled in the Mapping, that is not something I have done before, hence this question I guess!
For WCS mapping, you can also use Vray’s Triplanar mapping.
I don’t think in this case that’s what you want though, you want the mapping type to be a surface mapping type (default). You will need to keep track of the U and V size and adjust each mapping UVW repeat values proportional to the size of each pipe. For example, if one pipe is 1000 in U and 300 in V (circumference) and your texture is 10 x 10, it will fit 100 times in U and 30 times in V.
Well I did just do this recently, but this was specific to my situation so sharing it isn’t likely to work, and it’s a mess.
Things to be aware of:
An object that you haven’t explicitly applied mapping to already needs to have a UV texture mapping “mapping” created and added to it. So you need something like this somewhere:
And that’s how you update the object after making any mapping changes.
The really ugly part–well for me because I’m not good at that math–is that you don’t have access to the repeat and rotate and offset parameters directly, you have to make a matrix and assign it to the “UvwTransform” property of the mapping object. I just used some trial and error to figure out what I needed.
Oh, there’s a function called GetSurfaceSize() you can use on…I guess it has to be a brep?.. that will give you the dimensions of a surface if it was flattened…though I’ve found on some surfaces it doesn’t seem super-accurate compared to more laborious methods, but maybe that varies by the shape of the surface.
Many thanks for your input on this.
I haven’t had a chance to work on this today, but reading your comments I have a good idea where to go, even if the solution is not going to be as elegant as I had hoped.
If anyone has further suggestions or anything to add, all appreciated.
Updating on this. VRay’s Triplaner mapping works but is not perfect, for me however it is good enough for the resolution of these components in my larger model, so it is a good quick method in this case. See image.
I don’t think triplane is a good choice here, mostly because you don’t have 3 surfaces, but a potentially bend cylinder
I think what @Gijs suggested is what you need