how to bake a normal map from a mesh that has rounded edges?

how to bake a normal map from a mesh that has rounded edges?

Mike_Isaakidis
Advocate Advocate
4,139 Views
12 Replies
Message 1 of 13

how to bake a normal map from a mesh that has rounded edges?

Mike_Isaakidis
Advocate
Advocate

New to Arnold so please bare with me.

Trying out some new workflows, to see if I can quickly get a normal map from an asset (in Maya).

So what I've done so far was:

1. Apply a roundcorners node on a aiutilty node (set the shade more to flat and color mode to Normal)

Result in render

4344-arnold-bake-1.jpg

2. Use render to texture an AOV (diffuse) to get the World Space normals.( i assume they are World Space?)

3. Open the exr file convert to 16bit in photoshop and save as a png.(cant save as another file format)

4. Use Handplane to convert the png file from Object space to tangent space (Handplane does not convert World space to tangent space).

5. Take the new converted file and apply it back in Maya as a normal map.

Result (normals are wrong)

4342-arnold-bake-2.jpg

4343-arnold-bake-3.jpg

I assume there is no way of getting a normal map directly baked on a texture from an AOV?

Is there a way to get the object space normals instead?

If you can render out a normal map, how should I have my smoothing groups?

How do I control padding?

How do I fix the graininess on the render to texture settings? (Camera settings (AA) were set to 4

Any help would be greatly appreciated.

Cheers

-Mike

0 Likes
4,140 Views
12 Replies
Replies (12)
Message 2 of 13

askinner6CDVL
Contributor
Contributor

I've done this. Add an aov for normals - n. Render that to texture. You will get a world space normal map. You can convert that to tangent space in substance designer in a few steps.

0 Likes
Message 3 of 13

madsd
Advisor
Advisor

You can convert world space normals to tangent space with the Space Transform node. You also need to move it from -1 to 1 into 0-1 by adding up 1 and multiply with 0.5 afterwards.
Solution fabricated by Arnold devs, I just forward info, its also what happens under the hood.

4677-eee.png

0 Likes
Message 4 of 13

askinner6CDVL
Contributor
Contributor

That's interesting to know. It might actually be less hassle than the method i tried. I will give this a shot. Cheers !

0 Likes
Message 5 of 13

askinner6CDVL
Contributor
Contributor

@Mads Drøschler Sorry I can't get this to work at all 😞 Could you elaborate on the steps you took to make this work? I have the shader set up like this - then I do render to texture and still get -ve values in the texture, also I can't get render to texture to render anything other than an exr. I'd like to automate this eventually so it would be good to get this working!

01.png

0 Likes
Message 6 of 13

askinner6CDVL
Contributor
Contributor

Here's the viewport and the texture bake in substance, see how there's still black areas that are negative.

02.png03.png

0 Likes
Message 7 of 13

Anonymous
Not applicable

@Aten Skinner add 1 and multiply by .5 now to remap it into 0-1 space

0 Likes
Message 8 of 13

askinner6CDVL
Contributor
Contributor

I'm already doing that in the shader though, see pic01 ^^

0 Likes
Message 9 of 13

askinner6CDVL
Contributor
Contributor

Oh hang on have I got the wrong end of the stick here? You mean +1 and *0.5 as a post process, i.e. in Substance I was thinking you could somehow bake it out like that

0 Likes
Message 10 of 13

madsd
Advisor
Advisor

I know this ain't a maya screenshot.
However.

Source the bumped Normal from AOV's back into a shade chain with READ AOV, the most left top.
Then source the unbumped normal with a state vector N, bottom, and source them to the space transform. See settings on space transform node.
Then move the entire thing into the correct space 0-1 with the constantbias scale +1 *0.5 Then exit to a WRITE AOV, I call mine test. then flip to it, and this is what I see.

Also, you need to setup the material, its the 2 nodes seperate from the transformation kit, its basically just an Arnold Material with the rounded corner plugined to Normal ( and we read this back into chain which is the first thing I described, top left node )

4799-www.png

This is basically also what you do if you toy with volumetric displacements using OSL shaders or whatever if they sit in tangent space from the get go, then we can move it into the right space so for example a cloud wont start to shift in a 45 degree angle when displaced, but instead take middle as starting point so volume gets displaced properly in all directions.

I also do this on the OSL flowmap, we paint in 0-1 space and move the data to -1 to 1 so that a paint strokes has 4 directions, eg, we can make circular strokes and the uv offsetting is following the brush, spotless perfection around in a circle.

4800-ddd.png

0 Likes
Message 11 of 13

Mike_Isaakidis
Advocate
Advocate

Does the round corners work for angles that are not 90 degrees?

(like 60 or 105, 125)

0 Likes
Message 12 of 13

3dbenjarn
Explorer
Explorer

Hi did anyone get a final Maya shader that worked with this? The answers are great but still can't get it to work. If anyone could share an image of their setup that would be great thank you

0 Likes
Message 13 of 13

skx555
Enthusiast
Enthusiast

I'm bumping this - @Ben Moseley - over at the Arnold Support Blog is an ASS Material of the tangent calculation, you can copy the code lines and import the node-setup https://arnoldsupport.com/2021/02/19/tangent-space-normal-maps/

its in the same way as Mads did it, but also the actual part how to visualize the Normal AOV is not clarified. I am uncertain, but could be that the part of setting up the (Normal) AOV as Material even differs between DCCs. I couldn't make it work in C4D. It's not clear how to feed / read / loop N from the scene geometry back to the custom Tangent Normal-AOV. Either by a second AOVwrite assigned globally as material or by object mask or aov tags locally? Or by a read/write from a Material on the normal nodes itself? And does the main AOVwrite Node need a Material assigned to the pass-through to actually draw anything at all?

Can anyone share a scene with the complete AOV setup set in place?




0 Likes