Why does the ray fire from the cage's edge along the average normal?

Question Materials and Textures
posted to: Using Cage Objects

On the course video, the ray fires from the cage's edge along the angle about 45 degree (or along the average normal of the cage's edge in the opposite direction):

However, all the cage's edge normals are still perpendicular to the corresponding faces unless the "Shade smooth" is used. As the following screenshot shows, no average normal is used, all edge normals are split normals.


So why does this course assume that the ray fires from the cage's edge along the average normal (in the opposite direction) please? Thanks!

  • Martin Bergwerf replied

    Hi nnaiad ,

    I don't know this, but it might have something to do with the fact that with split Normals, a lot of rays would simply never hit the Object:

    Rays.png?

    Or even worse, in the wrong spot?

    @jlampel will certainly be able to answer this.


    1 love
  • naiad replied

    The course has already mentioned some problems caused by the rays fired along the split normals. But my question is that:

    I don't understand how the rays can fire from the cage's edge along the average normal. Because this is only possible if the "Shade Smooth" is applied. With the "Shade Flat", the cage only has split normals. However, this course does not mention that the "Shade Smooth" is applied.

  • Martin Bergwerf replied

    Although the Cage is not Smooth Shaded, the information of the averaged Normals is still available (or easily calculated).

    The Rays are not dependent on the Normals of the Cage.

  • naiad replied

    "The Rays are not dependent on the Normals of the Cage."

    Then, who determines the direction of the rays please? Can I manually control the direction of the rays? Thanks!

  • Adrian Bellworthy replied

    Like Spikey, I'm not entirely understanding of how this works.
    I would suspect by enabling the cage option in the bake properties may alter the normals.

    On further reading, the blender manual says,

    When not using a cage the rays will conform to the mesh normals. This produces glitches on the edges, but it is a preferable method when baking into planes to avoid the need of adding extra loops around the edges.

     The inward rays are casted from a version of the active object with disabled Edge Split Modifiers.

    The normals (rays) as I understand it, on the cage object the angles of the rays are dependent on position.
    Something like this:

    ge-normals-angle.jpg

    These are not exact angles but a guide

  • Martin Bergwerf replied

    What I meant was:...not dependent on the 'Shading Normals' of the Cage. (The Cage doesn't even have Shading...)

    I don't think you can control the ray direction manually, but again, I am not sure about all this.

  • Omar Domenech replied

    Boy, that escalated quickly. I'm guessing the cage does to the normals its own thing under the hood, without you having to set shade smooth or anything. Blender be nice like that, saving you a hassle or two. 

  • naiad replied

    AAdrian ,

    45 degree, 56.25 degree, 67.5 degree, 78.75 degree .... do you know why the angles of the rays are changed based on those exact values please?  

    It is unbelievable to me that a simple cage will tell the direction of the rays to behave in a such precise manner.


    " without you having to set shade smooth or anything."

    OOmar

    Yes, you are right - when baking the normal map and no cage is used, people do have to set both the low poly and the high poly with "Shade Smooth". For example, 

    https://blenderartists.org/t/normal-map-doesnt-bake/1403559

  • Martin Bergwerf replied

    nnaiad

    don't worry about those angle values too much; the side of the Object has to be represented on the side of the Cage and because the Cage is larger, the corresponding points of the Object are in an angle to the Cage:

    Ray.png

    • 👍
    2 loves
  • Omar Domenech replied

    Cool in depth explanations. And even though we see that picture above as a cube from up top and a cage with the normals pointing at the cube, I like to think of it as a trampoline, with the elastic tendons supporting the thing where you jump at the middle.

  • Martin Bergwerf replied

    It's amazing, how many complicated CG concepts can be explained by trampolines

  • Adrian Bellworthy replied

    Exactly as Spikey said, visualized as if the cage is extruded from the mesh, with many more rays than in the visuals.
    Knowing how things work is useful, but try not to get bogged down by the details of how and why. 
    It will probably have little or no effect on the result of your Blender project.

  • Jonathan Lampel replied

    Martin's picture above is perfect! A cage only works because it has the exact same vertices as the low poly object. The bake can then use the imaginary line that's drawn in between each matching vertex to guide the rays INSTEAD of using the normals. 

    1 love
  • naiad replied

    Based on the answer from Martin, does this mean that the directions (or the angles) of the rays for a cylinder must look like the diagram below please?

    (On the diagram, the rays fire inward and follow the imaginary straight lines from the external cage to the surface of the cylinder.)

    • Yep!
    • 👌
  • Martin Bergwerf replied

    That looks right to me, naiad.

    1 love
  • Thomas Hock(Nokota) replied

    One thing I still don't understand at all is (assuming the picture of Martin is accurate or very close to what happens internally):
    Isn't that basically what happens when we set the LP to be smooth (if we don't subdivide the LP mesh a few times) ? And if so, why do we not run into the problem of flat surfaces appearing to be slightly rounded (as the angle of rays hitting the LP changes from the vert to the center of the face)? 

  • Martin Bergwerf replied

    Hi Thomas NNokota ,

    If you use Smooth Shading, it changes the Shading Normals of the Mesh...indeed something like in my picture, but the Ray is cast like the green arrow and finds the Normal in that point to be like the blue arrow (should be straight down):

    Raycast.png

    I hope that makes sense.



    1 love
  • Thomas Hock(Nokota) replied

    It does make sense but I still don't really understand why a smooth shaded LP gives us a different result.
    Is smooth shading changing the way Blender calculates the Normals? As in collecting the Normal Data and then interpolating those Normals to give a smoother result?

  • Martin Bergwerf replied

    "Is smooth shading changing the way Blender calculates the Normals?"

    Yes!

    Have a look at the Blender 3.0 Basics Course: https://cgcookie.com/lessons/intro-to-blender-and-cg-cookie

    This lesson for instance:  https://cgcookie.com/lessons/mesh-normals-and-shading 




  • Thomas Hock(Nokota) replied

    Hey, sorry, I communicated unclearly.
    I understand that Normals of adjacent faces get interpolated when using Smooth Shading instead of Flat shading.

    While trying to explain to you better what my problem is (or rather was), I think I understood what you were trying to tell me. And I am pretty sure I now also understood the thing I could not wrap my brain around. I'm still having problems on understanding what the exact math is behind it but I'll figure that out.

    Thanks for your Help, Martin!

    • 👍🏻