User talk:Neo: Difference between revisions

From OniGalore
Jump to navigation Jump to search
(long answer)
No edit summary
Line 262: Line 262:
:Also note, for future troubleshooting, that the .dae format is more appropriate for sharing, since it's the actual source file Onisplit works with.
:Also note, for future troubleshooting, that the .dae format is more appropriate for sharing, since it's the actual source file Onisplit works with.
::[[User:Geyser|geyser]] 19:57, 28 April 2008 (CEST)
::[[User:Geyser|geyser]] 19:57, 28 April 2008 (CEST)
geyser: Thanks for explaining about the cel-shading.  Regarding the Major, as you pointed out the "Major just can't be a serious ingredient", so I gave up on trying to import a model of her. Rather, this outfit is more of my tribute to GITS, than anything else.
For this model, I used a program called Cheetah3D. I first exported the ONCC for k3 and k4_K, then converted the .dae file to .fbx using the FBX Converter, then swapped the pelvis, from k3 to k4_K, exported as .fbx, then converted to .dae.  Since Blender ignores the vertex normals as Neo states, I wanted to see if I could use Cheetah3D instead.
EdT

Revision as of 00:22, 29 April 2008

OK, let's give it a try: OniSplit 0.9.0

What's new:

a couple of fixes to the collada exporter
-create:trbs option to create a TRBS file from a collada file

How to use:

  onisplit -extract:dae some_dir level0_Final/ONCCkonoko_generic.oni
  

This will generate a ONCCkonoko_generic.dae collada file in the directory some_dir plus the tga texture files used by the specified character.

  onisplit -create:trbs dest_dir some_dir\ONCCkonoko_generic.dae

This will create a TRBSkonoko_generic.oni file in dest_dir

Notes:

  • Blender's Collada importer/exporter is buggy and you need to add the options -noanim and -zup when extracting collada files for use with Blender:
  onisplit -extract:dae some_dir -noanim -zup level0_Final/ONCCkonoko_generic.oni
-noanim prevents the export of the default idle animation. That's needed because Blender doesn't import animated objects correctly.
-zup exports a collada file with a coordinate system where Z axis points up instead of the default (Y up). This is needed because Blender uses Z up but the importer gets it wrong and convert to something else.
  • In the absence of the animation all bones are oriented along the X axis (no rotation applied to them) so the character will look kind of weird. You can rotate them any way you need/like, it won't affect the creation of TRBS files because only translations matter.
  • When exporting Collada files from Blender you need to select the "Triangles" option because OniSplit does not import polygons.
  • You can replace body parts by deleting existing ones and adding new ones but you need to set the parent bone and the name of the part correctly. In Blender you can see the bone hierarchy and names in the Outliner window.
  • Currently textures are exported to collada but they are ignored when importing. I'll add later an option to create TRMA files from some sort of input text file that specifies the images to be used.
  • If you are using XSI Mod Tool (that's what I use) you don't need/should specify the -zup option. While the collada file will load correctly in mod tool you won't be able to rotate the bones.
  • Everything else that I forgot to mention :)
  • I think I should cleanup this page a bit...

Neo

I knew that I forgot some "notes"...

  • Blender's Collada importer is buggy chapter 2: it ignores the vertex normals so the model will look flat instead of smooth. Unfortunately this persists when exporting so the TRBS file will be flat too. I've no workaround for this. Maybe I'll try to fix that importer myself because the whole project appears to be somewhat dead.
  • TRBS files (can) contain different geometry for 5 different levels of detail. Currently OniSplit does not have any support for this. When exporting the highest LOD will be exported and when importing the same geometry will be used for all 5 levels. It's likely that in the future I'll add the possibility to export/import each level separatly.

Neo

This is great, I'll have time tomorrow to give it a try.

Though I already have some questions. I want to make sure I understand the process:

