Page 1 of 1

Culling Problem

Posted: Sat Apr 19, 2014 1:58 pm
by giulioz
Hello everyone.
I'm using Irrlicht with C# to develop an isometric RPG game.
I've got a big problem with sprites and isometric camera.
When the camera moves sprites disappears gradually like in these shoots:
Image
Image

I create the sprites with this code:

Code: Select all

float halfWidth = size.Width / 2;
            MeshBuffer buff = MeshBuffer.Create(VertexType.Standard, IndexType._32Bit);
            buff.Append(new Vertex3D[]{
                new Vertex3D(new Vector3Df(-halfWidth, 0, 0), new Vector3Df(0, 0, 0), Color.OpaqueWhite, new Vector2Df(0,1)),
                new Vertex3D(new Vector3Df(halfWidth, 0, 0), new Vector3Df(0, 0, 0), Color.OpaqueWhite, new Vector2Df(1,1)),
                new Vertex3D(new Vector3Df(-halfWidth, size.Height, 0), new Vector3Df(0, 0, 0), Color.OpaqueWhite, new Vector2Df(0,0)),
                new Vertex3D(new Vector3Df(halfWidth, size.Height, 0), new Vector3Df(0, 0, 0), Color.OpaqueWhite, new Vector2Df(1,0))},
                new uint[] { 1, 0, 2, 1, 2, 3 });
            buff.RecalculateBoundingBox();
            Mesh mesh = Mesh.Create();
            mesh.AddMeshBuffer(buff);
            buff.Drop();
            mesh.RecalculateBoundingBox();
 
            sceneNode = Engine.device.SceneManager.AddMeshSceneNode(mesh, null, -1, position);
            sceneNode.SetMaterialTexture(0, Engine.device.VideoDriver.GetTexture("data/spritesheets/" + name + ".png"));
            sceneNode.SetMaterialFlag(MaterialFlag.Lighting, false);
            sceneNode.SetMaterialType(MaterialType.TransparentAlphaChannelRef);
            sceneNode.SetMaterialFlag(MaterialFlag.BilinearFilter, false);
            sceneNode.SetMaterialFlag(MaterialFlag.BackFaceCulling, false);
            sceneNode.AutomaticCulling = CullingType.Off;
How I can solve this problem?
Thank you. :)

EDIT: OpenGL Works properly... but I need it in DX9 :(

Re: Culling Problem

Posted: Mon May 19, 2014 12:39 pm
by Foaly
Maybe it's a Z-Buffer problem. If you draw the nodes on your own in the right order you could disable it.
Could you show more? How do you place the nodes?
How do you move the camera?
When the camera flies toward the nodes, maybe the near plane of your camera is too small / big. You could try to set it to a lower value.

Re: Culling Problem

Posted: Wed Mar 13, 2019 9:31 pm
by mnunesvsc
Nice iso, how do you configured the cam ?

Re: Culling Problem

Posted: Wed Mar 13, 2019 11:52 pm
by CuteAlien
This thread is 5 years old :-) And with sprites it's probably not an iso camera. Thought Irrlicht has some support for that. You can use buildProjectionMatrixOrthoLH and set the resulting matrix in the camera (ICamerScenenode:: setProjectionMatrix).