Load a 3ds Modle with Texture

Irrlicht.Net is no longer developed or supported, Irrlicht.Net Cross Platform is a much more complete wrapper. Please ask your C# related questions on their forums first.
Locked
FlashMX
Posts: 6
Joined: Fri Jul 21, 2006 5:54 pm

Load a 3ds Modle with Texture

Post by FlashMX »

Hello,

i need help with loading a 3ds modle and his texture.
http://www.gerf.org/~nixon/gunboat.zip

My source is in VB.net Syntax:

Code: Select all

 Dim Model As Irrlicht.Scene.IAnimatedMesh
        Dim Node As Irrlicht.Scene.IAnimatedMeshSceneNode
        Dim ColAnim As Irrlicht.Scene.ISceneNodeAnimator
        Dim Selector As Irrlicht.Scene.ITriangleSelector

        Dim Tex As Irrlicht.Video.ITexture

        Public Sub LoadModel(ByVal Path As String)
            Model = Device.SceneManager.GetMesh(Path)
            Node = Device.SceneManager.AddAnimatedMeshSceneNode(Model, Nothing, -1)
            Node.SetMaterialFlag(MaterialFlag.LIGHTING, False)
            Node.SetMaterialType(MaterialType.DETAIL_MAP)
        End Sub

               
        Sub SetTexture(ByVal Texture As String)
            Tex = Device.VideoDriver.GetTexture(Texture)
            Node.SetMaterialTexture(0, Tex)
        End Sub
with this code my Modle is in the game white.
Where is the error?
Mecharius
Posts: 17
Joined: Wed Jun 07, 2006 7:05 am

Post by Mecharius »

Umm... forgive me if I'm being stupid, because I haven't looked at any VB code for a while, but do you actually make the call to the SetTexture() sub anywhere?
FlashMX
Posts: 6
Joined: Fri Jul 21, 2006 5:54 pm

Post by FlashMX »

Yes i call the setTexture. But the problem is the model have more than one textures.
groats
Posts: 7
Joined: Tue Mar 21, 2006 11:49 am

Post by groats »

Surely you shouldn't need to set the texture, since the 3ds file contains the references to the texture files?

Try loading it in something like delgine http://www.delgine.com/.

If you export it out as a .x or .dmf file you can open it in a texteditor and see the file links. Also you can fix any problems with the model i.e like remap some missing textures. ( irrlicht can use these formats too btw )

I think there is something not quite right with your 3ds file, I opened it in deled and some of the textures do not map correctly, in my experience this usually means there will be a problem using the model with irrlicht unless you fix it by re-exporting it.
Rainbringer
Posts: 13
Joined: Sat Jul 01, 2006 3:14 pm
Location: Germany - Berlin

Post by Rainbringer »

There is no need to declare the textures in Visual Basic [or the SourceCode]. you only have to set the textures in 3d Max this way:

you have to look out for the Material Editor [Rendering/Material Editor]
now choose one of the spheres.. click on it
then click on the 'Maps' RollOut an click at the 'Diffusecolor' the Button which is called 'None'
In the new window, choose 'Bitmap' per Doubleclick and search your chosen texture
click on the sphere and pull it per drag&drop to the part of the model you want
then copy and paste the textures in the Bin Folder of your Solution

By the way you are working with Visual Basic, we too and we got some little problems with Irrlicht in VB, can you help us searching tutorials for Irrlicht in Visual Basic?

Good Luck

mfg Rainbringer
Locked