IRRLICHTLIME, VISUAL BASIC.NET 2010, and MATERIALS and LIGHT

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
peteym5
Posts: 21
Joined: Wed Sep 12, 2012 3:56 pm

IRRLICHTLIME, VISUAL BASIC.NET 2010, and MATERIALS and LIGHT

Post by peteym5 »

Hello this is my first time coming to this board. I have been doing 3D gaming with VISUAL BASIC 5,6 .NET 2008 2010 for years. I am strongly considering porting a few existing games that previously used other 3D engines like Truevision3D, Revolution3D, and DirectX Directly.

I successfully translated some of the IRRLICHTLIME samples from C# to VB.NET 2010. I combined several samples into one. Problem I am having is trying to get materials and lighting to function correctly. This is something essential to the games I wrote because 3D objects get re-colored and alpha changed often inside my games.

I would like to upload the whole code here, but don't see where I can attach files.

Code: Select all

        Light0 = smgr.AddLightSceneNode(Nothing, New Vector3Df(0, 4096, 0), New Colorf(0.5, 1.0, 0.5, 1.0), 65535, 1)
        Light0.Visible = True
        materialx = New Material
        materialx.AmbientColor = New Color(255, 128, 0, 255)
        materialx.DiffuseColor = New Color(255, 128, 0, 255)
        materialx.EmissiveColor = New Color(0, 0, 0, 0)
        materialx.SpecularColor = New Color(64, 32, 0, 128)
        materialx.SetTexture(1, Driver.GetTexture("media/wall02.jpg"))
        materialx.BackfaceCulling = False
        materialx.Type = MaterialType.Solid
        materialx.SetFlag(MaterialFlag.NormalizeNormals, True)
        materialx.Shininess = 128
        materialx.Fog = False
        materialx.SetFlag(MaterialFlag.Lighting, False)
        materialx.Lighting = True
        materialx.MaterialTypeParam = 1
        materialx.MaterialTypeParam2 = 2
        materialx.ColorMask = ColorPlane.All
 
     ...
 
        Dim buf0 As MeshBuffer = MeshBuffer.Create(VertexType.Standard, IndexType._16Bit)
        Dim buf1 As MeshBuffer = MeshBuffer.Create(VertexType.Standard, IndexType._16Bit)
        Dim buf2 As MeshBuffer = MeshBuffer.Create(VertexType.Standard, IndexType._16Bit)
        Dim buf3 As MeshBuffer = MeshBuffer.Create(VertexType.Standard, IndexType._16Bit)
        Dim buf4 As MeshBuffer = MeshBuffer.Create(VertexType.Standard, IndexType._16Bit)
        Dim vertices(7 * 2 - 1) As Vertex3D
        Dim indices(5 * 6 - 1) As UShort
        Dim indices4 As UShort() = New UShort() {0, 1, 2, 1, 3, 2} ',
        Dim i As Integer
        Dim j As Single
        Dim k As Integer
        Dim v As Integer
        k = 0
        i = 0
        v = 0
        For v = 0 To 6 Step 2
            If j < 384 Then
                indices(k + 0) = v + 0
                indices(k + 1) = v + 1
                indices(k + 2) = v + 2
                indices(k + 3) = v + 1
                indices(k + 4) = v + 3
                indices(k + 5) = v + 2
                k = k + 6
            End If
        Next
        v = 0
        i = 0
        For j = 256 To 1024 Step 128
            vertices(v + 0) = New Vertex3D(50, 100, j, 50, 0, j, New Color(255, 255, 255), 0, i)
            vertices(v + 1) = New Vertex3D(50, 0, j, 50, 0, j, New Color(255, 255, 255), 1, i)
            v = v + 2
            i = i + 1
        Next j
        WallMesh(0) = IrrlichtLime.Scene.Mesh.Create
        WallMesh(0).AddMeshBuffer(buf0)
        buf0.Append(vertices, indices)
        buf0.RecalculateBoundingBox()
        buf0.Drop()
        WallNode(0) = smgr.AddMeshSceneNode(WallMesh(0))
        WallNode(0).Position = New Vector3Df(-2048, 512, 512)
        WallNode(0).SetMaterial(0, materialx)
        WallMesh(0).SetMaterialFlag(MaterialFlag.Lighting, True)
        WallMesh(0).SetMaterialFlag(MaterialFlag.ColorMaterial, True)
 
        i = 0
        v = 0
        For j = 256 To 1024 Step 128
            vertices(v + 1) = New Vertex3D(-50, 100, j, 0, 0, 0, New Color(255, 255, 255), 1, i)
            vertices(v + 0) = New Vertex3D(-50, 0, j, 0, 0, 0, New Color(255, 255, 255), 0, i)
            v = v + 2
            i = i + 1
        Next j
        WallMesh(1) = IrrlichtLime.Scene.Mesh.Create
        WallMesh(1).AddMeshBuffer(buf1)
        buf1.Append(vertices, indices)
        buf1.RecalculateBoundingBox()
        buf1.Drop()
        WallNode(1) = smgr.AddMeshSceneNode(WallMesh(1))
        WallMesh(1).SetMaterialFlag(MaterialFlag.Lighting, False)
        WallNode(1).Position = New Vector3Df(-2048, 512, 512)
        WallNode(1).SetMaterial(0, materialx)
 
        i = 0
        v = 0
        For j = 256 To 1024 Step 128
            vertices(v + 0) = New Vertex3D(-50, 100, j, 0, 0, 0, New Color(255, 255, 255), 0, i)
            vertices(v + 1) = New Vertex3D(50, 100, j, 0, 0, 0, New Color(255, 255, 255), 1, i)
            v = v + 2
            i = i + 1
        Next j
        WallMesh(2) = IrrlichtLime.Scene.Mesh.Create
        WallMesh(2).AddMeshBuffer(buf2)
        buf2.Append(vertices, indices)
        buf2.RecalculateBoundingBox()
        buf2.Drop()
        WallNode(2) = smgr.AddMeshSceneNode(WallMesh(2))
        WallNode(2).Position = New Vector3Df(-2048, 512, 512)
        WallNode(2).SetMaterial(0, materialx)
        i = 0
        v = 0
        For j = 256 To 1024 Step 128
            vertices(v + 0) = New Vertex3D(50, 0, j, 0, 0, j, New Color(255, 255, 255), 0, i)
            vertices(v + 1) = New Vertex3D(-50, 0, j, 0, 0, j, New Color(255, 255, 255), 1, i)
            v = v + 2
            i = i + 1
        Next j
        WallMesh(3) = IrrlichtLime.Scene.Mesh.Create
        WallMesh(3).AddMeshBuffer(buf3)
        buf3.Append(vertices, indices)
        buf3.RecalculateBoundingBox()
        buf3.Drop()
        WallNode(3) = smgr.AddMeshSceneNode(WallMesh(3))
        WallNode(3).Position = New Vector3Df(-2048, 512, 512)
        WallNode(3).SetMaterial(0, materialx)
        vertices(0) = New Vertex3D(-50, 100, 256, 0, 0, 0, New Color(255, 255, 255), 0, 0)
        vertices(1) = New Vertex3D(-50, 0, 256, 0, 0, 0, New Color(255, 255, 255), 0, 1)
        vertices(2) = New Vertex3D(50, 100, 256, 0, 0, 0, New Color(255, 255, 255), 1, 0)
        vertices(3) = New Vertex3D(50, 0, 256, 0, 0, 0, New Color(255, 255, 255), 1, 1)
 
 
        WallMesh(4) = IrrlichtLime.Scene.Mesh.Create
        WallMesh(4).AddMeshBuffer(buf4)
        buf4.Append(vertices, indices4)
        buf4.RecalculateBoundingBox()
        buf4.Drop()
        WallNode(4) = smgr.AddMeshSceneNode(WallMesh(4))
        WallNode(4).Position = New Vector3Df(-2048, 512, 512)
        WallNode(4).SetMaterial(0, materialx)
 
       ...
