Normalmap-Sphere disappears

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
radical-dev
Posts: 45
Joined: Thu Apr 24, 2008 7:54 pm
Location: Wickede, Germany

Normalmap-Sphere disappears

Post by radical-dev »

Hi all!

I got a problem on displaying a sphere with EMT_NORMAL_MAP_SOLID. Let me explain:

If i render only the sphere, the sphere is rendered correctly.

But if i add another Scenenode (could be also out of the Screen) the Spheremesh gets black (i made no changes at the light-scenenode). This also happens, if i draw a background image with driver->draw2DImage().

I can't get it (tested above 4 hours yesterday).

Here's some Pseudocode (i've forgotten my USB-Stick and i'm at work):

Code: Select all

1. Load all needed Textures
2. MakeNormalMapTexture on the Heightmap
3. Add Sphere-Mesh (makes no difference if i load a mesh (tested ms3d/3ds/b3d) or create one via addSphereMesh)
4. Create Mesh-Copy with tangents (manipulator->createMeshWithTangents())
5. Create Node from TangentMesh via addMeshSceneNode/addAnimatedMeshSceneNode
6. Set Textures & Materialsettings (EMF_LIGHTING:true / EMT_NORMAL_MAP_SOLID)
7. Drop Tangentmesh
8. Add Rotation-Animation to the Node
9. Add LightSceneNode
10. Add CameraSceneNode
11. Draw-Loop: clear Screen(color: black) / SceneManager->drawAll()
So long, so good. This part renders without any Problems.

But if a for example add a CubeSceneNode with a size of 0.01f at Position vector3df(1000.0f,1000.0f,1000.0f) (completely out of the scene) the Sphere turns black ?!?

How mentioned above this also happens if i draw a background image.

This problem occurs at both renderers (OGL / D3D9) i wish to use.

Any suggestions? I'm absolutely weird of this :roll:
Last edited by radical-dev on Fri Jan 23, 2009 7:33 am, edited 2 times in total.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Sounds strange, because it's exactly what happens in example 11, and it's working there. So maybe try to change that example in a way that reproduces your problem, otherwise it's morelikely to be in your code.
radical-dev
Posts: 45
Joined: Thu Apr 24, 2008 7:54 pm
Location: Wickede, Germany

Post by radical-dev »

Hrm...i'll give it a try at evening.

Otherwise i'll post the source tomorrow. The strangest on it is the dissapperaing if i draw a background-image before the scene. No idea atm o_O
radical-dev
Posts: 45
Joined: Thu Apr 24, 2008 7:54 pm
Location: Wickede, Germany

Post by radical-dev »

So...after some several testing i solved the problem. I moved the light a little bit away and added a second light. Now it's very bright, but this should be a little problem ;-) .

Nevertheless my OpenGL-Radeon-Driver seems to be broken. On example 11 i got strange artifacts at parallax- and normal-mapping. With nvidia-drivers at ogl and with EDT_DIRECT3D9 i got no problems.

Radeon HD 4850 / Catalyst 8.11 - uses OGL 2.1.something ;-)

Updating today to 8.12 and i'll see if this solves it.
radical-dev
Posts: 45
Joined: Thu Apr 24, 2008 7:54 pm
Location: Wickede, Germany

Post by radical-dev »

So...tested with Catalyst 8.12 - didn't solve the problem.

Here are 2 images to show u what happens:

Example11:
Image

Irrlicht-Log:
Image

I'm using a ATI Radeon HD 4850 with Driver-Version 8.561.0.0.
Today i'll test it with Irrlicht 1.4.2 - but as far as i remember there was no error like this (started my project with 1.4).

Here's some source:

Code: Select all

