question

Joe Tuscany avatar image
Joe Tuscany asked ·

Combine Vector with regular displacement

I´m trying to translate this tutorial into Maya to combine a vector with a regular displacement but I am not finding the rgb to vector node so it seems I´m bit lost.
Anyone knows if in Maya is missing that node? Thanks

https://docs.arnoldrenderer.com/display/A5AFHUG/Combining+Regular+and+Vector+Displacement+Maps

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 ·

The RGB to vector node is in the conversion folder highlighted to the left.
Do note that this node does not contribute with anything except changing data type from rgb to vector.

Vectors, Colors and in many cases points are the same thing, you can use vector to parse color data, I do it constantly in OSL. So adding that node does nothing, you can do it however.

I also wrote a small rgbtoVector node as seen here, to verify this, result is identical regardless of it being rgb or vector in this case.


So in reality, atleast in core Arnold and MAX, you can just plug the add node directly to the displacement slot and you are good to go.

Do note that in Houdini, you need to flip the Y on the vector map, in max, this is not required, so if you get a twisted up ear, try flip that bool in Maya.


qweqwe.png (622.8 KiB)
Share
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.

Joe Tuscany avatar image
Joe Tuscany answered ·

ok, I think now that I´m doing something totally wrong. I remove the autobump from the displace settings and now it´s rendering only the vector ear, no noise, so it seems the blending isn´t working and I don´t know why.

I follow the tutorial here is my hypershade node


ear-vector.jpg (380.5 KiB)
5 comments Share
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.

If you look at my OSL code. line 37, you see an "N" in there.
Your state vector is set to Ro ( Ray Origin) so you are sampling something, Not-Normal. which is the camera to point ray.

Change Ro to N.
( But use my OSL shader instead for an easier setup )

Line 37 makes it up for multiple Arnold nodes, so its more efficient, fills less, less error prone.

0 Likes 0 · ·

Hi Mads, thanks again, I tried again with your shader but I got some errors or maybe I don´t know how to plug the maps, also I would like to use the complex shader node because maybe I can add more than one displacement
I also tried to change to "N" but it isn´t working neither. When I changed it, the plane move up and the noise appear now, but is flat...anw I feel so stupid now...hahaha. I will try again at night
Thanks!

0 Likes 0 · ·

Here I build it from scratch, if you follow, it will be impossible to fail.

https://www.twitch.tv/videos/532748986

1 Like 1 · ·
Show more comments
Joe Tuscany avatar image
Joe Tuscany answered ·

Ey Mads, thanks a lot of the osl shader and explanation.

At the end, I plug the add node and it seems to work, I need to adjust the noise intensity. Another problem that I´m having is the result, it seems that the displacement is applied as bump rather than the regular displacement affecting the silhouette, with the cell noise is quite obvious.

We don´t have the rgb to vector node in the conversion menu in Maya, that is why I was asking. :/


ear-noise.jpg (233.7 KiB)
ear-cell.jpg (382.2 KiB)
2 comments Share
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.

Im not entirely sure why you get those black spots, what kind of noise are you using? and in what mode?

I get this by using a regular OSL FLOAT output noise. Not some vector setting noise. The darks are because of shadows, not because the mesh turns the inside out.


Can you try run this through your mesh, its a debug shader checking normals. if they are inverted or facing correct ( you can also use it to shade leafs realtime translucency and many other things.


https://github.com/gkmotu/ArnoldSceneConverterScripts3DSMAX/blob/master/Shaders/FrontBack.osl

1 Like 1 · ·
qwe.png (973.5 KiB)

Just edit mtoa.mtd file in "C:\Program Files\Autodesk\Arnold\maya2020\plug-ins"
search for [node rgb_to_vector]
change
maya.hide BOOL true
to
maya.hide BOOL false

1 Like 1 · ·
Mads Drøschler avatar image
Mads Drøschler answered ·





// VectorDispMIX.osl
// 6.1.2020 Mads Drøschler
// based on https://docs.arnoldrenderer.com/display/A5AFHUG/Combining+Regular+and+Vector+Displacement+Maps
// License: Free

shader VectorDispMIX
(
point Pos = P,
color In = 0
[[
string label = "DetailMap"
]],
float scale2 = -0.8
[[
string label = "DispScale"
]],
string fileName = ""
[[
string widget = "filename"
]],
float scale = 75
[[
string label = "VectorDispHeight"
]],
int InvertY = 0
[[
string widget = "checkBox"
]],
output vector Out = 0,
)
{
point Po = Pos;

if (InvertY == 1 )
Po[1] = 1-Po[1];

vector Normal = transform("object",N)*scale2*In;

Out = texture(fileName,Po[0],1-Po[1]);
Out = vector(Out[0],Out[2],Out[1])*scale;
Out += Normal;
}


I simplified the experience to 3 nodes.
I could plop it all into 1, but this should be fine, then you dont need to speculate about setting it up, because the shader does it for you ~

Also added optional Flip Y switch in bottom of shader UI

Also added to Git ->
https://github.com/gkmotu/OSL-Shaders/blob/master/VectorDispMIX.osl


We may need to ask Rachid to make the .mtd UI file for Maya tho at some point.




vectordispmixui.jpg (46.3 KiB)
vectordispmix.jpg (122.4 KiB)
Share
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.