1

I am trying to command-line rendering an PNG file from obj+mtl file instead of using blender.

Currently, I'm using blender to load the obj+mtl file, and then use the render feature of Blender. But, that requires GUI to do so.

I need to render a batch of PNG files with different textures on the same obj on a server.

How should I do that?

Thank you very much!

Jackie
  • 307
  • 2
  • 14
  • what is the problem? you do not know how to create a text file? or you do not know the obj+mtl syntax? in the latter just download any simple textured obj and open in a notepad or whatever text editor and see ... wiki has also fine pages about the wavefront and mtl too ... – Spektre May 02 '19 at 09:00
  • Hi @Spektre, the problem is I want to render several png files from obj+mtl by programming, not using blender. – Jackie May 02 '19 at 09:03
  • I got that from reading OP the first time, I was asking about what is preventing you from coding it yourself now? Because right now it looks like you are waiting that someone else will do it for you... When you start coding you will have specific problem that is what this site is for... So what exactly is the problem? – Spektre May 02 '19 at 09:22
  • Sorry, I'm new to CG. Could you please recommend me to some source that I can follow to do so? – Jackie May 02 '19 at 10:09
  • No as I do not code in Python (and this site is not for off site tutorial links search anyway). And what exactly does this have to do with CG? From your question I got impression you want to create Wavefront OBJ files to preview PNGs in some already existing SW so it is just a creation of 2 text files no gfx at all. If you want just preview PNG in your App instead then creating 3D mesh to do just that is not a good idea ... as in such case you would need to have OBJ parser and render + 3D engine and that is a lot of stuff to code/import/use... – Spektre May 02 '19 at 11:07
  • Yes I know python has a lot of packages but why to do 100 complicated things instead of 2 simple ones like load and preview PNG? If you really need wavefront meshes inside your app from scratch that you should edit your question so its clear ... Do not handle my comments as an offense ... answering my queries (and updating you question with valid info) will lead you to valid answers instead of close votes. Good idea is to start with what you have and what you need ... exactly where you stuck with along with code ... Do not ask all at once tend one problem at a time – Spektre May 02 '19 at 11:08
  • 1
    anyway this might help [How do I sort the texture positions based on the texture indices given in a Wavefront (.obj) file?](https://stackoverflow.com/a/51722009/2521214) to get you started its my OBJ parser (creating wavefront file is a magnitude simpler then parse it....) but its in C++ – Spektre May 02 '19 at 11:15
  • 2
    It seems you can also [issue a Blender render from the command line](https://docs.blender.org/manual/en/latest/render/workflows/command_line.html). – Nico Schertler May 03 '19 at 00:36
  • @NicoSchertler You are right. I follow [this question](https://blender.stackexchange.com/questions/1101/blender-rendering-automation-build-script) link and able to command line rendering, with the camera angle manually set in Blender UI. – Jackie May 03 '19 at 08:20
  • @Jackie So you just want to preview Wavefront meshes in your app. There are libs for that try to google `WAVEFRONT OBJ FILE LOADER` for your environment. The link in my last comment is doing exactly that in C++. When mesh is loaded/decoded into memory you need to render it. I use OpenGL for that (and my loader feeds VAO/VBOs for OpenGL) but I assume if you find a loader lib it would have that functionality in it too. So just google and try... Different loaders support different things so its a trial and error ... or you just reformat your meshes to supported format. – Spektre May 05 '19 at 06:49
  • Thanks @Spektre! What I want was command-line rendering. – Jackie May 06 '19 at 02:22

0 Answers0