/* <CMainMenu->Init()> */
void CMainMenu::Init( void )
{
	// Lokale Variablen
	string<c8>				Buffer;				// String-Puffer
	string<c8>				TexturePath;	// Pfad zu den passenden Texturen
	
	// Irrlicht-Pointer holen und speichern
	m_IrrDevicePtr = CGameManager::GetIrrDevice();
	m_IrrDriver = m_IrrDevicePtr->getVideoDriver();
	m_IrrSceneManager = m_IrrDevicePtr->getSceneManager();
	m_IrrGUIEnv = m_IrrDevicePtr->getGUIEnvironment();
	m_IrrTimer = m_IrrDevicePtr->getTimer();
	
	// CEGUI-Scheme laden
	SchemeManager::getSingleton().loadScheme(MAINMENU_SCHEME);
	
	// CEGUI-Root erstellen, Menülayout laden und dem Root zuweisen
	m_MenuLayout = WindowManager::getSingleton().loadWindowLayout("MainMenu.layout");
	CGameManager::GetCEGUISystem()->setGUISheet(m_MenuLayout);
	
	// Aktuelle Gameconfig holen
	m_GameConfig = CGameManager::GetInstance()->GetGameConfig();
	
	// Bildschirmauflösung speichern
	m_ScreenSize = m_IrrDriver->getScreenSize();
	
	// Passenden Texturpfad setzen
	TexturePath = GAME_TEXTURE_PATH;
	switch (m_GameConfig->TextureQuality)
	{
		// Niedrige Texturauflösung
		case TEXQUALITY_LOW:
		{
			TexturePath.append("Lowres/");
		}
		break;
		
		// Mittlere Texturauflösung
		case TEXQUALITY_MID:
		{
			TexturePath.append("Midres/");
		}
		break;
		
		// Niedrige Texturauflösung
		case TEXQUALITY_HIGH:
		{
			TexturePath.append("Hires/");
		}
		break;
	}
	
	// Immer 32-Bit-Texturen erstellen
	m_IrrDriver->setTextureCreationFlag(ETCF_ALWAYS_32_BIT, true);
	
	// Hintergrund-Textur laden
	m_BackgroundTexture = m_IrrDriver->getTexture("data/textures/StarBackground1.png");
	
	// Kamera erstellen
	m_SceneCamera = m_IrrSceneManager->addCameraSceneNode();
	m_SceneCamera->setAspectRatio((5.0f/4.0f));
	m_SceneCamera->setFOV(PI/6);
	
	// Prüfen, ob Bumpmapping eingestellt ist
	if (m_GameConfig->BumpMapping)
	{
		// Ja: Bumpmappingunterstützung abfragen
		IMaterialRenderer*	renderer;
		
		renderer = m_IrrDriver->getMaterialRenderer(EMT_NORMAL_MAP_SOLID);
		if (renderer && renderer->getRenderCapability() == 0)
		{
			m_EarthMaterial = EMT_NORMAL_MAP_SOLID;
		}
		else
		{
			// Keine Bumpmap-Unterstützung
			m_EarthMaterial = EMT_SOLID;
			// Gameconfig aktualisieren
			m_GameConfig->BumpMapping = false;
			CGameManager::GetInstance()->SetGameConfig(m_GameConfig);
		}
	}
		
	// Earth-Texturen laden
	// Textur 1 - ColorMap | Textur 2 - HeightMap | Textur 3 - CloudMap
	Buffer = TexturePath;
	Buffer.append(MAINMENU_SPHERE_SURFACE);
	m_EarthTexture[0] =	m_IrrDriver->getTexture(Buffer.c_str());
	Buffer = TexturePath;
	// Heightmap nur laden, wenn Bumpmapping unterstützt wird
	if (m_GameConfig->BumpMapping)
	{
		Buffer.append(MAINMENU_SPHERE_HEIGHT);
		m_EarthTexture[1] =	m_IrrDriver->getTexture(Buffer.c_str());
		m_IrrDriver->makeNormalMapTexture(m_EarthTexture[1], 9.0f);
	}
	Buffer = TexturePath;
	Buffer.append(MAINMENU_SPHERE_CLOUDS);
	m_EarthTexture[2] =	m_IrrDriver->getTexture(Buffer.c_str());
	
	// Star Tycoon-Logo laden
	m_LogoNode = m_IrrSceneManager->addMeshSceneNode(m_IrrSceneManager->getMesh("data/meshes/STLogo.b3d"));
	m_LogoNode->setPosition(vector3df(0,2.25f,10.5f));
	m_LogoNode->setMaterialType(EMT_SOLID);
	m_LogoNode->setMaterialFlag(EMF_LIGHTING, false);
	
	// Earth-Sphere laden und auf Position setzen
	IAnimatedMesh* SphereMesh = m_IrrSceneManager->getMesh("data/meshes/sphere.b3d");
	IMesh* TangentMesh = m_IrrSceneManager->getMeshManipulator()->createMeshWithTangents(SphereMesh);
	m_EarthNode = m_IrrSceneManager->addMeshSceneNode(TangentMesh, 0, -1, vector3df(-1.5f,0,3.5f));
	TangentMesh->drop();
	
	// Texturen und Materialtyp für Earth setzen
	m_EarthNode->setMaterialTexture(0, m_EarthTexture[0]);
	if (m_GameConfig->BumpMapping)
	{
		m_EarthNode->setMaterialTexture(1, m_EarthTexture[1]);
	}
	m_EarthNode->setMaterialType(m_EarthMaterial);
	m_EarthNode->setMaterialFlag(EMF_LIGHTING, true);
	m_EarthNode->getMaterial(0).SpecularColor = SColor(0,0,0,0);
	CGameManager::SetNodeTextureFilter(m_EarthNode);
	
	// Erde rotieren lassen
	ISceneNodeAnimator* anim = m_IrrSceneManager->createRotationAnimator(vector3df(0.0f,0.1f,0.0f));
	m_EarthNode->addAnimator(anim);
	anim->drop();
	
	// Cloud-Sphere erstellen
	m_CloudNode = m_IrrSceneManager->addSphereSceneNode(1.01f, 64, 0, -1,vector3df(-1.5f, 0, 3.5f));
	m_CloudNode->setMaterialTexture(0, m_EarthTexture[2]);
	m_CloudNode->setMaterialType(EMT_TRANSPARENT_ADD_COLOR);
	CGameManager::SetNodeTextureFilter(m_CloudNode);
	m_CloudNode->setMaterialFlag(EMF_LIGHTING, false);
	
	// Clouds rotieren lassen
	anim = m_IrrSceneManager->createRotationAnimator(vector3df(0.0f,0.05f,0.0f));
	m_CloudNode->addAnimator(anim);
	anim->drop();
	
	// Lichter erstellen
	m_IrrSceneManager->addLightSceneNode(0, vector3df(50.0f,0.0f,7.0f), SColorf(0.5f,0.5f,0.5f,0.5f), 100.0f);
	m_IrrSceneManager->addLightSceneNode(0, vector3df(50.0f,0.0f,0.0f), SColorf(0.5f,0.5f,0.5f,0.5f), 100.0f);
	
	return;
}
/* </CMainMenu->Init()> */

