1
votes

I have a program which is able to parse and interprets OBJ file format in an OpenGL context.

I created a little project in Blender containing a simple sphere with 'Hair' particles on it.

After conversion (separating particules from the sphere) my particles form a new mesh. So I have two meshes in my project (named 'Sphere' and 'Hair'). When I want to export the mesh 'Sphere' in an OBJ file (File/export/Wavefront (.obj)), selecting 'include Normals', after exportation, the file contains all informations about normals (ex: vn 0.5889 0.14501 0.45455, ...).

When I try to do the same thing with particles, selecting 'include Normals' too, I don't have normals in the OBJ file. (Before the exporting I have selected the right mesh.)

So, I don't unsterstand why normals properties are not exported for mesh of type particles.

Here's above the general Blender render of my hair particules. As you can see all particules have a reaction with the light. So Blender use normals properties for thoses particules.

enter image description here

And now, the picture above shows (in Blender 'Edit mode' -> after conversion) that particules are formed of several lines. In my opengl program I use GL_LINES to render the same particules. I just want to have normals information to manage light properties on my particules.

enter image description here

Do you have an idea how to export normals properties for particules meshes?

Thanks in advance for your help.

1
Are particles in this situation described by points? If so, why would they have normals?Jacob Parker
Yes I have already see this page and my hair particules are already converted in OBJ file but without normals informations. My particules, are discribed by lines (a hair is formed by several small lines). So I think it's possible to have normals properties (I believe that a line (GL_LINES) is a tiny polygon and all polygons in OpenGL should have normals properties). What do you think about my point of view ? Thanksuser1364743
Ah, missed the bit about hair. I'm guessing this is for a good reason in Blender, and I explained more in my answer below (it didn't want to fit in a comment :))Jacob Parker

1 Answers

3
votes

You are trying to give normals to lines. Let's think about what that means.

When we talk about normal vectors on a surface, we mean "pointing out of the surface"

surface normals

For triangles, when we define one side to be the "front" face, there is exactly one normal. For lines, any vector perpendicular to the line counts as a normal - there are infinite and any one will "do".

What are some reasons we care about normals in graphics?

  • Lighting: e.g. diffuse lighting is approximated by using the dot product of the normal with the incident light vector. This doesn't apply to hair though!
  • Getting a transformation matrix: for this you can pick any normal (do you want to transform into hair-space?)

In short: you either can pick any perpendicular vector for your normal (it's easy to calculate this) or just not use normals at all for your hair. It depends on what you are trying to do.