Page 1 of 1

Load a 3ds Modle with Texture

Posted: Fri Aug 04, 2006 9:18 am
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?

Posted: Fri Aug 04, 2006 12:45 pm
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?

Posted: Fri Aug 04, 2006 1:02 pm
by FlashMX
Yes i call the setTexture. But the problem is the model have more than one textures.

Posted: Sat Aug 05, 2006 10:04 am
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.

Posted: Tue Aug 08, 2006 3:30 pm
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