/* <CMainMenu->Cleanup()> */
void CMainMenu::Cleanup( void )
{
	// Alle Scene-Objekte freigeben
	m_IrrSceneManager->clear();
	
	// Alle Texturen freigeben
	m_IrrDriver->removeAllTextures();
	
	// Scheme wieder freigeben
	SchemeManager::getSingleton().unloadAllSchemes();
	
	return;
}
/* </CMainMenu->Cleanup()> */


/* <CMainMenu->Update()> */
void CMainMenu::Update( void )
{
	return;
}
/* </CMainMenu->Update()> */


/* <CMainMenu->Draw()> */
void CMainMenu::Draw( void )
{
	// Ist das Spiel aktiv?
	if (CGameManager::GetInstance()->IsActive())
	{
		// Ja: Bildschirm schwarz löschen und alles rendern
		m_IrrDriver->beginScene(true, true, SColor(255,0,0,0));
			m_IrrDriver->draw2DImage(	m_BackgroundTexture, rect<s32>(0,0,m_ScreenSize.Width-1, m_ScreenSize.Height-1),
																rect<s32>(0,0,1023,1023)	);
			m_IrrSceneManager->drawAll();
			CEGUI::System::getSingleton().renderGUI();
		m_IrrDriver->endScene();
	}

	return;
}
/* </CMainMenu->Draw()> */
Probably there's a bug in 1.5-OpenGL-Driver? Was there made any changes to the driver?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

There had been many changes to the OpenGL driver, as well as to oher parts of the engine. However, this one looks really weird.
radical-dev
Posts: 45
Joined: Thu Apr 24, 2008 7:54 pm
Location: Wickede, Germany

Post by radical-dev »

Hrm...could be also a problem with the catalyst...i dunno.

I'll test Example11 at 1.4.2 and post the results.
Dark_Kilauea
Posts: 368
Joined: Tue Aug 21, 2007 1:43 am
Location: The Middle of Nowhere

Post by Dark_Kilauea »

Make sure your drivers are completely up to date. I used to have hardware mipmapping problems with Ogre3D until I updated mine.
rogerborg wrote:Every time someone learns to use a debugger, an angel gets their wings.
radical-dev
Posts: 45
Joined: Thu Apr 24, 2008 7:54 pm
Location: Wickede, Germany

Post by radical-dev »

Hi all!

I don't get it. At first, here is my compiled project with D3D & OGL:

http://rapidshare.com/files/188807282/S ... e.rar.html



Then some pictures:

Direct3D9 @ Irrlicht 1.5:
Image

Direct3D9 @ Irrlicht 1.4.2:
Image

OpenGL @ Irrlicht 1.5:
Image

OpenGL @ Irrlicht 1.4.2:
Image

All images were made with the same source, but as u can see there are many differences.

OpenGL-Driver at Irrlicht 1.5 got the strangest results, at 1.4.2 the Normalmap-Rendering is ok, but the cloudsphere disappears :roll:

If someone needs the complete source, i'll send it via email.

P.S. I've the newest Catalyst installed
P.P.S. Example 11 from Irrlicht 1.4.2 runs without any problems
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Needs some more investigation. I'll move it to the bug forum.
radical-dev
Posts: 45
Joined: Thu Apr 24, 2008 7:54 pm
Location: Wickede, Germany

Post by radical-dev »

If u need the compete source, just pm me. Should be well commented for a german ;-).

P.S. Bin ab und an in Hooksiel Urlaub machen :D
radical-dev
Posts: 45
Joined: Thu Apr 24, 2008 7:54 pm
Location: Wickede, Germany

Post by radical-dev »

Hi again!

Tested my program on my company computer. With a Geforce 6800 GT the error also applies.

Any solutions so far? Does anyone has a look at this? Do you need the source?

Question over question :D

But this error stops me a little bit - i want to use this fine built-in materials excessive (have no real experience in programming own shaders). It makes no sense to go on if this error stays.

Greetings :)

EDIT: I don't wanna go back to 1.4.2 because of the lack of FSAA at OpenGL ;-)
EDIT2: Tested Example11 with the Geforce - runs without problems.
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Re: Normalmap-Sphere disappears

Post by robmar »

I have this exact bug on 1.7.3.

Seems that first sphere works as expected, but second sphere texture is not handled correctly.

adding another sphere and the bad render moves to the last rendered sphere...
Post Reply