I know there is a material and light sample (#22 I think) but having problems translating it over to VB.NET 2010 and IRRLICHTLIME. There is not a C# version yet, only C++ and the translator only works for C#.

I am considering converting an advance user friendly Role Playing Game maker to use IRRLICHT and IRRLICHTLIME. Whole thing was done in Visual Basic. Project is over 10 years old and 10s of thousands lines of coding. Currently using Truevision3D 6.5 to drive the 3D part of it. Reason is that the programmers of TV3D seem to have abandoned their project. Have not seen an update for 3 years now. Plus they are charging a larger royalty to use their engine. People using their message board has been on the decline.
greenya
Posts: 1012
Joined: Sun Jan 21, 2007 1:46 pm
Location: Ukraine
Contact:

Re: IRRLICHTLIME, VISUAL BASIC.NET 2010, and MATERIALS and L

Post by greenya »

Hello.
If you have some problem, please make as short code as possible that represents a problem.
Precisely describe what you expect and what you have as the result from the code.

P.S.: and yes, it is a pity, but example #22 is not translated yet.
peteym5
Posts: 21
Joined: Wed Sep 12, 2012 3:56 pm

Re: IRRLICHTLIME, VISUAL BASIC.NET 2010, and MATERIALS and L

Post by peteym5 »

http://www.thepetezone.com/sampledl.html

Here is a link to the combined sample. I am going to assume that anyone downloading it has VB.NET 2010 and IRRLICHTLIME on their computer. Has all media inside the zip file.

http://www.thepetezone.com/imperiummagica/

This is a link to my RPG maker I have been working on. It contains help files and screen shots. It is the project I would like to port over to IRRLICHTLIME.
peteym5
Posts: 21
Joined: Wed Sep 12, 2012 3:56 pm

Re: IRRLICHTLIME, VISUAL BASIC.NET 2010, and MATERIALS and L

Post by peteym5 »

greenya wrote:Hello.
If you have some problem, please make as short code as possible that represents a problem.
Precisely describe what you expect and what you have as the result from the code.

P.S.: and yes, it is a pity, but example #22 is not translated yet.
Well I am getting sides of the object turning all white or all the opaque without the texture. Been trying different parameters. If you get the sample to run, the target object is above the landscape and behind the PSP mesh. The sides change from textured to all white as the camera rotates. I have combined several samples to see how well things work together. Check its frame rate, Z-Order, Alpha Blending, etc.
fdacunha
Posts: 1
Joined: Fri Dec 02, 2016 2:34 pm

Re: IRRLICHTLIME, VISUAL BASIC.NET 2010, and MATERIALS and L

Post by fdacunha »

Hi All !

Noobie - I think I.lime is amazing - I have the C# examples running fine

May I know where examples / "C# converted to VB.net" in Visual Basic 2010

or higher are kept

It seems to be difficult to code convert directly from the C# examples

Is there something I'm missing?

All the sample code seems to be partially built or small code segment

Cheers

Francis
Foaly
Posts: 142
Joined: Tue Apr 15, 2014 8:45 am
Location: Germany

Re: IRRLICHTLIME, VISUAL BASIC.NET 2010, and MATERIALS and L

Post by Foaly »

All official Irrlicht Lime examples are written in C#.
You can use a converter like https://roslyncodeconverter.azurewebsites.net/ to convert from C# to VB.NET.

In my opinion C# is suited better for writing 3d apps, and if you already know VB.NET, it shouldn't be hard to learn.
Post Reply