Announcement

Collapse
No announcement yet.

access/flatten geometry normals?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    access/flatten geometry normals?

    Hi all,

    The Material editor allows us to change normals; however this modification goes on top of existing vertex normals.
    Does anyone know how to flatten the normals per face? The resulting look would be that of imported geometry with 1 unique smooth group per face.

    Yes, the brute force solution is doing this on geo level in 3d package. This is not what I am looking for. I am looking for a material math that would take any geometry and output flat version; or a way to access the geometry normals to achieve the same result by feeding the negative into Normal channel.

    I also understand I can take the Vertex Normal in WS; but again, this does not tell me much about the normal of the faces it belongs to.

    Thanks,
    ALB
    --------------------------------------------------
    [alb Multi Tool Library]
    www.alsber.com
    https://www.youtube.com/user/kenhennen15

    #2
    Internally any vertex on a hard edge will be split into multiple vertices on a hard edge. So for example, a corner of a cube is not a single vertex with three normals, it is actually three vertices with one normal each. Also remember that vertex shaders operate on a single vertix at a time, so you can't simply average these normals across the different split vertices.

    If there is a specific effect you want to achieve that requires this you could potentially do some kind of preprocessing on the mesh and bake a second set of normals into the vertex color channel. However keep in mind that the vertices are still split and you are adding additional vertex color data, so your mesh would be quite a bit heavier. So if your goal is to simplify your pipeline and you do not want to be able to blend between the two I would definitely recommend modifying the source mesh, it's not like that is a lot of work and if you happen to have to process a large number of assets, then writing a script to batch process them is probably less work then getting this to work.

    Comment


      #3
      You can calculate triangle normal based on screenspace derivates of position. http://abload.de/img/normalsfromwpsxwits.png

      Comment


        #4
        Kudos Kalle-H, this is exactly what I've been looking for.

        Arnage - thanks, but as I said, I am not looking for a brute force on geo / texture level.
        --------------------------------------------------
        [alb Multi Tool Library]
        www.alsber.com
        https://www.youtube.com/user/kenhennen15

        Comment


          #5
          I indeed misread your initial question, I thought you wanted to do the reverse by create a smooth object out of one with hard edges. Reading it again derivatives indeed seem like the way to go.

          Comment

          Working...
          X