Kirsten Zirngibl Posted August 24, 2018 Share Posted August 24, 2018 (edited) I'm working on a 3DS Max 2017/Vray 3.6 project with hundreds of objects, each with a unique wire color. I want to apply a single material to all of them such that its diffuse color is whatever that specific object's wire color is. This was possible in Mental Ray, via the object color shader, but I'm not finding it in Vray. Here is an example of applying a metallic material to everything in the scene via Mental Ray while using wire color (bottommost image). I found and fixed a script that allows you to generate a Vray material for each object with its wire color as diffuse. However, it doesn't really do what I'm asking because now each object has a separate Vray material. The whole idea is to use one material (and one I already have in my library) to apply to all the objects at once... I'll put it in here in case anyone if it's helpful to anyone stumbling on this thread, though: objs = selectByName title:"Select the objects you want to create a VRay material for" for obj in objs do ( newMat = VRayMtl() newMat.diffuse = obj.wirecolor obj.material = newMat )Really hope there's a way to do this. It's practically a necessity if I'm to stick with Vray for this type of personal work. Thanks! Edited August 24, 2018 by kirstenzirngibl Link to comment Share on other sites More sharing options...
Morne Erasmus Posted September 5, 2018 Share Posted September 5, 2018 1) Add a single "VRayMtl" to all your objects 2) In the diffuse slot, stick a "VRayUserColor" 3) In the Attribute name, add "diffuse_col_from_wire" don't add the quotation marks as part of the attribute name, just the name 4) Select all the objects you want the script to affect 5) Run this script: for obj in selection do ( dcfw = (color (obj.wirecolor.r/255)(obj.wirecolor.g/255)(obj.wirecolor.b/255)) setUserProp obj "\ndiffuse_col_from_wire" ((dcfw.r as string) + "," + (dcfw.g as string) + "," + (dcfw.b as string)) ) click render and have fun Link to comment Share on other sites More sharing options...
Kirsten Zirngibl Posted September 6, 2018 Author Share Posted September 6, 2018 (edited) This works beautifully, so many thanks, Morné! I knew there had to be some way to do this... I see "diffuse_col_from_wire = 0.443137,0.529412,0.0235294" in the User Defined Object Properties field for one of the objects I ran the script on. Multiplying those decimals by 255 yields the wire color. Nifty! Edited September 6, 2018 by kirstenzirngibl Link to comment Share on other sites More sharing options...
Kirsten Zirngibl Posted September 27, 2018 Author Share Posted September 27, 2018 Hey, just an update. I'm on the V-ray Next v4 trial right now and just noticed that this technique only works for the CPU renderer. The material's default diffuse color is the only thing that shows up when using Vray Next's GPU render. Any insights as to why this is? Link to comment Share on other sites More sharing options...
Morne Erasmus Posted September 28, 2018 Share Posted September 28, 2018 (edited) EDIT: I asked on the chaos forum and Vlado says "We recently added this in the nightly builds so it should go into the next update." Edited September 28, 2018 by Morne Link to comment Share on other sites More sharing options...
Kirsten Zirngibl Posted September 28, 2018 Author Share Posted September 28, 2018 Oh, awesome, thanks for following up about it. I'd lost some hope last night when I realized that GPU rendering doesn't support VrayWireColor render pass. Seemed like that meant that it was blind to that aspect of a Max scene in general. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now