Assimp/DirectX depth problem when load 3d model - c++

I'm trying to upload a 3d model using assimp. There is some strange thing going on with the depth. When I use the left-handed projection/view matrix the model looks like this. (The floor and parts of the roof of houses disappear).
When I use right-handed projection/view matrix, the model looks like this. (The wall disappears).
I checked that the depth buffer is enabled, but for some reason, such a strange thing happens anyway. Does anyone have any idea what the problem might be? By the way, I tested this model by using assim and opengl and in opengl the model looks good.
I tested the model using the code from their github without changing anything:
SimpleTexturedDirectx11

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

Tracking camera movement and object orientation in xtk

This is a followup to Matt's previous question about camera orientation. I'm working with him on a javascript interface for a python analysis code for 3D hydro simulations.
We've successfully used xtk to build a 3D model of the mesh structure in our simulation. The resulting demo looks a lot like the simple cube demo on the xtk website so your advice based on that demo should be readily portable to our use case.
We were able to infer the view matrix at runtime from the XTK camera object. After a lot of poking and some trial and error, we figured out that the view matrix is really (in openGL nomenclature) the model-view matrix - it combines the camera's view and translation with the orientation and translation of the model the camera is looking at.
We are trying to infer the orientation of the camera relative to the (from our point of view) fixed model as we click, drag, and zoom with respect to the model. In the end, we'd like to save a set of keyframes from which we can generate a camera path that will eventually be exported to python to make a 3D volume rendering movie of the simulation data. We've tried a bunch of things but have been unable to invert the model-view matrix to infer the camera's orientation with respect to the model.
Do you have any insight into how this might be done? Is our inference about the view matrix correct or is it actually tracking something different from what I described above?
From our point of view it would be really great if xtk kept track of the camera's up, look, and position vectors with respect to the model so that we could just query for and use the values directly.
Thanks very much for your help with this and for making your visualization toolkit freely available.
This page might be useful as long as I'm understanding your needs http://3dgep.com/?p=1700 . It gives a very well understanding of the View Matrix which i needed myself and about half-way down the page might be a bit of info you could use http://3dgep.com/?p=1700#Converting_between_Camera_Transformation_and_View_Matrix .

Half normals are wrong

I'm using a program called sculptris to create models in Wavefront OBJ format. I just created my first couple models and am now trying to import them into an OpenGL scene. I've never written an object loader before tonight but I'm pretty sure I got the parsing of the OBJ file right. Unfortunately, when I add lighting, it seems that the normals on half of the model are incorrect. Without lighting, the model is textured and colored correctly and looks perfect. With lighting the image looks like this...
If half the model is correct, I'm pretty sure there is nothing wrong with my OBJ parsing. Therefore sculptris must only have the normals correct for half the model (probably something resulting from the symmetry of the sculpting). If anyone's familiar with the program, know what I'm doing wrong. For those that are just familiar with OBJ in general, is there something I don't know about OBJ involving duplicate normals (which there are because the model is left-right symmetrical)?
This model is symmetrical. So there's a fairly good chance that you created it by creating half of it and then mirroring it. In many modelling applications, mirroring inverts the normal and changes the winding order. So you will have to select those faces and flip their normals.

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.

OpenGL animation

If I have a human body 3d model, that I want to animate walking, what is the best way to achieve this? Here are the possible ways I see this being implemented:
Create several models with the legs in different positions and then interpolate between these models.
Load the model into openGL, and somehow figure which vertices correspond to the legs and perform the appropriate transformations.
Implement a skeleton or armature (similar to this: blender animation wiki).
Technique that you described in the first option is called morph target animation and often used for some detailes of animation like facial animation or maybe opening and closing of hands.
Second option is procedural or physical animation which works something like robotics where you give the body of your character some velocity to move forward and calculate what legs need to do for it to avoid falling. But you wouldn't do it directly on vertices, but on skeleton. See next one.
Third option is skeletal animation which animates skeleton and the vertices follow it by the set of rules. Attaching vertices to skeleton is called skinning.
I suggest that, after getting hang of opengl stuff (viewing and positioning models in space, camera, etc), you start with skeletal animation.
You will need a rigged and animated model for your 3d app of choice. Then you can write an exporter to your custom format or choose a format that you want to read from your app. That file format should contain description of the model, skeleton, skinning and key frames. Than you read and use that data from your code to build the mesh, skeleton and animate over key frames.
If I were you, I'd download Blender from http://www.blender.org and work through some animation tutorials. For example, this one:
http://wiki.blender.org/index.php/Doc:Tutorials/Animation/BSoD/Character_Animation
Having done that, you can then export your model and animations using e.g. the Ogre exporter. I think this is the latest version, but check to make sure:
http://www.ogre3d.org/tikiwiki/Blender+Exporter&structure=Tools
From there, you just need to write the C++ code to load everything in, interpolate between keyframes, etc. I have code I can show you for this if you're interested.