Let's say I import Owldreamer's Masterchief (Currently it doesn't have any texture maps, but at least I want to see if it can be imported to Oni) into Blender, then export it out as a Collada file. Then can I create a TRBS file from it? Will OniSplit also create the M3GM files that make up the object and link them to the TRBS file? Next, I will need to make an ONCC file for it, perhaps copy an existing one and change the TRBS link to the new one that was created, is that correct?

I suppose you can move the OniSplit discussions to the talk page for Onisplit.

Thanks,

EdT

OK, most of what I said above relates to modifying Collada files exported with OniSplit.

If you want to create something from scratch (or use an existing model but that has not been exported from Oni) you need a couple of things:

  • You need to have 19 pieces of geometry that fit the body parts used by Oni: pelvis, mid, chest etc.
  • Those pieces of geometry need to be parented correctly, load a Collada file exported from Oni and see the Outliner window.
  • Geometries (or more correctly the scene nodes that cotain the geometries) need to be named correctly: pelvis, mid etc. Again, see the Outliner window with an existing Oni model loaded.
  • "Advanced" models that use skeletons/skinning won't work. Oni does not support such things.

You should also check the TRIA page for more stuff about character models in Oni.

As for what OniSplit creates: it creates all the needed M3GM, TRCM, TRIA and TRTA. TRBS files are self contained, you don't need anything else.

And yes, the simplest way to create an ONCC file for a new TRBS is to copy and modify an existing ONCC file. Since TRBS files are linked to by name you'll need to use a hex editor to modify the TRBS name that's inside the ONCC file (somewhere at the end, you can find it by looking for "TRBS"). The only problem you may encounter is that you need to pick an ONCC file that's linked to a TRBS which has a name that's equal or longer than the new TRBS name otherwise you won't have space in the file for the new name.

Neo

I was able to extract the TRBS from Oni using the command: mono onisplit.exe -extract:dae TRBS -noanim -zup ../GameDataFolder/level0_Final/ONCCkonoko_generic.oni

However, when I tried to import it into Blender2.45 I got the following error Message: FEEDBACK: Illusoft Collada 1.4 Plugin v0.3.159 started Traceback (most recent call last):

 File "/blender-2.45-OSX-10.3-py2.3-powerpc/blender.app/Contents/MacOS/.blender/scripts/bpymodules/colladaImEx/cstartup.py", line 609, in ButtonEvent
   transl = translator.Translator(doImport,__version__,debug,fileName, useTriangles, usePolygons, bakeMatrices, exportSelection, newScene, clearScene, lookAt, usePhysics, exportCurrentScene, exportRelativePaths, useUV, sampleAnimation, onlyMainScene)
 File "/blender-2.45-OSX-10.3-py2.3-powerpc/blender.app/Contents/MacOS/.blender/scripts/bpymodules/colladaImEx/translator.py", line 61, in __init__
   self.__Import(fileName)
 File "/blender-2.45-OSX-10.3-py2.3-powerpc/blender.app/Contents/MacOS/.blender/scripts/bpymodules/colladaImEx/translator.py", line 67, in __Import
   documentTranslator.Import(fileName)
 File "/blender-2.45-OSX-10.3-py2.3-powerpc/blender.app/Contents/MacOS/.blender/scripts/bpymodules/colladaImEx/translator.py", line 247, in Import
   self.colladaDocument.LoadDocumentFromFile(fileName)
 File "/blender-2.45-OSX-10.3-py2.3-powerpc/blender.app/Contents/MacOS/.blender/scripts/bpymodules/colladaImEx/collada.py", line 86, in LoadDocumentFromFile
   self.asset.LoadFromXml(self,xmlUtils.FindElementByTagName(colladaNode,DaeSyntax.ASSET))
 File "/blender-2.45-OSX-10.3-py2.3-powerpc/blender.app/Contents/MacOS/.blender/scripts/bpymodules/colladaImEx/collada.py", line 284, in LoadFromXml
   self.created = xmlUtils.ReadDateTime(xmlUtils.FindElementByTagName(xmlNode,DaeSyntax.CREATED))
 File "/blender-2.45-OSX-10.3-py2.3-powerpc/blender.app/Contents/MacOS/.blender/scripts/bpymodules/colladaImEx/xmlUtils.py", line 68, in ReadDateTime
   return GetDateTime(ReadContents(node))
 File "/blender-2.45-OSX-10.3-py2.3-powerpc/blender.app/Contents/MacOS/.blender/scripts/bpymodules/colladaImEx/xmlUtils.py", line 101, in GetDateTime
   return datetime(int(date[0]), int(date[1]), int(date[2]),int(time[0]), int(time[1]), int(float(time[2])))

ValueError: invalid literal for float(): 35.8247380-07

EdT

Fixed: OniSplit 0.9.1.

Neo

And another update to fix a small bug in the Collada exporter: OniSplit 0.9.2 (not really needed because most tools seem to ignore that error).

Neo

Thanks, I am able to import the TRBS file into Blender. You're right, it does look weird at first, but rotating the different body parts to their correct position made it look right. I'm a newbie to 3D, so I have lots to learn before I can accomplish anything. I think the easiest thing for me is to try to replacing different body part from existing characters. I just have to figure how to do that in Blender.

EdT

The simplest thing to do is to try to modify the existing geometry, export from Blender and create the TRBS to see if it works correctly.

Then you can try to replace the head with something simple like a cube: Head in a box :)

So

  • delete the head
  • create a cube from Menu Add, Mesh, Cube
  • move it where the head was. Notice that you only need to move it along X axis.
  • rename the cube to "head". In the "Buttons Window" there should be a Link and Materials panel and in that panel there is a textbox that starts with OB: where you can type the name.
  • now you need to set the head's parent to be the neck. Select the head and then select the neck while holding the shift key and after you select them you can press ctrl + P (or menu Object, Parent, Make Parent)

To replace the head with something more interesting you'll probably need to import another file that contains what you need. The only problem is that what you import may end up in another scene and I haven't figured out how to move an object from one scene to another. In fact I haven't figured out how to copy/paste an object...

Note: The cube won't have texture coordinates so if you try to import in Oni you'll probably end up with a black head.

Neo

Please take a look at these files:

http://edt.oni2.net/OS/MCKonoko.blend I replaced Konoko's head with MasterChief.

http://edt.oni2.net/OS/MCKonoko.dae The exported Collada file.

Error message from OniSplit when creating a TRBS file:

 System.IO.InvalidDataException: No scene found
 at Oni.Files.Geometry.BodyImporter.ReadBodyParts (Oni.Files.Dae.Scene scene) [0x00000] 
 at Oni.Files.Geometry.BodyImporter.Import (System.String filePath, System.String outputDirPath) [0x00000] 
 at Oni.Files.Program.CreateBody (System.String[] args) [0x00000] 
 at Oni.Files.Program.Main (System.String[] args) [0x00000]

Different test and error message.

