[ PavleBgd @ 03.09.2006. 17:48 ] @
Posto imam jos pitanja u vezi Ogre-a sugerisano mi je da otvorim drugu temu(hvala franticnick na iscrpnom odgovoru).
U 3DSMax sam kreirao jednostavni objekat (kocku). Dodao sam mu materijal (BeachStones.jpg koji se nalazi u ..\media\materials\textures OgreSDK paketa). U Render prozoru kao i pomocu oFusion paketa se u Max-u objekat noramlno vidi (sa teksturom).
Objekat sam zatim eksportovao u XML pomocu OgreMaxExportera i konvertovao ga u mesh koristeci OGREXMLConverter ("kocka.mesh")

U CreateScene() metod aplikacije sam dodao sledeci kod:

Code:

         mSceneMgr->setAmbientLight( ColourValue( 1.0f, 1.0f, 1.0f ) );


         ent = mSceneMgr->createEntity( "Kocka", "kocka.mesh" );
         node = mSceneMgr->getRootSceneNode( )->createChildSceneNode( "KockaNode", Vector3(  0.0f, -10.0f,  25.0f ) );
         node->attachObject( ent );
         node->setScale( 0.2f, 0.2f, 0.2f );

         ent = mSceneMgr->createEntity( "Knot1", "knot.mesh" );
         node = mSceneMgr->getRootSceneNode( )->createChildSceneNode( "Knot1Node", Vector3(  0.0f, 0.0f,  100.0f ) );
         node->attachObject( ent );
         node->setScale( 0.1f, 0.1f, 0.1f );


U Materials script sam dodao opis materijala:
Code:

material KockaSkin
{
    technique
    {
        pass
        {

            texture_unit
            {
                texture BeachStones.jpg
            }
        }
    }
}


Evo ga isecak iz ogre.log-a (oznaceno sa >>>):
Code:

