lighting 2 objects with gl.sketch, obscuring 1 (Hidden-Surface Removal)


    Apr 06 2009 | 5:19 pm
    Perhaps I am missing something very simple, but searching the forum and checking the redbook has not solved it.
    2 gridshapes are directionally lit by gl.sketch. one object is in front of the other. one should appear eclipsed by the other, but they are both lit the same. i thought this could be dependent on the drawing order of the objects in the gl.sketch command list; however, it seems not to matter where in the command list they are placed. i tried gldisable depth_test, no luck...blendmodes, no luck.
    below is my gl.sketch command list. a patch can be provided, but it is perhaps easier to add a second gridshape to the advanced lighting patch included with jitter's release.
    i am sure the answer is simple. thanks for the attention,
    ryan
    drawobject subject 0, drawobject obscured_subject 0, gldisable color_material, glmaterial front ambient_and_diffuse 0.5 0.5 0.5 1., glmaterial front specular 1. 1. 1. 1., glmaterial front emission 0. 0. 0. 1., glmaterial front shininess 12., glmaterial back ambient_and_diffuse 0.25 0.25 0.25 1., glmaterial back specular 0.568862 0.568862 0.568862 1., glmaterial back emission 0. 0. 0. 1., glmaterial back shininess 12., gllightmodel ambient 0.1 0.1 0.1 1., gllightmodel two_side 1, gllightmodel local_viewer 1, gllight light0 ambient 1. 1. 1. 1., gllight light0 diffuse 1. 1. 1. 1., gllight light0 specular 0. 0. 0. 1., gllight light0 position 5.4 -.7 -1.2 1., gllight light0 spot_cutoff 42., gllight light0 spot_direction 90. 0. 0., gllight light0 spot_exponent 0., gllight light0 constant_attenuation .01, gllight light0 linear_attenuation 0.01, gllight light0 quadratic_attenuation 0.07, glenable light0, glenable lighting, glenable normalize,

    • Apr 07 2009 | 1:01 pm
      Here is a simple example patch. How can the front plane block light reaching the back plane? Should be as simple as alpha channel, glBlendFunc, or drawing order, right? or is this where a stencil buffer is used?
    • Apr 07 2009 | 3:31 pm
      your handle works very funny for me, you might just want to connect your rotate direct, and do you have max 5?
      opengl doesn't do what your asking to my knowledge, you have to setup shadows or have the light only affect certain surfaces
    • Apr 07 2009 | 3:43 pm
      forget the handle, manually rotate. max 5, why? am still @adapt 0 with the interface.
      this is fundamental of opengl::object opacity and z-plane positioning.
      i am sure i am just overlooking something...
    • Apr 07 2009 | 8:11 pm
      as axiom said, one object blocking light from another object is called shadowing. there are no built in shadow techniques for opengl, you have to construct your own method.
      one possibility would be to use a texture as a lightmap, as opposed to an actual light. you could control the size and spread of the light with several differnt methods.
    • Apr 08 2009 | 10:18 am
      ok, i thought i was missing something as basic as object opacity. so, if a light is coming through a "window", the shape of the window would not influence the spread of the light unless a texture is used as a lightmap. would you have an example of this? cheers.