Number of normals in MaxScript

Started by
2 comments, last by GamerSg 20 years, 5 months ago
I am attempting to write a file exporter in Maxscript and am stuck at this point. How do i get the number of normals using MaxScript? When using smoothing groups, the number of normals tend to be different from the number of vertices. Max doesnt split vertices for every unique normal which is what i want since i plan to use vertex arrays to do the rendering.
Advertisement
I believe that Maxscript use index of normal for each face...to check.
!o)
Chuck is correct. In general, Max tends to store information per-face, not per vertex. This is the case whether you use Maxscript or the Max SDK. The downside to this, of course, is that getting an optimized set of data where each vertex has the information takes a bit more work.

Basically, the easiest way to do this is to simply create 3 vertices for every triangle. Then, once you have all the verices you can go back and check for duplicate data and make an optimized list.

Also, on a seperate note, I seem to recall that there are multiple methods for getting the normal for each face''s vertex. Unfortunately, most methods DO NOT return the result you''re after. I don''t have my code here, but if I recall correctly, the function you want to use to get the normals is "meshop.getFaceRNormals". I believe the other functions, for whatever reason, didn''t seem to take into account things like smoothing groups correctly. Also, if I remember correctly, meshop.getFaceRNormals also gave incorrect results, but only in the case where the face had NO smoothing groups applied.

So, basically to get the normals for each face you do something like this(psuedo-code):

if ( Face has smoothing group )
(
Use "meshop.getFaceRNormals" to get the face''s 3 normals
)
else
(
Use "getFaceNormal" to get the normal of the face itself
Set each of the face''s 3 normals to that normal
)

Hope that saves ya some time

-John
- John
I''ll look into it. Im currently considering modifying the IGAME example on discreets website which generates a xml file to what i need. The example also takes care of smoothing groups, skinning and bones nicely.

This topic is closed to new replies.

Advertisement