I've started to get familiar with Assimp. My tasks with this library is quite simple, just to load a 3D model, visualize it and sparse neccessary information from it e.g. facets, facet normals... probably some manipulatinos with camera
I've successfully loaded several models at link
the example given here can load obj and ascii stl models. However, the same task cannot be done with STL binary model which generates an error like: "ASCII file is empty or invalid; no data loaded - could not load model"
two other references confirm me that my error is not the first one:
link1
link2
the 2nd link recommends to use ivcon as a solution. however the post was quite 3 years ago
How about the current solution? can I fix it directly with some import command settings?
my bad! I was so closed to the answer which is already there in link2 but I didn't even try it.
So, just now, I simply changed the STL file's header "solid" to any other group of characters such as "abcde" and the import works normally
Related
I'm about to start a project that requires me to load specific information from an IFC file into classes or structs. I'm using C++, but it's been some years since I last used it so I'm a bit rusty.
The IFC file has a linked structure, where an element in a line might refer to a different line, which in turn links to another. I've included a short example where the initial "#xxx" is the line index and any other "#xxx" in the line is a link to a different line.
#170=IFCAXIS2PLACEMENT3D(#168,$,$);
#171=IFCLOCALPLACEMENT(#32,#170);
#172=IFCBUILDINGSTOREY("GlobalId", #41, "Name", "Description", "ObjectType", #171"...);
In this example I would need to search for "IFCBULDINGSTOREY", and then follow the links backwards through the file, jumping around storing the important bits of information I need.
The main problem is that my test file has 273480 lines (18MB), and links can jump from one end of the file to the other - and I'll likely have to handle larger files than this.
In this file I need to populate about 500 objects, so that's a lot of jumping around the file to grap the relevant information.
What's a performance-friendly method of jumping around a file like that?
(Disclosure - I help out with a .NET IFC implementation)
I'd question what it is you're doing that means you can't use one of the many existing implementations of the IFC schema. Parsing the IFC models is generally the simple part of the problem. If you want to visualise the geometry or take measurements from the geometry primitives there's a whole another level of complexity... E.g. Just one particular geometry type out of dozens: https://standards.buildingsmart.org/IFC/DEV/IFC4_3/RC2/HTML/link/ifcadvancedbrep.htm
If you go to BuildingSmart's software implementations list and search for 'development' you'll get a good list of them for various technologies/languages.
If you're sure you want to implement yourself, the typical approaches are to build some kind of dictionary/map holding the entities based on their key. Naively you can run an initial pass through with a Lexer, and build the map in memory. But as IFC models can be over a GB, you may need a more sophisticated approach where you build some kind of persisted index - and maybe even put it into some kind of database with indexes (maybe some flavour of a document database). This is going to be more important if you want to support 'random access' to the data over multiple sessions.
I am afraid I am posting my problem in the wrong place, if so then please excuse me for that and would appreciate it if you can suggest another forum for my question apart from Unreal forum as I haven't received anything for almost a month.
I am trying to import a model from 3d Max to Unreal engine so I can use it later on with AirSim.
firstly, I have converted my 3d Max model using Datasmith, a plugin to import 3d max model into Unreal, according to this video here, and everything went ok.
secondly, this tutorial here is from AirSim official staff that shows how to download a free model from Unreal Library and merges it into a blank C++ project in Unreal so that it would be ready to suit AirSim. The free to download sample environment was ''LandscapeMountains''.
the problem is, video 1 doesn't show how to save the imported model that matches the ''LandscapeMountains'' project format so I can follow video 2 from that point onward to use it in AirSim. To clarify:
project folder of ''LandscapeMountains'' contains many essential elements such as the DerivedDataCache, config, and Content.
the imported model firstly doesn't have DerivedDataCache folder.
In addition, the Imported model Config files are by no means close to ''LandscapeMountains'' config files. Moreover, the Imported model contents folder contains Developers, Collections, and exported_model folders plus a .umap file of the exported model. whereas ''LandscapeMountains'' content folder has only two folders: Maps and Assets folders. all these details are shown in images1,2,3 and 4.
image1 image2 image3 image4
apparently, I don't know how the ''LandscapeMountains'' has been saved to look like this format and my question now is what is the type of this format and how can I save my imported model to be like that.
I think that its a basic thing but I don't have the knowledge to find out how and I hope someone can help to overcome this issue.
regards
PS, I have posted the same issue to Unreal forums and no luck with a reply
Blender Version 2.79
OSG Version: 3.4.0-9
Operating System: Fedora
I have been using Blender's export utility to export obj files and then using osgconv to convert them to osg files. The files are then imported and rendered into a scene that looks like:
Image of the working scene before using the export tool
Today I installed osgexport by Cedric Pinson ( Github page: https://github.com/cedricpinson/osgexport ) to directly export from Blender to osgt files. I get the following results when I import those files and render them.
Image of the scene where everything goes dark and the lighting is wierd
Additional Details:
The code is set to follow the human character. The rest of the scene
is static.
When I use the old human model I get the working effect,
but the whole purpose of using the converter is to be able to export
its animations.
Any ideas? I saw the effect and I don't really even know where to start. The only difference is the outputted file from the converter. Everything else is the same. Also, if there is a newer/better way to export blender files into files that OSG can read, then I'm open to any and all suggestions.
Thank you in advance,
For what it's worth, the OSG forum/mailing list is usually pretty good about answering questions, and I believe I've seen Cedric's name there regularly, along with all the main contributors: http://forum.openscenegraph.org/
New users usually have to have their questions go through moderation, to cut down on spam, so just have some patience.
On this specific question, I have 3 suggestions:
Convert both files to osgt and run a diff. Ignore any numerical differences, look for things like node arrangement, material types, etc.
Try opening your exported model in osgviewer, just to see how the default settings display it. You can also easily play with things like backfaces, lighting settings, clipping planes, before dropping it into your application - press h to see all the run-time options.
Instantiate your light with all 3 types of lighting enabled. Particularly, I have found some models depend heavily on specular lighting, but some of the examples don't turn it on. Of course, if you use the full-white values shown here, you may oversaturate, but this is for an example:
osg::Light *light = new osg::Light;
light->setAmbient(osg::Vec4(1.0,1.0,1.0,1.0));
light->setDiffuse(osg::Vec4(1.0,1.0,1.0,1.0));
light->setSpecular(osg::Vec4(1.0,1.0,1.0,1.0)); // some examples don't have this one
I'm working on a game for open GL, and I want to simply be able to load OBJ files, with their textures into my game. I want the loader to contain all the necessary code to map the textures to the object.
(Note I have scoured google, and not one example I've seen has been simple enough to bolt onto my currently existing code, I'm talking 2 headers, and 2 cpps maximum)
Could anybody provide me with one?
you could get started by this simple loader which loads objects in a wavefront .obj file into a OpenGL scene. This code restricts to just scanning the vertex information out of OBJ. You could enhance it further may be after getting the basic idea.
http://netization.blogspot.in/2014/10/loading-obj-files-in-opengl.html
https://github.com/nanosmooth/opengl_objloader
You can find mine at: https://github.com/NewbiZ/sandbox/tree/master/mar_tp1
It's a pretty simple one, but clean.
you will only need the Model class, which will load an OBJ file by filename: https://github.com/NewbiZ/sandbox/blob/master/mar_tp1/inc/mar_tp1/model.h
You may need to remove some things to make it fit on your project. Namely the dependency to ResourceManager which loads the textures and return their id, but that should not be much work.
Hope it helps.
What I have in mind is that user will select the part of world he/she wants to generate roads and retrieve openStreetMap data and use it to render roads in openGL.
On searching the web and experimenting, I thought of this approach:
get xml file of selected map
parse the xml and generate roads by openGL.
But I think this is very naive approach.
Also to experiment a bit I used OSM2WorldViewer to convert the xml file to obj file and imported that as a model in openGL, but this method is cumbersome and takes time
and I am unfamiliar with OpenStreetMap api and how it can be used in such a project.
Any suggestions, or helpful links how to start this project ?
EDIT: How it ended: Link to the project wiki
Why do you think your approach is naive? Either you have the user to provide a self-downloaded XML file or you have to use an API to retrieve one yourself. The latter approach allows you to implement an automatic update mechanism whenever the user pans the map.
Instead of the main API you can use the Overpass API for downloading data. It's faster and more flexible to use, allowing to specify which element types to download (e.g. only roads and buildings) and much more.
You already mentioned OSM2World, take a look at its freely available code to see an example implementation of a 3D OpenGL renderer. Or take a look at one of the other 3D renderers for OSM.