Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3399132
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:44:02+00:00 2026-05-18T04:44:02+00:00

I have an object on which I want to apply lighting. It is described

  • 0

I have an object on which I want to apply lighting. It is described in a text file with its vertex coordinates.

I read the following in the the OpenGL Superbible:

void m3dFindNormal(M3DVector3f vNormal, const M3DVector3f vP1, const M3DVector3f vP2, const M3DVector3f vP3);

To use this function, pass it a vector
to store the normal, and three vectors
(each just an array of three floats)
from your polygon or triangle
(specified in counterclockwise winding
order). Note that this returned normal
vector is not necessarily unit length
(normalized).

I understand that the order in which I pass the vertices (clockwise or counterclockwise) determines the orientation of the normal vector, so I wonder how can I make the function work with a file of this format.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T04:44:02+00:00Added an answer on May 18, 2026 at 4:44 am

    Hmm, this format looks kind of OBJ-ish, but with colors and without normals and texture coords. Seems like it’s not really a good choice! But if you really want to stick with it…

    My piece of advice no. 0 is:

    Use another format, seriously. 🙂 Raw binary dump of vertices (positions+normals+texture coords+colors+whatever) and then indices is the simplest solution usually. And if you really *really* want to use .off…

    My piece of advice no. 1 is:

    • import it into Blender (write an importer script in Python or use another tool to change the format)
    • have Blender calculate the normals for you (it’s going to do it well!),
    • export it to any format with normals.

    If you don’t want to (or can’t) do that for any reason, there’s piece of advice no 2. on how to generate normals yourself:

    • for each face, calculate its temporary face-normal (for a face A,B,C, it’s (B-A)x(C-B) ). Don’t rescale it to length=1 – the bigger the face’s area, the longer the resulting normal vector will be and that’s what we want (for now).
    • for each vertex, sum all the face-normals from the faces touching that vector (this is where non-normalization of per-face normals comes handy – you’d get some kind of a “weighted sum” with the face area being the weight) and then normalize the resulting vector. This is a nice approximation of a per-vertex normal which you can use.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an object which I first want to rotate (about its own center)
I have a 3d object which I want to keep in the center of
I have an object for which I want to generate a unique hash (override
I have this object which is an instance of a superclass. I want to
I have a productVariant object which has child product object. I want to show
I have a page in which I want to maintain the value of object
Ok, So I have an Image object that I want to rotate around its
I have a list of objects which I want to turn into a set.
I have a list of person objects which I want to send in response
I have 2 objects, both of which I want to convert to dictionarys. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.