question

Jason Hogg avatar image
Jason Hogg asked

Texturing XYZ Multi-Channel map workflow

screen-shot-2019-09-24-at-123647-pm.png6575b1e2c51f81d2020edd282263f428.gifHello all, I was wondering if anyone could help me with the proper workflow for using the Texturing XYZ multi-channel maps alongside a displacement map from ZBrush. The XYZ MC image combines three levels of detail, one in each RGB channel, and the ZBrush map is greyscale. I've seen tutorials where the channels in Maya are split using a plusMinusAverage node, which doesn't exist in C4D.

Thanks in advance.

displacement
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Mads Drøschler avatar image
Mads Drøschler answered

Give me some hours, I am doing something, but I can write you this plusminusaverage node in OSL.

10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Mads Drøschler avatar image
Mads Drøschler answered

Attached 3 custom osl shaders that attempts to honor your screenshot.
I have not tested it, I just wrote it directly but it should work? Let me know.
The nodes have both plus minus and average build in.
Note in OSL we cannot detect if a node is plugged in so you need to add the number of inputs and an integer.

I did not write a single generic plusminus average node, just attempt to solve your specific node rig, OFC we can modify and extend these nodes like we want. But it should give you a head start.

This is what the most right node looks like.

shader MOSTRIGHT_NODE
(
	 string Mode = "Plus"
  	[[ string widget="popup", string options = "Plus|Minus|Average",
  	   string label="Mode",
  	   string help="Pick a mode Plus, Minus, Average" ]],
vector Input3D_0 = 0,
vector Input3D_1 = 0,
vector Input3D_2 = 0,
int inputs = 3,
output float Out_3Dx = 0,
)
{	vector tmp;
	if(Mode == "Plus")
	tmp = Input3D_0+Input3D_1+Input3D_2;
	if(Mode == "Minus")
	tmp = Input3D_0-Input3D_1-Input3D_2;
	if(Mode == "Average")
	tmp = Input3D_0+Input3D_1+Input3D_2/inputs;
 Out_3Dx = tmp[0];
}

qwe.jpg (42.8 KiB)
qweqwe.jpg (56.1 KiB)
customrig.zip (1.2 KiB)
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Jason Hogg avatar image
Jason Hogg answered

Awesome thanks Mads! I'll try this out tonight.

10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Jason Hogg avatar image
Jason Hogg answered

Mads! It's working but I think the displacement is making the model a little puffy as the base grey level is either above or below 50%. I guess in the the plusMinusAverage node there's an option to do something like this with setting one of the 3D inputs to -0.5 (or whatever level necessary) to set the greyscale. Is it possible to write this into the OSL nodes? They're just for the 2 nodes on the left before they go into the multiply nodes. I attached a screengrab of the Maya plusMinusAverage.

screen-shot-2019-09-27-at-12435-am.png

Thanks again and this has been an enormous help so far!


10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Mads Drøschler avatar image
Mads Drøschler answered

I'm not entirely sure how that vector is hooked up to the input, I would assume it's an addition to the actual input 3D[0] for example.
If that is the case, you can actually also use a subtract node and subtract vector map ( 3 values ) from your input.
I attempt to include here, you can see I created 3 new vectors, a,b and c. adding up the original input and the bias input. so if you type in -0.5 it should lower the - other value.


Let me know if I broke it.

shader MOSTRIGHT_NODE
(
     string Mode = "Plus"
      [[ string widget="popup", string options = "Plus|Minus|Average",
         string label="Mode",
         string help="Pick a mode Plus, Minus, Average" ]],
vector i3D_0 = 0,
vector B_0 = vector(-.5),  
vector i3D_1 = 0,
vector B_1 = 0,
vector i3D_2 = 0,
vector B_2 = 0,
int inputs = 3,
output float Out_3Dx = 0,
)
{   
		vector a = i3D_0+B_0;
		vector b = i3D_1+B_1;
		vector c = i3D_2+B_2;
    vector tmp;
    if(Mode == "Plus")
    tmp = a+b+c;
    if(Mode == "Minus")
    tmp = a-b-c;
    if(Mode == "Average")
    tmp = a+b+c/inputs;
 Out_3Dx = tmp[0];
}

eee.jpg (49.0 KiB)
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Jason Hogg avatar image
Jason Hogg answered

That's so rad. I'll check this out later.

10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Welcome to the Arnold Answers community.

This is the place for Arnold renderer users everywhere to ask and answer rendering questions, and share knowledge about using Arnold, Arnold plugins, workflows and developing tools with Arnold.

If you are a new user to Arnold Answers, please first check out our FAQ and User Guide for more information.

When posting questions, please be sure to select the appropriate Space for your Arnold plugin and include the plugin version you are using.

Please include images, scene and log files whenever possible as this helps the community answer your questions.

Instructions for generating full verbosity log files are available for MtoA, MaxtoA, C4DtoA, HtoA, KtoA, and Kick.

If you are looking for Arnold Documentation and Support please visit the Arnold Support site.

To try Arnold please visit the Arnold Trial page.

Bottom No panel present for this section.