18:39:45: Parsing script Example-Water.overlay
18:39:45: Parsing script Shadows.overlay
18:39:45: Finished parsing scripts for resource group General
>>> 18:39:45: Mesh: Loading kocka.mesh.
>>> 18:39:45: Texture: BeachStones.jpg: Loading 1 faces(PF_B8G8R8,512x512x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,512x512x1.
18:39:45: Mesh: Loading knot.mesh.
18:39:45: D3D9 : ***** Dimensions altered by the render system
18:39:45: D3D9 : ***** Source image dimensions : 780x511
18:39:45: D3D9 : ***** Texture dimensions : 1024x512
18:39:45: Texture: MtlPlat2.jpg: Loading 1 faces(PF_B8G8R8,780x511x1) with 5 generated mipmaps from Image. Internal format is PF_X8R8G8B8,1024x512x1.
18:39:46: Win32Input8: DirectInput Activation Starts


Kada pokrenem aplikaciju kocka se pojavi na pravom mestu. Medjutim kocka nema teksturu, vec je samo sive boje? Ono sto je interesantno je da pored ovoga je prikazan sasvim normalno drugi objekat (knot.mesh) sa teksturom.

Kako da mi se normalno prikaze tekstura na objektu (onako kako se to vidi uz pomoc oFusion-a u Maxu)?
Pozdrav

[Ovu poruku je menjao PavleBgd dana 03.09.2006. u 20:13 GMT+1]

[Ovu poruku je menjao PavleBgd dana 09.09.2006. u 09:41 GMT+1]
[ franticnick @ 03.09.2006. 23:28 ] @
Posalji mi .xml, .mesh i .material fajlove koje si generisao. Sigurno je neka glupost.


Da li si .material fajl snimio u ..\media\materials\scripts? Moguce je da je i do konvertora jer ih ima u vise verzija, videcemo kada posaljes fajlove.
[ PavleBgd @ 03.09.2006. 23:56 ] @
Citat:

Da li si .material fajl snimio u ..\media\materials\scripts?


Da snimio sam ga na to mesto. Cak me je Ogre bio i upozorio kada nije uspeo da ga nadje (tada sam ga premestio u scripts).
Svi fajlovi su u prilogu uz poruku.
Pozdrav



[Ovu poruku je menjao PavleBgd dana 04.09.2006. u 01:06 GMT+1]
[ PavleBgd @ 04.09.2006. 00:03 ] @
Evo kako izgleda entitet u Max-u.
[ franticnick @ 04.09.2006. 10:47 ] @
Kao da nisi exportovao kako treba. Nemam sad instaliran MAX i oFusion da bih probao, ali vidi da li ima nekih opcija u koje nisi "stiklirao" prilikom eksportovanja.

Posalji mi i .max fajl.
[ PavleBgd @ 04.09.2006. 15:57 ] @
Probao sam i druge opcije u exporteru (ukljucujuci i Export material) malo pre. Pokusao sam i sa promenom materijala. .Max u prilogu
Pozdrav
[ PavleBgd @ 04.09.2006. 16:04 ] @
Ovo je izlaz XMLConvertera

Code:

-- OPTIONS --
source file      = kocka.mesh.xml
destination file = kocka.mesh
log file         = OgreXMLConverter.log
interactive mode = false
lod levels       = none (or use existing)
Generate edge lists  = 1
Generate tangents = 0
Reorganise vertex buffers = 1
Optimise animations = 1
-- END OPTIONS --

Creating resource group General
Creating resource group Internal
Creating resource group Autodetect
Registering ResourceManager for type Mesh
Registering ResourceManager for type Material
Registering ResourceManager for type Skeleton
XMLMeshSerializer reading mesh data from kocka.mesh.xml...
Reading submeshes...
Reading geometry...
Geometry done...
Reading geometry...
Geometry done...
Reading geometry...
Geometry done...
Reading geometry...
Geometry done...
Reading geometry...
Geometry done...
Reading geometry...
Geometry done...
Submeshes done.
XMLMeshSerializer import successful.
Reorganising vertex buffers to automatic layout..
Generating edge lists....
MeshSerializer writing mesh data to kocka.mesh...
File header written.
Writing mesh data...
Writing submesh...
Exporting submesh texture aliases...
Submesh texture aliases exported.
Submesh exported.
Writing submesh...
Exporting submesh texture aliases...
Submesh texture aliases exported.
Submesh exported.
Writing submesh...
Exporting submesh texture aliases...
Submesh texture aliases exported.
Submesh exported.
Writing submesh...
Exporting submesh texture aliases...
Submesh texture aliases exported.
Submesh exported.
Writing submesh...
Exporting submesh texture aliases...
Submesh texture aliases exported.
Submesh exported.
Writing submesh...
Exporting submesh texture aliases...
Submesh texture aliases exported.
Submesh exported.
Exporting bounds information....
Bounds information exported.
Exporting submesh name table...
Submesh name table exported.
Exporting edge lists...
Edge lists exported
Mesh data exported.
MeshSerializer export successful.
Unregistering ResourceManager for type Skeleton
Unregistering ResourceManager for type Material
Unregistering ResourceManager for type Mesh
[ PavleBgd @ 09.09.2006. 02:00 ] @
Da javim da sam uspeo da resim problem. Sve je u redu i sa Ogreom i sa 3DMax-om ali da bi XML exporter pravilno eksportovao podatke o meshu (ukljucujuci i koordinate teksture na entitetu) potrebno je izvrsiti mapiranje direktno u 3DMax-u(Modifiers->UV Coordinates->UVW Map).

Stari XML
Code:

<vertex> 
   <position x="-49.4253" y="0.0" z="44.4444" /> 
   <normal x="0.0" y="-1.0" z="0.0" /> 
</vertex> 



Novi XML

Code:

<vertex> 
   <position x="-49.4253" y="0.0" z="44.4444" /> 
   <normal x="0.0" y="-1.0" z="0.0" /> 
   <texcoord u="0.999501" v="0.9995" /> 
</vertex> 


Kao sto se moze videti u novom XML eksportu je i textcoord item :)
Pozdrav

[ franticnick @ 12.09.2006. 17:43 ] @
E, dobro je.

Nisam bio u prilici da se vise pozabavim tvojim problemom jer sam trenutno u procesu preseljenja. U svakom slucaju, pitaj i ubuduce.