XNA Creators Club Online
Page 1 of 1 (9 items)
Sort Posts: Previous Next

vertex vs polygon normals

Last post 04-16-2008 7:23 PM by Richard Clifford. 8 replies.
  • 03-06-2008 5:20 PM

    vertex vs polygon normals

    If I place a cube in xna, then export it as fbx and use it in my xna project, the normals used for shading point diagonally outward from the cube vertices (the average normal for 3 faces of the cube).  so when drawing, the lighting on the cube doesn't look right.  It looks more like I am lighting a sphere with a VERY low polygon count.  So I see the advantage of the way the vertex normals are generated  if you are lighting a rounded object with a higher polygon count, but what about when you want sharp eges like for a cube?  Do I need to add more vertices somehow?  I'm thinking that I need to do something in XSI before exporting so that I get the normals that I want.  Does my problem make sense and how do I solve it?

  • 03-11-2008 11:52 PM In reply to

    Re: vertex vs polygon normals

    since nobody has answered my question yet, let me try to ask it differently.  suppose that i have a hemisphere model.  i want all of the polygons that make the dome to share their edges and vertices so that a normal at a vertex is the average of those of the neighboring polygons.  when I have a vertex on the sharp edge between the dome and the flat side, I am going to want this vertex to have a normal for the polygons on the flat part and a different normal for its polygons on the domed part.  i assume that i will need to tell xsi that certain edges (ie, the ring around the base of the dome) should be duplicated or something.  how do i do that?
  • 03-12-2008 12:56 AM In reply to

    Re: vertex vs polygon normals

    The 3D Studio Max term for creating those hard edges you're looking for is called smoothing groups. Separating faces by smoothing group allows you to define edges, I'm not sure what the XSI term for this is but I'm sure somone could help you out with that. If your model looks correct in xsi and looks wrong in xna, I would also be inclined to suggest that maybe this is an exporter setting. Perhaps look for something along the lines of "Split mesh for per vertex normals".

    So you're on the right track with the normals and such if you were to develop your own model class. You would need to have duplicate vertices around the edge and have one normal for the down part and one normal for the dome part. But you really shouldn't have to do any of this really low level work unless you're procedurally generating a dome for some purpose. If this is for a model built offline all this kind of heavy lifting should really all be done already anyway in the exported file. Any additional processing should be reasonably easy to do with the helper methods and other tools provided in the content pipeline. I would suggest checking out the samples look at the custom model processor and some of the other model sample classes.

    http://blogs.msdn.com/shawnhar/archive/2007/09/19/note-to-self-model-hammer.aspx


    Cheers

    Kyle
  • 04-11-2008 4:39 PM In reply to

    Re: vertex vs polygon normals

    I have to admit, I got frustrated with modelling and ignored this aspect of my game for a while, but after more trial and error, I have found that the concept I am describing is in fact hard edges.  The problem, however, is that when exporting to .fbx the hard edges that I marked are ignored and I still get the soft edge appearance in my game.  Recently, I discovered how to export to the .x format, and this export saves hard edges correctly, but the texturing in my game on .x models doesn't work.  So now I am stuck without a way of getting both texturing and hard edges into my game.  What can I do?  How do I get the fbx exporter to do hard edges?  (I don't have a clue what goes wrong with the texturing in .x export, so I don't think I can go the .x route as easily)

  • 04-12-2008 11:28 AM In reply to

    Re: vertex vs polygon normals

    I've got nothin man, by the sounds of it your probably missing some little check box there. It really can be as easy as that, make sure your up to date with all the newest xsi mod tools or whatever your using aswell.

    Besides that I'm not sure I can help you.

    Sorry.

  • 04-14-2008 8:22 PM In reply to

    Re: vertex vs polygon normals

    Hello, a couple of suggestions for you to try.

    Flip your texture vertically for the exported Direct X model. 

    Freeze the operator stack on your mesh prior to saving as an .fbx.  This is done by selecting the model, and in the bottom right corner you should see a button labelled 'Freeze'. 

    I hope one of these works.

    Richard
  • 04-16-2008 2:39 AM In reply to

    Re: vertex vs polygon normals

    I appreciate you guys trying to help, but I'm not having any luck.

    With the fbx, there are not many options in XSI's fbx exporter and I have tried all the ones that sound remotely related (ie everything but the animation category).  I tried freezing too, but that didn't help.

    On the .x format, I'm not sure where you are suggesting I flip the texture (when applying?, export option?, later in XNA?).  Unfortunately, I don't think that is the issue because the texture looks fine in XSI, but in my game, it looks like only the color from one of the image coners is being used to texture the whole model (its not just upside down or backwards).  Also, when I do export a TEXTURED model to .x format, I get an error that says "Function not implemented in EXP version" (I don't know what function its referring to) but the .x file is still generated and the model shape is fine in the game but has the texturing problems.

  • 04-16-2008 11:03 AM In reply to

    Re: vertex vs polygon normals

    when exporting to .fbx the hard edges that I marked are ignored


    Sounds like there's a problem with XSI. If you can't find a fix on their tech support forum, you'll have to use another modeler.
    Tools that support the .X format include the DeleD level editor, the Milkshape general mesh editor, and, of course, Autodesk 3ds Max.

    Jon Watte, Direct3D MVP kW X-port 3ds Max .X exporter kW Animation source code
  • 04-16-2008 7:23 PM In reply to

    Re: vertex vs polygon normals

    Hello again, I recall having a similar issue with exported Direct X models.  The texturing looked all messed up in XNA but the model was fine.  I found flipping the texture vertically in my paint package before loading it in XNA fixed it.    So I had two copies of the texture, one as normal for editing in XSI, then a flipped version loaded as a Texture2D for the model.  I think it has something to do with left vs right handed coordinate systems, but I'm not really sure of the why.  (It was a while back,  I may have flipped it both horizontally and vertically to get it's mirror image)

    Why your fbx export doesn't seem to work correctly I don't know.  Have you tried installing the XNA addon for XSI?  Have a look over at this xna to xsi tutorial.   

    Try installing the addon, reference the two .dll files it creates, then in XNA change your 'Content Processor' for any fbx models to the 'Crosswalk model importer'. The two .dlls are located in your Softimage installation directory under... Addons/XNAGse/Application/References/XNA 2.0  If you get a error referencing them, copy and paste the dlls into your project folder and reference them again.  This error is weird.  This might fix your hard edge problem.

    Getting models from XSI into XNA can indeed be obtuse.  Sorry if this turns out to be a dead end as well.

    Richard



Page 1 of 1 (9 items) Previous Next