OpenGEX as .Nif alternative for OpenMW

General discussion regarding the OpenMW project.
For technical support, please use the Support subforum.
User avatar
wareya
Posts: 338
Joined: 09 May 2015, 13:07

Re: OpenGEX as .Nif alternative for OpenMW

Post by wareya »

Wouldn't you just expect whatever animations were made in another format to contain the right kinds of nodes and tags to work with OpenMW? Or am I missing something?
unelsson
Posts: 227
Joined: 17 Mar 2018, 14:57

Re: OpenGEX as .Nif alternative for OpenMW

Post by unelsson »

Related code I assume:

OpenSceneGraph
https://github.com/openscenegraph/OpenS ... lugins/dae
- Is this included by default with OpenMW or osg, or do we need complile-option for osg to get Collada-support?

OpenMW
https://github.com/OpenMW/openmw/blob/m ... mation.hpp
https://github.com/OpenMW/openmw/blob/m ... mation.hpp

So.. Make these two talk, and it works? :? :?:
User avatar
psi29a
Posts: 5355
Joined: 29 Sep 2011, 10:13
Location: Belgium
Gitlab profile: https://gitlab.com/psi29a/
Contact:

Re: OpenGEX as .Nif alternative for OpenMW

Post by psi29a »

Yes, I've backported dae (collada) fixes to our versions of OSG and what is on PPA. I posted about it already either here or in another thread. dae models load, but spit out warnings/errors if there is unknown elements (like animations).

So ideally.. that is the starting point. :)

viewtopic.php?f=2&t=3724&start=40#p56146
unelsson
Posts: 227
Joined: 17 Mar 2018, 14:57

Re: OpenGEX as .Nif alternative for OpenMW

Post by unelsson »

For both Seymour.dae as well as Blender 2.8 exported dae-model (tree5.dae) I get similar error message in OpenMW-CS
"Failed to load 'meshes/tree5.dae': Error loading meshes/tree5.dae: code 3
, using marker_error.nif instead
Warning: The DOM was unable to create an attribute xmlns:xsi = http://www.w3.org/2001/XMLSchema-instance at line 11.
Probably a schema violation.

Error: Trying to load an invalid COLLADA version for this DOM build!
Error: Failed to load XML document from memory"

Testing getting collada-files into OpenMW.. I've had limited success before, but now I'm using collada-dom 2.5.. Which didn't install happily to OSG though, only 2.4 seems to be supported according to CMakeModules/FindCOLLADA.cmake. I got it installed by adding manually the filenames and directories to libraries to FindCOLLADA.cmake.

I'm not too familiar with the version mistmatches though, what COLLADA versio is this plugin expecting, and why doesn't Blender 2.8 exported dae open at all.
User avatar
psi29a
Posts: 5355
Joined: 29 Sep 2011, 10:13
Location: Belgium
Gitlab profile: https://gitlab.com/psi29a/
Contact:

Re: OpenGEX as .Nif alternative for OpenMW

Post by psi29a »

Did you check out OSG 3.6.5 from the PPA? That has collada support already built in. It is also what I used for my testing and development.
unelsson
Posts: 227
Joined: 17 Mar 2018, 14:57

Re: OpenGEX as .Nif alternative for OpenMW

Post by unelsson »

That was OpenMW ppa, gitlab branch "3.4" + collada-dom 2.5. Will try with OpenMW ppa, gitlab branch "3.6".

edit: gitlab branch, not ppa
unelsson
Posts: 227
Joined: 17 Mar 2018, 14:57

Re: OpenGEX as .Nif alternative for OpenMW

Post by unelsson »

With OpenMW-OSG gitlab branch 3.6 + collada dom 2.5 got the following error messages in OpenMW-CS:
"Only images with a "file" scheme URI are supported in this version." and when I bypassed that I got "Error reading file textures/branchtexture_1.dds: file not found". However, osgviewer was successful in opening and displaying the collada file properly. When debugging, I found that loading collada file through istreamstr method always fails, while std::string tends to do better. Still, regardless of technique I was at most able to get an object without material/texture to load. In most cases I got a corrupted mess of black polygons.

I will test collada-dom 2.4 next. Good stuff was that I found out a decent way to export static objects to collada format. Godot's better exporter with few fixes does the job. However, it won't work straight out of the box with Blender 2.82.

edit: It turns out that collada-dom 2.4 doesn't compile, but gives an error: "collada-dom-2.4.0/dom/src/dae/daeMetaGroup.cpp:29:10: error: cannot convert ‘bool’ to ‘daeElement*’ in return
29 | return false;"

...I'm not going to troubleshoot what's wrong with deprecated collada-dom.
unelsson
Posts: 227
Joined: 17 Mar 2018, 14:57

Re: OpenGEX as .Nif alternative for OpenMW

Post by unelsson »

when modding the image paths in the collada files to be file-URI paths (file:///home/...blahblahblaah/texture.dds) the textures are found, but I get an error message: "ShaderVisitor encountered unknown texture 0x55f219b2b620"
unelsson
Posts: 227
Joined: 17 Mar 2018, 14:57

Re: OpenGEX as .Nif alternative for OpenMW

Post by unelsson »

Another info dump:

I was able to get a white model without texture into openmw, but openmw-cs still renders just corrupted black triangles. It troubles me that osgviewer displays the models perfectly, therefore there is something in OpenMW that makes .dae models incompatible.

I've also checked how the models are loaded (components/scenemanager.cpp) and traced the texture loading code fairly deep into OSG structure. The methods used by osgviewer are almost the same that those in OpenMW, and I've tried to exactly copy the working structure piece by piece to find the source of the bug. So far no luck with that.
unelsson
Posts: 227
Joined: 17 Mar 2018, 14:57

Re: OpenGEX as .Nif alternative for OpenMW

Post by unelsson »

Okay. Found the bug: ShaderVisitor wasn't recognizing the diffuse texture as diffuseMap.
This if sentence in particular https://github.com/OpenMW/openmw/blob/e ... r.cpp#L112 , is not compatible with dae, or perhaps dae models weren't compatible with OpenMW. Naming these textures as diffuseMap or whatever is important whoever wants to mod in collada.

Phew! That was a tough hunt.
Post Reply