Announcements

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

Combine Vector with regular displacement

Anonymous

Combine Vector with regular displacement

Anonymous
Not applicable

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

0 Likes
Reply
1,694 Views
11 Replies
Replies (11)

madsd
Advisor
Advisor

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.

5555-qweqwe.png

0 Likes

madsd
Advisor
Advisor



5559-vectordispmix.jpg


5558-vectordispmixear.jpg


// 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.



0 Likes

Anonymous
Not applicable

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. 😕

5550-ear-noise.jpg

5561-ear-cell.jpg

0 Likes

madsd
Advisor
Advisor

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.

5560-qwe.png


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

0 Likes

Anonymous
Not applicable

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

0 Likes

Anonymous
Not applicable

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 node5574-ear-vector.jpg

0 Likes

madsd
Advisor
Advisor

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

Anonymous
Not applicable

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

madsd
Advisor
Advisor

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

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

0 Likes

Anonymous
Not applicable

now is working, thanks a lot for the help Mads. checking the video that is exactly what I did at the morning but I figure out, in Maya there is also a vectorspace in the displacement node that you need to change otherwise won´t work, don´t ask me why...hahaha

0 Likes

madsd
Advisor
Advisor

OK, good you got it working

0 Likes