3ds collada UV mapping problem in Papervision - papervision3d

As I briefly explained in the title, my problem concerns texturing a collada export in papervision.
Basically I was exporting collada models from Cinema 4d with its uv map. I was able to see everything, but the texture was not displaying properly (hidden polygons).
So I decided to try with 3dsMax. I used the same code to display the texture :
var materials:MaterialsList = new MaterialsList();
var torusMaterial:BitmapFileMaterial = new BitmapFileMaterial("model/tex.png");
torusMaterial.precise = true;
materials.addMaterial(torusMaterial, "ID1");
Again, I can see every elements, but this time my model uses only one pixel of my texture. So if I use a red texture and if I color only the pixel at the left bottom corner in green, all my model will be green.
Any advice about how to properly wrap the texture around a 3ds export model?
Thank you.

The Autodesk Collada exporter that ships with 3ds max is problematic, and gives .dae output that Papervision doesn't expect. This will be an even worse problem when you get to exporting animation. Try the OpenCollada exporter: http://www.opencollada.org/download.html
Many people have had a lot more luck using it with Papervision3D. Unfortunately it's not yet available for 3ds max 2012 so if you might be stuck if you can't find an older version. Or maybe you can get the source and compile it against 2012? Let the project maintainers know if you do.

Related

irrlicht model loading/animating

I've been trying (for hours now) to get a b3d model loaded, shown and animated properly.
The model has an animation between frames 0 and 45, it was made and painted (the whole kit) in blender as testing model. Only half of the model is shown, it's completely white and it doesn't move.
I've been googling on information on loading b3d into irrlicht and it's animation system, but trying to load texture from the b3d file failed and all other information I incorporated into the program.
Here is the link to the picture of the actual result.
Here is the link to the code (shortened with comments on the insignificant parts).
Did you correctly define 'node'? If not, try this:
IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode (smgr->getMesh ("mesh.b3d"));
If you added the node as an IMeshSceneNode the animations will not show. As for the texturing, I believe with irrlicht you must set all textures manually. Try this in the 'if (node)' block:
node->setMaterialTexture (0, driver->getTexture ("texture.bmp"));
Some painting tools doesn't appear on the model when exported via Blender.
You may've used some, try looking up any possible issues with the tools you used on the net.
Also you sure that you light the model ?
That may cause problems too.
I'm in a bit hurry atm couldn't check the code, I may look deeply later.
Hope it solves

3D model manipulation for a Desktop Augmented Reality application

I'm working on an Augmented Reality project that uses multiple markers to get positions for 3D models that I'm planning to overlay. (I'm doing this from scratch using OpenCV and I'm not using ARToolkit or any other off the shelf marker detection libraries).
Environment: Visual C++ 2008, Windows 7, Core2Duo 1GB ram, OpenCV 2.3
I want the 3D models to be manipulated by user so it will turn out to a sort of simulation.
For this I'm planning to use OpenGL. What are your suggestions, recommendations? Can the simulation part be done by using OpenGL itself or will i need to use something like OpenSceneGraph/ODE/Unity 3D/Ogre 3D?
This is for an academic project so better if I can produce more self-coded system rather than using off-the-shelf products.
it would seem that OpenGL is pretty enough for your needs (drawing a model with a specific colour and size).
If you're new to OpenGL, and you are not going to be using it for your future projects, it might be easier to use the old fixed-function pipeline, which already has the lighting and color system ready and doesn't require you to learn how to write shaders.
For your project, you will need a texture where you would copy the image from camera using glTexSubImage2D() which you would in turn draw to background (or you can use glDrawPixels() in case you don't require any scaling). After that, you need to have your model, complete with normals for lighting. Models can be eg. exported from Blender or 3DS Max to ascii format, which is pretty easy to parse. Then you can draw the model. Colors can be changed using glColor3f() before drawing the model (make sure you don't specify different color while drawing the model). Positioning of the models is done using matrices. The old OpenGL have some handy and easy-to-use functions for rotating and translating objects. There are also functions for scaling the objects (changing size), so that is covered pretty easy. All you need is to figure out camera position, relative to the marker (which i believe is implemented in OpenCV).
If you were to use the forward-compatible OpenGL, you would need to set up vertex buffer objects to contain model data and write vertex and fragment shaders to shade and display your model. That's kinda more work for which you get extended flexibility. But you can use shaders in the old OpenGL as well, if you decide you need them (eg. for some special effects).
Learning how to use a scenegraph or an engine (ogre) can take some time, i would not recommend it for your task.

