Hack to export light positions in .obj?

Started by
4 comments, last by Krohm 8 years, 7 months ago

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!

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....)

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?

Why not use the box’s rotation as a direction vector?

L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

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!

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.

Previously "Krohm"

This topic is closed to new replies.

Advertisement