Results 1 to 4 of 4

Thread: Lighting effect on unit sphere

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2009
    Posts
    4

    Lighting effect on unit sphere

    Compared the lighting effect (shadow and such) on the sphere created using glutSolidSphere and the sphere created myself, it appears on the former one the transition from bright region to dark region is smooth, the border that separate the two regions is a piece of nice arc, while on the one I made, the border looks jagged. I guess the normal of vertex is the key...

    Any ideas?

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Dec 2000
    Location
    Reutlingen, Germany
    Posts
    2,042

    Re: Lighting effect on unit sphere

    You need to "smooth" your vertex normals.

    Usually once first computes all face normals. Then one takes the normals of all faces that use the same vertex, adds them up and normalizes the result again. That gives you the average normal of all faces that use the same vertex.

    Have fun,
    Jan.
    GLIM - Immediate Mode Emulation for GL3

  3. #3
    Junior Member Newbie
    Join Date
    Nov 2009
    Posts
    8

    Re: Lighting effect on unit sphere

    I guess, for a sphere only, it might be easier to just create a vector from the center of the sphere to the vertex in question, normalize it and then use it as the normal for the vertex.

  4. #4
    Junior Member Newbie
    Join Date
    Jul 2009
    Posts
    4

    Re: Lighting effect on unit sphere

    Hello, Jan: I think that may make a difference, the one I made looks OK, just not as good as glutSolidSphere. I will try the averaging approach when I have got some time.

    Hello, GreenAlien, yes, that was way I did it.

Similar Threads

  1. Real 3D Sphere with bloom effect using frame buffers.
    By stavbodik in forum OpenGL: Advanced Coding
    Replies: 9
    Last Post: 12-25-2015, 01:37 PM
  2. Glowing effect with lighting
    By debinair in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 10-13-2013, 12:47 PM
  3. Mapping a polygon to a unit sphere
    By jenny_wui in forum OpenGL: General
    Replies: 6
    Last Post: 01-23-2013, 09:51 PM
  4. Random Points on the surface of a Sphere (Star Effect)
    By Carl Jokl in forum OpenGL: General
    Replies: 8
    Last Post: 02-09-2007, 12:54 PM
  5. Sphere rotation - rolling effect?
    By detzel in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 01-22-2002, 10:08 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
  •  
Proudly hosted by Digital Ocean