Idea about how to model a building using OpenGL/GLUT?

I'm new to graphics, and I have to make a model of a building for an assignment using only GLUT or OpenGL.
Basically the school building's model( only the exterior portion) is to be made, and I have no clue where to start. Upto now I have drawn polygons, other shapes using GLUT, nothing in which there are multiple shapes. All the drawing upto now is using lines, or points, or polygons and mathematics.
Could you please give me an idea of how to go about it?
Update: I just want to know what steps I can follow to get it done. Some reference links would be awesome!
You could use modeling programs to create your model, and then use tools such as COLLADA to get your model into OpenGL.
The problem with hand-coding a complex object like that is that it takes a great number of lines of code just to define the vertices of the object.
People usually use 3D modeler software to build complex 3D objects, like Maya, 3DSMax or Blender and then export them in a format to be read into your OpenGL application.
Think about what you want your building to look like, and think about what kind of triangles you need to render in order to make that. You can either draw the entire thing in some sort of modelling software, and then import it into OpenGL, or you can come up with the triangles/textures yourself and do it by hand in OpenGL.
The exterior of the building will probably have a similar texture on the whole thing (brick, etc), and then there will be windows, doors, and a roof. Maybe some sort of sign that says "School Building". Take this all into account, what exactly you want your building to look like, and then think about what textures you will need to draw these things.
For example, say you're doing a brick building that is in the shape of a box, with a door and a few windows. I'd use one texture for the brick, and first draw an entire wall of brick. Then, I'd use a grey/blue looking texture for the window, and draw it over the brick wall. Then I'd do the same (different texture) for the door.
Just think about the design, and then just try things out - experiment. Good luck!
I once had a simillar homework. I did it by creating the models with Google SketchUp, then export the models to .3ds file and use my program to render it.
I choose Google SketchUp because it's the easiest to use among those tool I tried. Plus, they had a discount for students. You could also use Blender, which is free but take too much time to learn IMHO. 3dsMax is too expensive to pay for a homework.
To load the model into my program, I used Assimp library.

how to draw pool table pockets opengl c++

hey
i am creating a pool table simulator in opengl written in c++
i have the basic table drawn but now i need to add some pockets
i want the pockets to be a basic curve like a C shape
im not quite sure how to do this
i have experimented with trianglefan but iv had no luck
can anyone help please?
also i must add this is part of a university project therefore i will only be using the core opengl and c++....no other tools
thanks in advance
When I use OpenGL, I usually build the models in something like Blender.
Blender is free and allows export to WaveFront obj - an easy format to read in to your program. Or you can use the simple text WaveFront obj with a little scripted editing will produce a list of vertices that you can use in arrays for vertex buffer objects.
I couldn't imagine trying to build objects for a 3D scene using only discrete values and discrete math like (I think?) you're describing.
Do you have access to glu.lib?
http://en.wikipedia.org/wiki/OpenGL_Utility_Library
http://www.opengl.org/resources/faq/technical/glu.htm
That would easily make cylinders or NURBS curves for the pockets. Sample use of it is here: http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=18
There is also lots of code from the "Graphics Gems" series available - you can dig through the early books for something suitable if GLU isn't an option.
http://www.graphicsgems.org/
Start with a cube and slice off the bottom corners. Refine as necessary.

3ds max object to opengl

I am trying to assemble a scene in opengl, using already made objects. The problem is that the object are in .max format and have no external textures. How could I import my objects in opengl, without retexturing them. I am thinking about exporting them to 3ds and using a 3ds file loader. Could you recommend one, and of course it has to work only with the 3ds file itself, no external texture files.
3ds max already allows me to export the file to obj. I have an object that has no external texture file, but it is already fully colored as a 3ds file. Is there any way to import in opengl and have the same colors, for the trunk, leaves?
You might want to check out lib3ds which will parse the 3ds binary format for you and give you access to all of the objects properties. I think Autodesk also has their own toolkit for doing this.
You should look at this link. It is a 3DS viewer with source code that renders using OpenGL. The code is simple.
Another option could be Assimp, an open source asset import library for C or C++, which seems like a pretty good way to get 3DS assets into an opengl program. It'd be especially useful if you want it for skeletal animations, and supports embedded textures. Though at this point, this answer may be less for you than it is for other people coming across this question.
If I remember correctly, the 3ds file does not store the vertex normals so you will probably have to calculate them yourself somehow or otherwise it will use the normal of the face itself which is will be quite ugly.