Results 1 to 6 of 6

Thread: Is it possible to access the surface normal (not vertex)?

  1. #1
    Junior Member
    Join Date
    Mar 2010
    Posts
    4

    Is it possible to access the surface normal (not vertex)?

    I would like to write a fragment shader that uses the surface normal rather then the interpolated vertex normal. Is there a way to access that information?

    Thanks,
    Doug
    twitter: @dugla

  2. #2
    Junior Member
    Join Date
    Sep 2010
    Posts
    12

    Re: Is it possible to access the surface normal (not vertex)

    What kind of shape is it? The common way to get smooth normals is to use point normals on the model and normalize the interpolated point normals in the pixel shader. I'm not sure what you're looking for when you say surface normal because you'd have to evaluate the equation of a surface like a sphere or something to get that.

  3. #3
    Junior Member
    Join Date
    Mar 2010
    Posts
    4

    Re: Is it possible to access the surface normal (not vertex)

    Quote Originally Posted by MegaJiXiang
    What kind of shape is it? The common way to get smooth normals is to use point normals on the model and normalize the interpolated point normals in the pixel shader. I'm not sure what you're looking for when you say surface normal because you'd have to evaluate the equation of a surface like a sphere or something to get that.
    I want the normal to the plane of the triangle rather then the interpolated normal.

  4. #4
    Junior Member
    Join Date
    Sep 2010
    Posts
    12

    Re: Is it possible to access the surface normal (not vertex)

    Ok it sounds like you want flat shading, correct? If that's the case make sure your triangles are all separate, no indexed triangles. Then make sure your normals for all 3 points in each triangle are all the same.

  5. #5
    Junior Member
    Join Date
    Mar 2010
    Posts
    4

    Re: Is it possible to access the surface normal (not vertex)

    Quote Originally Posted by MegaJiXiang
    Ok it sounds like you want flat shading, correct? If that's the case make sure your triangles are all separate, no indexed triangles. Then make sure your normals for all 3 points in each triangle are all the same.
    Unfortunately that is not a viable solution. Non-indexed triangles datas would be unthinkable for the datasets I am working with. I simply want the control - at the shader level - to create a faceted look as one of many different looks. I thought to attach the plane normals as vertex attributes but the won't work with a shared verted model. Sigh...

  6. #6
    Junior Member
    Join Date
    Sep 2010
    Posts
    12

    Re: Is it possible to access the surface normal (not vertex)

    I'm pretty sure it's the only way though. I have a lot of graphics experience. I would love for someone to prove me wrong though and show a novel way to do it.

Similar Threads

  1. How to copy content from pixmap surface to window surface
    By mustaf in forum OpenGL ES general technical discussions
    Replies: 0
    Last Post: 10-05-2008, 09:44 PM
  2. Light and Normal
    By Eymerich in forum OpenGL ES general technical discussions
    Replies: 5
    Last Post: 02-22-2008, 09:34 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •