Stratos: Punto de Encuentro de Desarrolladores

¡Bienvenido a Stratos!

Acceder

Foros





Great Work! And A Request Please -> .hadd Format

Iniciado por , 07 de Febrero de 2006, 12:11:34 AM

« anterior - próximo »

 Hi all! Great work guys with the engine. Muchos gracias!

I'm would like to write .hadd file format exporter for a Lightwave but there's no specs of .hadd file format.
Could You provide it please It would be easier for me than trying to guess from example models You provide with the engine.

P.S. I've noticed that You are also have light data inside .hadd. Hmm ? Why? I've guessed it is model only file .... Guess I'm wrong.
Please help.

Thanks in advance!


 It would be great to see a .hadd format exporter for Lightwave!  (genial)  

Haddd

 Fantastic! We will give you all of our support.  (ole)

You really must create a .prehaddd file. This is the file exported from MAX. The engine when loads a .haddd look at the head, and if it's a prehaddd it transforms and save on it a .haddd

We have no docs about .haddd yet, as we think it's very easy. You can try it exporting a simple textured cube on MAX, and then take a look at the .prehaddd. Or you can export directly to a .haddd , the way you think is better.

If you have doubts, problems, please contact with me, i will send you the code ...


 Are you guys planning on making a Haddd editor that imports 3ds/.x files etc?

Haddd

 We have no plans on it. We are working hard, and the comunity starts to help us on creating new tutorials  :P , for the final 2.0 release with full source code.

We always believe that the comunity will help us writing this kind of exporters, thats why the .haddd format is so easy  <_<

This is a cube:


HadddVersion 13

numMaterials 1
numGeomObjects 1
numLights 1
numParticleEffects 0

global {
ambientColor ( 0 0 0 )

fogType "none"
}

material "01 - default" {

numMaps 3

diffuseColor ( 0.588235 0.588235 0.588235 )
specularColor ( 0.9 0.9 0.9 )
specularPower 10
emissiveColor ( 0 0 0 )
indexOfRefraction 1.5

map "map #1" {

 type Diffuse
 mapChannel 0
 amount 1
 u_tile 1
 v_tile 1
 fileName "Pared_Difusse.jpg"
}
map "map #2" {

 type Specular
 mapChannel 0
 amount 1
 u_tile 1
 v_tile 1
 fileName "Pared_Spec.dds"
}
map "map #3" {

 type Bump
 mapChannel 0
 amount 0.3
 u_tile 1
 v_tile 1
 fileName "Pared_Normal.dds"
}
}

geomObject "box01" {

type "Normal"
receiveShadows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( -0.5 1 0.5 ) ( -1 0 0 ) ( 0 0 )

numFaces 12
face 0 0 1 2 0
face 1 1 0 3 0
face 2 4 5 6 0
face 3 5 4 7 0
face 4 8 9 10 0
face 5 9 8 11 0
face 6 12 13 14 0
face 7 13 12 15 0
face 8 16 17 18 0
face 9 17 16 19 0
face 10 20 21 22 0
face 11 21 20 23 0
}

light "omni01" {

type omni

position ( -1.00345 0 0.609542 )

castShadows False

multiplier 1
color ( 1 1 1 )
attenuationDecay DualRadius
farAttenStart 1
farAttenEnd 4


affectDiffuse True
affectSpecular True

useProjector False

useShafts False

useVolume False

}



I thinks you should ask for:


numUniqueMatIDs 1
0

This is the subsets or submaterials that contains the mesh. This is telling that there is only 1 material for this mesh, and this is the material number 0.

vert 0 ( -0.5 0 -0.5 ) ( 0 -1 0 ) ( 1 1 )

Number of vertex ( x y z ) ( normalX normalY normalZ) (tu tv)

face 0 0 1 2 0

Face number First index Second index Third index NumMaterialID for this face(numUniqueMatIDs)


 Do need a light defined in the haddd file? If so, why cant it just rely on scene lights?

When I add multiple tanks (HImport.Haddd.Load("tank"); ),  the materials get a little messed up, every time you add a new tank, the materials of all get a little brighter and uglier.

Haddd

 
CitarDo need a light defined in the haddd file? If so, why cant it just rely on scene lights?

No you don't. You can have only geometry, or light, or particles....

Citar
When I add multiple tanks (HImport.Haddd.Load("tank"); ), the materials get a little messed up, every time you add a new tank, the materials of all get a little brighter and uglier.

That's why the tanks has lights on it. So when you load it, you are loading more lights at the same position...

But if you want more tanks, you only need:

HMeshObject newTank;

newTank=tank.Clone("Newtank");

The problem about cloning the tank is that you must do it for all the objects that forms the tank...We need to save the hierarchy to avoid this problems.... :(


 I've played with Max a bit (Max8) to try to export a model in a research to do a Lightwave exporter.
Even for a basic scene I get .haddd without poly info in it. Something like this:

PreHadddVersion 13

numMaterials 1
numGeomObjects 1
numLights 0
numParticleEffects 0

global {
   ambientColor ( 0.0 0.0 0.0 )

   fogType "none"
}

material "DefaultTestSurface" {

   index 0
   class Multimaterial
   numSubMaterials 2

   material "Material #25" {

      index 0
      class Standardmaterial
      numSubMaterials 0
      diffuseColor ( 0.588 0.588 0.588 )
      specularColor ( 0.9 0.9 0.9 )
      specularPower 10.0
      emissiveColor ( 0.0 0.0 0.0 )
      indexOfRefraction 1.5
      numMaps 1

      map "Map #7" {

         type Diffuse
         class Bitmaptexture
         mapChannel 0
         subno 2
         amount 1.0
         u_tile 1.0
         v_tile 1.0
         bitmap "294.jpg"
      }
   }
   material "Material #26" {

      index 1
      class Standardmaterial
      numSubMaterials 0
      diffuseColor ( 0.588 0.588 0.588 )
      specularColor ( 0.9 0.9 0.9 )
      specularPower 10.0
      emissiveColor ( 0.0 0.0 0.0 )
      indexOfRefraction 1.5
      numMaps 1

      map "Map #4" {

         type Diffuse
         class Bitmaptexture
         mapChannel 0
         subno 2
         amount 1.0
         u_tile 1.0
         v_tile 1.0
         bitmap "360.jpg"
      }
   }
}

geomObject "Box01" {

   type "Normal"
   receiveShadows true
   castShadows true
   mass 0
   materialID 0
   numMapChannels 1

   numVerts 36
   vert 0 ( 1.4083e-005 3.83142 63.9847 ) ( 1.0 0.0 -1.62921e-007 ) ( 0.999501 0.9995 ) 1
   vert 1 ( -1.45185e-005 144.061 -73.9464 ) ( 1.0 0.0 -1.62921e-007 ) ( 0.000499517 0.000499725 ) 1
   vert 2 ( 7.95337e-006 144.061 63.9847 ) ( 1.0 0.0 -1.62921e-007 ) ( 0.9995 0.000499547 ) 1
   vert 3 ( -1.45185e-005 144.061 -73.9464 ) ( 1.0 0.0 -1.62921e-007 ) ( 0.000499517 0.000499725 ) 1
   vert 4 ( 1.4083e-005 3.83142 63.9847 ) ( 1.0 0.0 -1.62921e-007 ) ( 0.999501 0.9995 ) 1
   vert 5 ( -8.38881e-006 3.83142 -73.9464 ) ( 1.0 0.0 -1.62921e-007 ) ( 0.000499755 0.9995 ) 1
   vert 6 ( -153.257 3.83142 63.9847 ) ( -1.0 0.0 2.21252e-007 ) ( 0.000499517 0.9995 ) 0
   vert 7 ( -153.257 144.061 -73.9463 ) ( -1.0 0.0 2.21252e-007 ) ( 0.999501 0.000499725 ) 0
   vert 8 ( -153.257 3.83141 -73.9463 ) ( -1.0 0.0 2.21252e-007 ) ( 0.9995 0.9995 ) 0
   vert 9 ( -153.257 144.061 -73.9463 ) ( -1.0 0.0 2.21252e-007 ) ( 0.999501 0.000499725 ) 0
   vert 10 ( -153.257 3.83142 63.9847 ) ( -1.0 0.0 2.21252e-007 ) ( 0.000499517 0.9995 ) 0
   vert 11 ( -153.257 144.061 63.9847 ) ( -1.0 0.0 2.21252e-007 ) ( 0.000499755 0.000499547 ) 0
   vert 12 ( 1.4083e-005 3.83142 63.9847 ) ( 0.0 -1.0 0.0 ) ( 0.000499517 0.9995 ) 0
   vert 13 ( -153.257 3.83141 -73.9463 ) ( 0.0 -1.0 0.0 ) ( 0.9995 0.000499487 ) 0
   vert 14 ( -8.38881e-006 3.83142 -73.9464 ) ( 0.0 -1.0 0.0 ) ( 0.9995 0.9995 ) 0
   vert 15 ( -153.257 3.83141 -73.9463 ) ( 0.0 -1.0 0.0 ) ( 0.9995 0.000499487 ) 0
   vert 16 ( 1.4083e-005 3.83142 63.9847 ) ( 0.0 -1.0 0.0 ) ( 0.000499517 0.9995 ) 0
   vert 17 ( -153.257 3.83142 63.9847 ) ( 0.0 -1.0 0.0 ) ( 0.000499517 0.000499487 ) 0
   vert 18 ( -8.38881e-006 3.83142 -73.9464 ) ( -1.49345e-007 0.0 -1.0 ) ( 0.000499547 0.9995 ) 0
   vert 19 ( -153.257 144.061 -73.9463 ) ( -1.49345e-007 0.0 -1.0 ) ( 0.9995 0.000499487 ) 0
   vert 20 ( -1.45185e-005 144.061 -73.9464 ) ( -1.49345e-007 0.0 -1.0 ) ( 0.9995 0.9995 ) 0
   vert 21 ( -153.257 144.061 -73.9463 ) ( -1.49345e-007 0.0 -1.0 ) ( 0.9995 0.000499487 ) 0
   vert 22 ( -8.38881e-006 3.83142 -73.9464 ) ( -1.49345e-007 0.0 -1.0 ) ( 0.000499547 0.9995 ) 0
   vert 23 ( -153.257 3.83141 -73.9463 ) ( -1.49345e-007 0.0 -1.0 ) ( 0.000499547 0.000499487 ) 0
   vert 24 ( -1.45185e-005 144.061 -73.9464 ) ( 0.0 1.0 0.0 ) ( 0.000499517 0.9995 ) 1
   vert 25 ( -153.257 144.061 63.9847 ) ( 0.0 1.0 0.0 ) ( 0.9995 0.000499487 ) 1
   vert 26 ( 7.95337e-006 144.061 63.9847 ) ( 0.0 1.0 0.0 ) ( 0.9995 0.9995 ) 1
   vert 27 ( -153.257 144.061 63.9847 ) ( 0.0 1.0 0.0 ) ( 0.9995 0.000499487 ) 1
   vert 28 ( -1.45185e-005 144.061 -73.9464 ) ( 0.0 1.0 0.0 ) ( 0.000499517 0.9995 ) 1
   vert 29 ( -153.257 144.061 -73.9463 ) ( 0.0 1.0 0.0 ) ( 0.000499517 0.000499487 ) 1
   vert 30 ( 7.95337e-006 144.061 63.9847 ) ( 1.61791e-007 0.0 1.0 ) ( 0.000499547 0.9995 ) 0
   vert 31 ( -153.257 3.83142 63.9847 ) ( 1.61791e-007 0.0 1.0 ) ( 0.9995 0.000499487 ) 0
   vert 32 ( 1.4083e-005 3.83142 63.9847 ) ( 1.49345e-007 0.0 1.0 ) ( 0.9995 0.9995 ) 0
   vert 33 ( -153.257 3.83142 63.9847 ) ( 1.61791e-007 0.0 1.0 ) ( 0.9995 0.000499487 ) 0
   vert 34 ( 7.95337e-006 144.061 63.9847 ) ( 1.61791e-007 0.0 1.0 ) ( 0.000499547 0.9995 ) 0
   vert 35 ( -153.257 144.061 63.9847 ) ( 1.74236e-007 0.0 1.0 ) ( 0.000499547 0.000499487 ) 0
}

Anyway the model viewer that You have provided crashes on loading:
System.Exception: ERROR: file "", line 0: Couldn't load file:
  at HadddEngine.Tools.Parser.HParser.Error(String msg)
  at HadddEngine.Tools.Parser.HParser.Error(String msg, Object[] args)
  at HadddEngine.HadddLoader.Load(String fileName, Vector3 inScale)
  at HadddEngine.HadddLoader.Load(String fileName)
  at Viewer.ViewerFrm.loadToolStripMenuItem_Click(Object sender, EventArgs e)
  at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
  at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
  at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
  at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
 ... blah blah blah

This is a model with Multi-SubMaterial applied. On every submaterial there is a standard material with a bitmap as a diffuse map.

After that I've tried to simplify the test and created just a box(without mapping and textures). Exporting went well ... file looks like this:

PreHadddVersion 13

numMaterials 0
numGeomObjects 1
numLights 0
numParticleEffects 0

global {
   ambientColor ( 0.0 0.0 0.0 )

   fogType "none"
}

geomObject "Box01" {

   type "Normal"
   receiveShadows true
   castShadows true
   mass 0
   materialID -2
   numMapChannels 0

   numVerts 36
   vert 0 ( -75.4789 0.0 -64.3678 ) ( 0.0 -1.0 0.0 ) 1
   vert 1 ( 73.9464 0.0 68.1992 ) ( 0.0 -1.0 0.0 ) 1
   vert 2 ( -75.4789 0.0 68.1992 ) ( 0.0 -1.0 0.0 ) 1
   vert 3 ( 73.9464 0.0 68.1992 ) ( 0.0 -1.0 0.0 ) 1
   vert 4 ( -75.4789 0.0 -64.3678 ) ( 0.0 -1.0 0.0 ) 1
   vert 5 ( 73.9464 0.0 -64.3678 ) ( 0.0 -1.0 0.0 ) 1
   vert 6 ( -75.4789 129.502 -64.3678 ) ( 0.0 1.0 0.0 ) 0
   vert 7 ( 73.9464 129.502 68.1992 ) ( 0.0 1.0 0.0 ) 0
   vert 8 ( 73.9464 129.502 -64.3678 ) ( 0.0 1.0 0.0 ) 0
   vert 9 ( 73.9464 129.502 68.1992 ) ( 0.0 1.0 0.0 ) 0
   vert 10 ( -75.4789 129.502 -64.3678 ) ( 0.0 1.0 0.0 ) 0
   vert 11 ( -75.4789 129.502 68.1992 ) ( 0.0 1.0 0.0 ) 0
   vert 12 ( -75.4789 0.0 -64.3678 ) ( 0.0 0.0 -1.0 ) 4
   vert 13 ( 73.9464 129.502 -64.3678 ) ( 0.0 0.0 -1.0 ) 4
   vert 14 ( 73.9464 0.0 -64.3678 ) ( 0.0 0.0 -1.0 ) 4
   vert 15 ( 73.9464 129.502 -64.3678 ) ( 0.0 0.0 -1.0 ) 4
   vert 16 ( -75.4789 0.0 -64.3678 ) ( 0.0 0.0 -1.0 ) 4
   vert 17 ( -75.4789 129.502 -64.3678 ) ( 0.0 0.0 -1.0 ) 4
   vert 18 ( 73.9464 0.0 -64.3678 ) ( 1.0 0.0 0.0 ) 3
   vert 19 ( 73.9464 129.502 68.1992 ) ( 1.0 0.0 0.0 ) 3
   vert 20 ( 73.9464 0.0 68.1992 ) ( 1.0 0.0 0.0 ) 3
   vert 21 ( 73.9464 129.502 68.1992 ) ( 1.0 0.0 0.0 ) 3
   vert 22 ( 73.9464 0.0 -64.3678 ) ( 1.0 0.0 0.0 ) 3
   vert 23 ( 73.9464 129.502 -64.3678 ) ( 1.0 0.0 0.0 ) 3
   vert 24 ( 73.9464 0.0 68.1992 ) ( 0.0 0.0 1.0 ) 5
   vert 25 ( -75.4789 129.502 68.1992 ) ( 0.0 0.0 1.0 ) 5
   vert 26 ( -75.4789 0.0 68.1992 ) ( 0.0 0.0 1.0 ) 5
   vert 27 ( -75.4789 129.502 68.1992 ) ( 0.0 0.0 1.0 ) 5
   vert 28 ( 73.9464 0.0 68.1992 ) ( 0.0 0.0 1.0 ) 5
   vert 29 ( 73.9464 129.502 68.1992 ) ( 0.0 0.0 1.0 ) 5
   vert 30 ( -75.4789 0.0 68.1992 ) ( -1.0 0.0 0.0 ) 2
   vert 31 ( -75.4789 129.502 -64.3678 ) ( -1.0 0.0 0.0 ) 2
   vert 32 ( -75.4789 0.0 -64.3678 ) ( -1.0 0.0 0.0 ) 2
   vert 33 ( -75.4789 129.502 -64.3678 ) ( -1.0 0.0 0.0 ) 2
   vert 34 ( -75.4789 0.0 68.1992 ) ( -1.0 0.0 0.0 ) 2
   vert 35 ( -75.4789 129.502 68.1992 ) ( -1.0 0.0 0.0 ) 2
}

But when I try to load it into a Viewer, it crashes and erases the whole .haddd file (0 bytes).
This is the exeption:
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
  at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
  at System.ThrowHelper.ThrowArgumentOutOfRangeException()
  at HadddEngine.HadddConvertor.ConvertGeomObjects()
  at HadddEngine.HadddConvertor.Convert(String fileName)
  at HadddEngine.HadddLoader.Load(String fileName, Vector3 inScale)
  at HadddEngine.HadddLoader.Load(String fileName)
  at Viewer.ViewerFrm.loadToolStripMenuItem_Click(Object sender, EventArgs e)
  at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
blah blah ..............

On a third attempt I've added UVMap modifer on the model, added texture to as a diffuse map in the material and applied that material on the test box. Exporting went well, and loading this model into the viewer didn't crash it, but the scene black. There was no model and also grid hasn't been drawn(I set it to draw grid in View menu). After that I've noticed that the viewer has changed the .haddd file (there was the polygon info).

Am I missing something here? Plaease help. (I've seen the export tutorial video and done as in it)

Thanks!


Haddd

 You need the texture coordinates on the mesh. It's a must.

I don't know if you have seen the video exporter created by our webmaster. It's on the web... ;)

If you look at the file, there is not face information.....Strange, very strange...

Anyway, please send me the .max file, textures and the Prehaddd file if you find some more troubles.

haddd@telefonica.net

 What if you want to load a mesh for collisions only?

Haddd

 Physics are not yet integrated on the loader. You must do all the job coding... :(

You can load, and hide a mesh, of course...

 It was my bad ... I didn't set units to meters, so exported box was either too large or too small to see.
Anyway, I was performing a new test trying to use few texture layers and I've failed.
I looked somethign like this(Max material setup), here we go:

- I had main material as Mult-Sub object material with 2 materials
- Each of these two materials is Standard material.
- Each standard material has Composite map on a diffuse channel with 2 Bitmaps

Reason of this test was to try to export multysub materials with layered bitmaps on each sub material.
Exporting failed in MaxScript exporter like this:
---- Unknown property: "coords" in Map #1: Composite.

I suppose that composite materials are not supported in exporting script?

Can You tell me how to export material with texture layers from Max?
And can You tell me how .hadd looks the having a material with layers.


Question #2:
- Does HADD supports skeletal animations, if so how it looks in .haddd file. Or it imports MD5 anim files for animated characters(models).

Thanks!  :rolleyes:







Stratos es un servicio gratuito, cuyos costes se cubren en parte con la publicidad.
Por favor, desactiva el bloqueador de anuncios en esta web para ayudar a que siga adelante.
Muchísimas gracias.