I imported ONCCkonoko_generic.dae into Blender and then exported it out as Collada 1.4, with no changes. This time I got the following message from OniSplit:

 System.Xml.XmlException: 'Element' is an invalid node type. file:///Oni/ExportedGameData/MCKonoko.dae Line 1743, position 4.
 at System.Xml.XmlReader.ReadEndElement () [0x00000] 
 at Oni.Files.Dae.Reader.ReadEntity[Scene] (System.Action`1 entityReader) [0x00000] 
 at Oni.Files.Dae.Reader.ReadLibrary[Scene] (ICollection`1 library, System.String elementName, System.Action`1 entityReader) [0x00000] 
 at Oni.Files.Dae.Reader.ReadLibrary () [0x00000] 
 at Oni.Files.Dae.Reader.Read (System.String filePath) [0x00000] 
 at Oni.Files.Dae.Reader.ReadFile (System.String filePath) [0x00000] 
 at Oni.Files.Geometry.BodyImporter.Import (System.String filePath, System.String outputDirPath) [0x00000] 
 at Oni.Files.Program.CreateBody (System.String[] args) [0x00000] 
 at Oni.Files.Program.Main (System.String[] args) [0x00000] 

EdT

You need to select the "Disabled Physics" option when exporting. I also made a fix to ignore the physics stuff: OniSplit 0.9.3.

Another thing you should do is to select "Only Current Scene" when exporting to avoid having all scenes exported to the Collada file. In any case you need to make sure the "current scene" is the one you want to export. In you file it seems that the current scene was the one with the MC.

Now for the more complex problem: I said that rotation and scaling transforms are ignored and only translations are used when creating TRBS file. That's because TRBS only use translations and it has the advantage that you can rotate stuff to allow for easier editing. But that also means that if you add new geometry then the new geometry must already be scaled and oriented correctly.

For example in your file the head now has a scaling of 2.355 (select the head and press N (or select Transform Properties from the Object menu) to see the applied transform). This scaling is ignored when creating the TRBS and the result is a very small head.

I'm not very familiar with Blender but it appears that you need to do the following:

  • select pelvis
  • rotate it so all rotations are 0 (or you can simply edit them in the Transform Properties window)

(why you need this? because otherwise you'll be mislead about the real position of the head)

  • select head
  • select ObData to Center from Object, Transform menu
  • select Apply Scale/Rotation tr to ObData from Object, Clear/Apply menu

Something along these lines. I got it working once but second time when I tried it still exported a strange -90 rotation around X despite the Transform Properties window showing all rotations to be 0. Probably I did something different or the crap Collada exporter is playing tricks.

Neo

One thing I do know, is that there's no way the Collada plug-in should be v1.4. More like v0.4. Seriously. Look at the progress list and you realize how incomplete it is, not to mention the bugs. I mean, getting Blender's axes wrong? Ridiculous.
Anyway, I don't have any feedback on how TRBS importing is working until I try it some more tonight, but I just wanted to thank you for all the work you've done in documenting OBD stuff and writing OniSplit. I love 3D modeling, so anything that lets me import models into Oni is super-welcome (working on an HD Griffin at the moment, in case you aren't aware). --Iritscen 17:58, 10 April 2008 (CEST)

It's v0.3.159 actually, v1.4 is the Collada version. Kind of confusing, indeed. As for that progress list, oh well, take a look at this for example:

"Vertex normals Vertex normals t t "

where t means "ready for testing". Ready for testing my #$%, the normals are completly ignored. The worst part is that the project appears to be dead. No updates in 8 months doesn't sound well.

I guess I'll try fixing the vertex normals and maybe the animation importing problem too if I manage to cut my way in that Python script jungle.

Neo

Oh, wow, so the plug-in really is pre-1.0. Well, at least they're being truthful. And you're right that the project seems dead. The site says that the work on the plug-in is for their own game project. Well, I guess maybe the whole game project thing didn't work out, ergo, the plug-in is useless to them now. What's amazing is that no one in the Blender community seems to care enough to pick up the work themselves. --Iritscen 16:46, 11 April 2008 (CEST)

Neo, please look at the OniSplit talk page for my continued discussion on OniSplit and TRBS. Your talk page is getting too LONG! :-)

EdT


Neo, FYI, OniSplit 0.9.5 has problems with the -import:sep command on the Mac. Here's the terminal output:

 Reading files from /Oni/GameDataFolder/level1_Final
 Removing duplicates
 Writing /Oni/GameDataFolder/level1_Final.dat
 System.NotSupportedException: Stream does not support reading
 at System.IO.FileStream.Read (System.Byte[] dest, Int32 dest_offset, Int32 count) [0x00000] 
 at Oni.Files.InstanceFileWriter.ConvertTXMPHack (Oni.Files.DescriptorTableEntry entry, System.IO.Stream stream) [0x00000] 
 at Oni.Files.InstanceFileWriter.WriteDataTable (Oni.Files.FileWriter writer, Int32 levelId) [0x00000] 
 at Oni.Files.InstanceFileWriter.Write (System.String filePath) [0x00000] 
 at Oni.Files.OniImporter.Import (Oni.Files.FileManager fileManager, System.String inputDirPath, System.String filePath, Int64 targetTemplateChecksum) [0x00000] 
 at Oni.Files.Program.Import (System.String[] args) [0x00000] 
 at Oni.Files.Program.Main (System.String[] args) [0x00000]
Edt
I second that. It also happens on PC, for the demo. And not only on -import but on -export, too:
Reading file D:\geyser\edition\pc.demo\edition\GameDataFolder\level1_Final.dat
Exporting 1827 instance(s) to D:\geyser\edition\pc.demo\edition\GameDataFolder\level1_Final
System.NotSupportedException: Stream does not support reading.
  at System.IO.__Error.ReadNotSupported()
  at System.IO.FileStream.Read(Byte[] array, Int32 offset, Int32 count)
  at Oni.Files.InstanceFileWriter.ConvertTXMPHack(DescriptorTableEntry entry, Stream stream)
  at Oni.Files.InstanceFileWriter.WriteDataTable(FileWriter writer, Int32 levelId)
  at Oni.Files.InstanceFileWriter.Write(String filePath)
  at Oni.Files.OniExporter.ExportCore(List`1 descriptors)
  at Oni.Files.Exporter.Export(FileManager fileManager, String sourceFilePath, String filter)
  at Oni.Files.Program.Export(String[] args)
  at Oni.Files.Program.Main(String[] args)
