ShaderFX in viewport - Vray shader at render

ShaderFX in viewport - Vray shader at render

ckrause
Advocate Advocate
3,047 Views
12 Replies
Message 1 of 13

ShaderFX in viewport - Vray shader at render

ckrause
Advocate
Advocate

A general question about Viewport 2.0 alongside of Vray....

 

Is there a way to separate how a material is represented in the viewport VS how it will be rendered? In the early stages of developing a pipe that will rely heavily on Vray user attributes.. Doing so however means material representations in the viewport 2.0 looks like rainbow farts.

 

Is there a way to assign a look-dev viewport shader to a shader group inside of Maya, separate from what shader will be used at render time? To have two separate shaders, one for the viewport which would be independent than the one being rendered.

 

Thank you for any input on this.

 

Best,

Clayton

0 Likes
3,048 Views
12 Replies
Replies (12)
Message 2 of 13

mspeer
Consultant
Consultant
0 Likes
Message 3 of 13

ckrause
Advocate
Advocate

I don't suppose there is any way to do this without Arnold installed? Any other options? Thank you for the input though.

0 Likes
Message 4 of 13

mspeer
Consultant
Consultant

Hi!

 

You don't have to use Arnold, for Mental Ray it's the same. Try it with Vray.

0 Likes
Message 5 of 13

ckrause
Advocate
Advocate

Sorry it took me so long to get back to you. Had some work to take care of..

 

So it looks like I need the ai shader group in your example, no? I don't have mental ray or arnold installed with Maya. Are at least one of these required to do this sort of thing? Maybe I don't have a certain plug-in loaded? Only the ShaderFX plugin. Let me know when you have a moment. Thank you.

 

0 Likes
Message 6 of 13

mspeer
Consultant
Consultant

Hi!

 

You don't need Arnold or Mental Ray (i don't make an example again just to change node(-names).

Replace the Arnold material node with a VRay material node and instead to connect to Arnold input of Shading Group connect to VRay input.

 

Or just read the VRay help:

https://docs.chaosgroup.com/display/VRAY3MAYA/Shading+Group+Attributes

0 Likes
Message 7 of 13

ckrause
Advocate
Advocate

Okay. Thank you for the help, but I don't think I'm explaining what I'm looking for well enough.

 

So I simplified it some more.

 

I have a vray material that has it's diffuse driven by a ramp with multiple color entries in it. A vrayUserScaler is plugged into the ramp driving the color of the Vray material based on Vray user attributes assigned to the actual geometry. 

 

 

 

For this example all the ramp entries look like rainbow vomit and  that is reflected in the viewport as seen in the below image - 

 

Whatever custom vray user attribute is on the object drives the the diffuse in this instance which is a solid color (not unicorn rainbow vomit). BUT the viewport 2.0 does not reflect the custom VrayUserAttribute assigned to the object which is driving what color entry is used for the ramp which is driving the vray material assigned to the object...

 

 

So.... Do you know of a way to override what is being displayed in Maya's viewport VS what is actually being rendered so I don't need to look at a some crazy colorful mess on all of my geometry? Make sense?

 

 

0 Likes
Message 8 of 13

ckrause
Advocate
Advocate

Material Overrides at both the vraymtl level and VraySG level do not effect the viewport preview.

 

0 Likes
Message 9 of 13

mspeer
Consultant
Consultant

Hi!

 

As i understand your problem is a complete different one.

You want the Viewport to show the same as the rendered result?

If the VRayUserScalar is not supported in Maya you will not get the same colors as in render.

 

Replace the VRayUserScalar with a floatConstant to set manual a value for Viewport 2.0 on the path ending in SurfaceShader.

A second material network connected to Vray...Shader should keep the VRayUserScalar.

 

 

 

0 Likes
Message 10 of 13

ckrause
Advocate
Advocate

It sounds like it's not possible. So for an example in Houdini, SideFX opened up access to the openGL viewport shader previews. This is nice for use with unsupported render-ers as far as the viewport is concerned.

 

A person with that access can control the viewport previews completely separate from what is actually being rendered. So in this instance, something like that would be useful as the VrayUserScaler attribute is of course unsupported to preview in the viewport of Maya.  The VrayUserScaler custom attribute is 100% necessary for what I'm trying to do unless there is some equivalent functionality in Maya I don't know about.

 

I appreciate you taking a swing at it. Sort of figured it was a long shot, but wanted to post up here before I gave up. Unicorn vomit it is for now. 😄

 

Thank you.

0 Likes
Message 11 of 13

Anonymous
Not applicable

Im not sure if this is what your looking for but if you select your vray mat and run this script it will create a new hardware shader attribute on your material that you can use to assign a shaderFX material to (or blinn or whatever)  and that will show in the viewport but your vray material will still render.  It doesn't seem to work with vRays fastSSS for some reason.  

 

 

 

string $mats[] = `ls -sl`;

for ($mat in $mats) {

if (1-`attributeExists hardwareShader $mat`) {

addAttr -ln hardwareShader -usedAsColor -h 0 -attributeType float3 $mat;

addAttr -ln colorR -attributeType "float" -parent hardwareShader $mat;

addAttr -ln colorG -attributeType "float" -parent hardwareShader $mat;

addAttr -ln colorB -attributeType "float" -parent hardwareShader $mat;

print $mat;

}

}

Message 12 of 13

7-36c7464a
Explorer
Explorer

This script is excellent (thanks @Anonymous )


I was searching for ages to find a solution to how to show different shaders for hardware viewport and for rendering - I'm now using it successfully on my project!

0 Likes
Message 13 of 13

nathandickson365
Participant
Participant

Thank you so much for posting this! This is super helpful!!

0 Likes