gl planes and directional transparency

    Apr 30 2011 | 6:08 pm
    ...or something like that!
    Need some help. I'm trying to add some interest to a simple 2d chalk sketch of a city. In the patch below, I've loaded the image as a texture and via gl.nurbs have warped it a bit. Then changing the camera angle I can fly around my fake 3d city.
    My problem is that as the image begins to wrap upon itself (by changing the camera angle), there are some horizontal planes that appear that are transparent if you are looking from above, opaque if looking from below. In patch below with the sample image illustrates this better than I can explain. Rotate the image and you'l start seeing the upper planes at ~50°.
    So my question: how do I make these planes transparent on both sides. And a related question...where are these planes coming from? From gl.nurbs?
    Thanks in advance!
    Best, David

    • Apr 30 2011 | 10:56 pm
      If I understand what you are referring to, you might want to turn off depth buffering (@depth_buffer 0) on the jit.window.
    • Apr 30 2011 | 11:20 pm
      that was it! Thanks, Ben. Now just need to figure out why I had it on in the first place!
    • May 01 2011 | 7:25 pm
      OK, I have a follow-up! I have tools that for "mapping" projections onto a virtual background. But now I've complicated my life by warping my background in the z-direction, AND have a desire to "fly around" my fake 3D city. Since my mapping never takes into account z, I can get it to look good from one angle, but not when I start to change the camera angle. I'm probably not making any sense here, but is there a way to add textures to this warped background that are scaled/position to fit in particular background, and maintain their relative position in the background image as the camera angle changes?
      I've attached an image to show what I mean wrt adding an additional texture. I just need a nudge in the right direction...or confirmation that I'm in over my head without more gl knowledge.
      Thanks, David
    • May 02 2011 | 4:11 pm
      I don't think I'm making any sense here :)
      Let me see if I can do a better job!
      In the image posted above I have a chalk outline of a cityscape. To give it some interest I wanted to map the image to a curved surface and then adjust the camera position to give it a bit more of a 3d effect. was great for this (first patch in this tread), and applying the chalk-city as a texture. Now I want to add more textures to the cityscape, like the building billboard above, that follow the same structure provided by for the cityscape...however not have the texture take up the entire surface. Does this make any more sense? My current path is to create another layer using nurbs, but am trying to figure out how to "scale" the texture so it only occupies part of the surface, and is transparent elsewhere. Possible?
      Thanks in advance for any pointers!
      Cheers, David
    • May 03 2011 | 5:05 pm
      OK. Came up with a path that seems to work. Basically any time I alter the matrix controlling of my "chalk city", I output the resulting surface generated by gl.nurbs as a matrix. Then when I set the xy vertices of subsequent layers I look up the corresponding z-value at those points, adjusting the surface through another (a different gl.nurb for each layer). Seems to work really well, but am now back to struggling with depthbuffer flag on gl.window. turning it off removed the artifacts I was seeing in my original post, however I lose the depth relationship of the different layers as a result. I'll post some pictures shortly to see if I can't get some more guidance wrt this.
      Cheers, David