2

I wonder how I can render camera-view invariant surface Normal maps in Blender (ideally, through Blender's Python API)? Maybe as the first step, can someone explain how one can obtain surface Normals? My goal is actually to get surface Normal maps that are not dependent on the camera angle. How can I do that?

I have tried two methods but cannot get the kind of results I expect: 1- I can only see the surface Normal maps by pressing N and then clicking on Matcap and selecting the Normal ball as shown below. But I cannot use this method to get renderings.

enter image description here

2- I followed what @Bruno's suggested in his response too. Although the rendering problem seems to be solved, but I still am not able to get camera view-invariant renderings of surface Normal maps as can be seen below:

enter image description here enter image description here

And here you can find the corresponding .blend file.

Amir
  • 3,074
  • 2
  • 29
  • 55
  • Are you trying to bake normal maps from a high poly to a low poly model? – Craig D Jones Feb 21 '18 at 02:13
  • @CraigDJones Sorry I'm a little bit confused. As far as I know my problem has nothing to do with the number of vertices used for each face. I just want to render a surface Normal map of a 3D shape. That 3D shape could have many faces (say a couple of thousands). For your information, the faces have 3 vertices (triangle faces). Also, what I want has nothing to do with lighting condition as explained here. Does that help? – Amir Feb 21 '18 at 02:21
  • The Matcap is just for visualization, but if you bake from the model to a lower resolution one that encapsulates the original, and have an UV mapped image set to bake to, then you can bake out a normal map that can then be used similarly to the page you show. – Craig D Jones Feb 21 '18 at 02:27
  • @CraigDJones Sorry but almost all of the things that you said seem new to me. Could you please post an answer if you know how this should be done practically? Python code is appreciate more. – Amir Feb 21 '18 at 02:42
  • This could be of some use to solving your problem: https://blender.stackexchange.com/questions/39528/matcap-materials-as-a-material-for-render – masterj2001 Feb 21 '18 at 03:23
  • @masterj2001 Do you mean obtaining invariant surface Normal renderings? – Amir Feb 21 '18 at 03:30
  • @masterj2001 I have updated my question. I still could not clearly establish the connection between the link you sent me and my question. Can you elaborate a bit more please? – Amir Feb 21 '18 at 17:58
  • Hello, I think I don't understand what you are after: 1. Do you want to render camera-independent normals (in world space) including normal maps? 2. Do you want to display those, but not render? 3. Do you want to obtain surface normals in python including normal mapping? – Jaroslav Jerryno Novotny Feb 22 '18 at 08:27
  • The matcap normal ball is view-dependent, now I don't think you want that, maybe that confused me. – Jaroslav Jerryno Novotny Feb 22 '18 at 08:30
  • Try this material for object-space normals: https://i.stack.imgur.com/zoX4c.png. Is this the output you want? If yes I will write answer with how to get normal maps displayed like that also. – Jaroslav Jerryno Novotny Feb 22 '18 at 08:34
  • @Jerryno Thank you. I realized that the solution posted by Bruno works in Cycles. But I also wonder, why your solution discards the car tires and some other parts of it? – Amir Feb 22 '18 at 16:06

1 Answers1

2

This seems to work only in Cycles, not Blender Internal.

Simply enable Normal pass in your render layer. That'll produce the "invariant" normal map along side the combined rendering. enter image description here

Bruno
  • 4,179
  • 8
  • 21
  • I updated my question. Could you please check it out again? – Amir Feb 21 '18 at 03:12
  • I checked my simple model and it IS invariant when I rotate the camera around. May be there's something wrong with your setup. Are you rotating the camera or the model in the screenshot shown? Can you share your Blender file? – Bruno Feb 21 '18 at 03:58
  • I updated the question and uploaded the .blend file. Could you please take a look? – Amir Feb 21 '18 at 15:40
  • A quick look at the blend file confirma what you're seeing... not sure what's happening yet. I'll take another look later – Bruno Feb 22 '18 at 07:04
  • I noticed you are using Blender Internal renderer in your scene. Using Cycles instead and the Normal Pass in the render layer and it seems to produce the proper invariant normal map you are looking for. – Bruno Feb 22 '18 at 13:27
  • Does it matter if I use a higher samples for rendering surface Normals in Cycles? It seems that it does not produce higher-quality results and the normals always look the same. I also have another question: When rendering surface Normals through Blender Render inside the headlamps and inside the car is also shown. Why is not the case in when using Cycles? Is there a way to do that? – Amir Feb 22 '18 at 15:30
  • What do you mean? – Bruno Feb 22 '18 at 15:37
  • If you look at the renderings I obtained using Blender Render, you can see that the stuff inside the headlamps and inside the car (wheel, seats etc) are also shown. But switching to Cycles only gives me a view on the surface of the car, but not beyond the windshield and headlamp's glass. Is there a way to somehow capture those details? – Amir Feb 22 '18 at 15:45
  • I think the glass thing is a separate issue. I'll figure it out somehow. Thanks for your answer! – Amir Feb 22 '18 at 16:17
  • Agreed it is another issue though it makes sense that a transparent surface should not be transparent in the normal pass. May be another blender internal normal pass issue. – Bruno Feb 23 '18 at 03:46