Exporting custom mesh from Maya in Vray - c++

In a Maya plugin written in C++, I need to be able to render some custom-meshes using Vray. Vray comes with a library called GeomStaticMesh to easily pass and render these meshes.
While I could successfully render them (code a bit too long to paste here), they are not displayed in the exported .vrscene file, preventing distributed rendering. Would someone have a basic example of a maya/Vray plugin that allows rendering some meshes ?

Related

Make a model in Blender and load in opengl

I want to make a 3D model in Blender and load it in OpenGL. Can someone give a step-by-step approach on how to do so. I tried to google but did not get any proper results.
Programming language: C++,
Tools: GLFW + GLAD + GLM
Its a 3 step process, using external libraries.
Model in blender. Export from Blender to .obj format (also containing .mtl file with reference to textures used).
Refer to
https://blender.stackexchange.com/questions/121/how-do-i-export-a-model-to-obj-format
Use a library like Assimp to produce vertices and attributes.
Use the vertices and attributes in your OpenGL application, using a method like described in,
https://nickthecoder.wordpress.com/2013/01/20/mesh-loading-with-assimp/

How to interface with Autodesk Maya 2014 built in renderer?

I am building a autodesk maya 2014 ray tracing plugin with the maya c++ API. my plugin runs in maya but the output image is directly written to the hardisk, it's very clumsy.
I am trying to find a way to interface with maya built in renderer and thus seeing the output image in maya view port and getting the option to save the image within the maya interface.
I want the option to render my scene within maya using my ray tracing algorithm and watch the output image in maya (not writing the image externally to the disk).
There is almost no tutorials for writing maya plugins and how to use the maya API I could find by googling.
I will try to focus my question and add some more question regarding the implementation itself:
can you direct me to a tutorial for how to code an extension (like mental ray) in c++ using the maya API that will work within maya and will render and show the output of my custom ray tracing algorithm in maya view port?
and for the implementation itself: i am a little confused with all the coordinate systems used by maya and openGL. lets assume i found a perspective camera and its dag path using an iterator in the plugin itself, and i have all the scene objects vertices (again iterator within the plugin). how do i convert those vertices from model\camera\object spaces to screen space?
the same question as the second question but now instead of getting the vertices in screen space as before i want a way to print them in a maya view port?

C++ library/file format for exporting 3D skeletal animations?

I'm writing an application for creating 3D skeletal animations. I'm currently using Blender for modeling/rigging, export, then load and render the model with OGRE. But I'm stuck when it comes to exporting.
I'd like to be able to export the finished animated model/scene to some known file format, so that it can be imported back into Blender for rendering. So what's the best way to get the animated skeleton/armature back into Blender?
I think COLLADA is the way to go when it comes to file formats. I'm unsure about the library. FCOLLADA is dead, I'm not sure how up-to-date it is. The latest version of Assimp had COLLADA export functionality added to it, but unfortunately not for animation yet. There's OpenCOLLADA, which doesn't seem to be well documented, but there's two plug-ins which are probably better examples than any tutorial. Lastly there's COLLADA DOM.
Have you heard about FBX? It is widely used as an exchange format for geometry and animation. It support bones/joints which should fit for your skeletal animation.
Wikipedia: http://en.wikipedia.org/wiki/FBX
Autodesk Page: http://usa.autodesk.com/fbx/

Rendering Wavefront OBJ and associated material MTL using OpenGL

I have these files: sample.obj, sample.mtl and a folder sample containing image jpg. Can somebody give me an example code of opengl texture mapping using above input.
Your problem is not just texture mapping. What you are asking for is loading an Wavefront OBJ model and its material library, then passing this data to OpenGL rendering commands. Depending on how many preexisting code you want (not) to use this takes different amounts of code. However there's no such thing like a simple OpenGL function that does it all in a black box.
Although this is a FAQ and Google brings you some results I didn't find a tutorial that really explains what's going on.
If you want it to be really simple, use a Wavefront loader and render library:
http://www.evl.uic.edu/pape/sw/libwave.html

Importing 3D objects and its animation to iphone openGL

I am trying to develop a 3D game in openGL and i need to create many 3D objects.. I am a begginner in openGL.. I have tried with many 3D softwares like Blender , MODO, Unity 3D and Cheetah.
I am easily able to create my objects with these and exporting as Wavefront .OBJ, and converting it to a header file using a perl script. This header file is added to my openGL project..
The 3D objects are seen, but its not perfect. The script i used is to convert the .OBJ to .h using TRIANGLES.. And the object is seen with triangles. Its not full.. No way when i used TRIANGLE STRIP,FAN..? Problems with the vertices..
Is the problem with my Script or is it the wrong way i have gone..?? Or is there any other best ways to directly import 3D objects to openGL..??
The below link is the best one which you can get for 3D objects to openGL.. i got the scripts from these..
http://www.heikobehrens.net/2009/08/27/obj2opengl/
please help..
You don't want to go that way. Direct drawing mode (using TRIANGLE and friends) is extremely slow in OpenGL.
Instead, you should pick a decent format and write a loader for it (or use one found on the web). Good formats would be 3ds, obj if gzipped, collada.
Here's an example tutorial on loading from Milkshape files.
Once you load your objects programatically, you can use Vertex Arrays, or even better VBO's to display them. This is waaay faster.
Google for a mesh loader for your favorite format, or write one yourself.
I have written a reader/renderer for AC3D files that works fine on the iPhone (OpenGL ES)
Feel free to have a look at it here.
There is also an obj loader by Jeff Lamarche at google code.
AC3D can reduce the triangle count pretty good and as an alternative I ported QVis to the mac. My reader/renderer also tries to build tri-strips.
About VBO's. I have not seen any gained performance when using them in the iPhone. I'm not the only one.