Apparently it bails out when processing the sep part of the first TXMP it encounters.
geyser 07:47, 21 April 2008 (CEST)

Oops, fixed: OniSplit 0.9.6

Neo

Neo, Cel shading looks cool!

Please look at this screenshot, you will notice that the outline color for the head and biceps is not black, even though I have a black pixel at 0,0 on the TXMP. To test, I also put a yellow pixel at 0,0 and the outline was yellow. So I'm not sure, why I don't get a black outline.

GITS_Cel.jpg

Here are all my files related to this outfit. Its still WIP, but I thought the cel shader effect would look good with it.

http://edt.oni2.net/3D/Motoko.zip

Thanks,

EdT

Actually, the cel-shading of the whole model is flawed, not just the head and upper arms: e.g., the outline of her wrists is actually dark gray, and you're getting true black only for a few body parts, by coincidence. You didn't get true yellow, either.
The reason is that unless you use the -nouwrap and -novwrap tags, the color at (0,0) is sampled from all 4 corner pixels, not just from the top left one. So, either use those tags (that's what I've been doing) or place a black pixel in every corner.
I'd like to say that no matter how hard you try, you can't retexture this body mesh to look like the Major: you'll have to pick better-fitting body parts and retexture them. Smooth vertex normals wouldn't hurt either: what tool are you using now?
Also note, for future troubleshooting, that the .dae format is more appropriate for sharing, since it's the actual source file Onisplit works with.
geyser 19:57, 28 April 2008 (CEST)

geyser: Thanks for explaining about the cel-shading. Regarding the Major, as you pointed out the "Major just can't be a serious ingredient", so I gave up on trying to import a model of her. Rather, this outfit is more of my tribute to GITS, than anything else.

For this model, I used a program called Cheetah3D. I first exported the ONCC for k3 and k4_K, then converted the .dae file to .fbx using the FBX Converter, then swapped the pelvis, from k3 to k4_K, exported as .fbx, then converted to .dae. Since Blender ignores the vertex normals as Neo states, I wanted to see if I could use Cheetah3D instead.

EdT