Jump to content
  • Advertisement
Sign in to follow this  
racarate

OpenGL Hack to export light positions in .obj?

This topic is 1108 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've been practicing making and lighting simple scenes using just Blender, GLUT, OpenGL and C.  I really like that I can go from two empty pages to a lit low-poly scene in like two hours.  I use tiny_obj_loader to turn my .obj file into a list of positions/normals/uvs/indices.  The problem is I always have to place my lights by hand (that is, code) in each scene.

 

I know .obj is only supposed to contain static meshes and not light positions or anything else... but is there some simple hack I am overlooking?  Some sort of dummy object I can use to represent my light position and direction (and maybe more)?

 

What is the most common way to handle this, outside of using bigger formats or using custom formats?

 

Again, I'm not trying to make a game or an engine or anything I just really like making these quick sketches and I think it would be cool if I could place my lights in Blender instead of vim.

 

Thanks!

Share this post


Link to post
Share on other sites
Advertisement

Some sort of dummy object I can use

yes, just use a simple box, call it light (or assign a material that emits lights). after loading the scene, traverse through all objects and replace those dummy light meshes with actual lights. quick&dirty smile.png (and you can use the same for anything special you want e.g. particles or portals or fog volumes or....) Edited by Krypt0n

Share this post


Link to post
Share on other sites

This is maye a stupid question, but that would only give me position, right?  That is I couldn't use that for a directional light, could I?

Share this post


Link to post
Share on other sites

Yes, I love it.  Answers my next question as well, I just realized I can use X/Y/Z dimensions of the box as diff-intensity/spec-intensity/falloff!  Well, I guess that only makes sense if I wrote a script that converted lights to boxes in Blender, but still...  Thanks!

Share this post


Link to post
Share on other sites

I would advise against going this far.

Back when I had to use OBJ I had whole families of light_* materials which I used to mangle. It's just easier at artist time to remember than "if I stretch the box on the X, I will make the light brigher". BTW, DCC tools can operate on node transforms as well, at which point what you see isn't what you probably pull from the file albeit I'm positive you cannot observe this at OBJ level as the exporter will bake everything for you.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!