3D questions - Subsets and transparancy

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • 3D questions - Subsets and transparancy

      Hello everyone,

      After a long break, I decided to get back to work on my engine. I got into the 3d stuff (just to feel I was actually acieving something ;)), and as I progressed, I got a little confused about some things.

      I'm not sure how the SceneNodes are intended to be used for more complex meshes, particularly in regard to alpha rendering.

      What I've been doing so far, is divide a mesh into subsets by material. Should be easy enough to determine alpha per subset, but should each subset then be a scenenode? Or should I just add an entire mesh using a transparant material to the alpha rendering list?

      It would seem to me that making each subset a separate node would make somthing like animation more complex, but adding the entire object to the aplha list seems somewhat crazy, too, since determining distance for transparant objects could mess some things up here. I can imagine two large objects with transparant subsets, and the transparant subset of the farthest object actually being closer to the viewport. I'm guessing that could mess up the rendering order.

      Does what I'm saying make any sense? lol

      Kind regards,

      David
    • I thought the point of the Mesh was so each mesh should only have one subset. That way you can use a TextureNode and MaterialNode in the SceneGraph to reduce render state changes in a smarter way (less changing of textures/materials, especially if the repeat).

      You could make the mesh a single subset and use a larger texture kind of like a texture atlas, even if just for two or 3 textures and put it all in the alpha pass so it renders as one model.

      Besides, for fully invisible pixels I don't think it even needs to be in the alpha pass, just clip them either by Alpha Testing or HLSL clip:
      msdn.microsoft.com/en-us/library/bb204826(v=vs.85).aspx

      The only trouble is with alpha *blending* where one color adds to the background color etc, only then it needs to have the rest of the scene rendered beforehand, if the pixel is * entirely* clipped then the background can still be replaced without any trouble, as it doesn't use an add function between the pixel (if not clipped) and the background (which if replaced gives incorrect blending).

      See what I mean?

      So if one is 0.5 alpha it might be best to make it a whole new node of its own.
    • Thanks for the reply, Shanee.

      I guess making each subset a separate node does make sense, but I wonder if something like applying animation matrices to an entire object wouldn't result in more calls to the animation function, and if this would have noticeable impact on rendering time.

      But all in all, I hadn't considered making each subset a separate node would indeed make it easier to batch-render material types. I guess it's not really necessary to split the subsets into separate arrays of geometrical data, I could just give a node pointers to buffers and index offsets + number of indices, as I'm doing now.

      Well, in any case, thanks for the response, adding a node per subset is the way to go, it seems! :)
    • In most commercial 3D engines the alpha phase is drawn not as meshes, but as individual polygons - these polygons are collected during the traversal of the scene nodes, and drawn only after all the opaque polygons.

      This way allows two meshes each with transparent polygons to draw corectly, even if they sort inside one another.

      The engine in GCC is made a little simpler to help programmers get a grasp before going to the big leagues. I hope that helps.
      Mr.Mike
      Author, Programmer, Brewer, Patriot