Yes it should....zillion42 wrote:shader+light
and since I'm quite convinced that this is the actual problem, I'm asking again:
Shouldn't this be considered a bug ?
Normal and parallax maps not responding to lighting
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
In an attempt to understand an reproduce the problem in a clear manor I edited example 11 down to the basics...
- OPENGL
1 static Light
EMT_NORMAL_MAP_SOLID
and rotation
Code: Select all
#include <irrlicht.h>
#include <iostream>
using namespace irr;
#pragma comment(lib, "Irrlicht.lib")
IrrlichtDevice* device = 0;
bool UseHighLevelShaders = true;
scene::ICameraSceneNode* camera;
scene::ISceneNode* light2;
/*
Now for the real fun. We create an Irrlicht Device and start to setup the scene.
*/
int main()
{
// let user select driver type
video::E_DRIVER_TYPE driverType = video::EDT_OPENGL;
// create device
//IrrlichtDevice*
device = createDevice(driverType, core::dimension2d<u32>(800, 600));
if (device == 0)
return 1; // could not create selected driver.
video::IVideoDriver* driver = device->getVideoDriver();
scene::ISceneManager* smgr = device->getSceneManager();
gui::IGUIEnvironment* env = device->getGUIEnvironment();
driver->setTextureCreationFlag(video::ETCF_ALWAYS_32_BIT, true);
// add irrlicht logo
env->addImage(driver->getTexture("../../media/irrlichtlogo2.png"),
core::position2d<s32>(10,10));
// add camera
//scene::ICameraSceneNode* camera =
camera = smgr->addCameraSceneNodeFPS(0,100.0f,0.1f);
camera->setPosition(core::vector3df(-270,200,-200));
// disable mouse cursor
device->getCursorControl()->setVisible(false);
driver->setFog(video::SColor(0,138,125,81), true, 250, 1000, 0, true);
scene::IAnimatedMesh* roomMesh = smgr->getMesh(
"../../media/room.3ds");
scene::ISceneNode* room = 0;
if (roomMesh)
{
smgr->getMeshManipulator()->makePlanarTextureMapping(
roomMesh->getMesh(0), 0.003f);
video::ITexture* colorMap = driver->getTexture("../../media/rockwall.bmp");
video::ITexture* normalMap = driver->getTexture("../../media/rockwall_normalmap.bmp");
driver->makeNormalMapTexture(normalMap, 9.0f);
scene::IMesh* tangentMesh = smgr->getMeshManipulator()->createMeshWithTangents(
roomMesh->getMesh(0));
room = smgr->addMeshSceneNode(tangentMesh);
room->setMaterialTexture(0, colorMap);
room->setMaterialTexture(1, normalMap);
//room->getMaterial(0).setTexture(0, colorMap);
//room->getMaterial(0).setTexture(1, normalMap2);
room->getMaterial(0).SpecularColor.set(0,0,0,0);
room->setMaterialFlag(video::EMF_FOG_ENABLE, true);
room->setMaterialType(video::EMT_NORMAL_MAP_SOLID);
// drop mesh because we created it with a create.. call.
tangentMesh->drop();
}
// add earth sphere
scene::IAnimatedMesh* earthMesh = smgr->getMesh("../../media/earth.x");
if (earthMesh)
{
//perform various task with the mesh manipulator
scene::IMeshManipulator *manipulator = smgr->getMeshManipulator();
// create mesh copy with tangent informations from original earth.x mesh
scene::IMesh* tangentSphereMesh =
manipulator->createMeshWithTangents(earthMesh->getMesh(0));
// scale the mesh by factor 50
core::matrix4 m;
m.setScale ( core::vector3df(50,50,50) );
manipulator->transformMesh( tangentSphereMesh, m );
scene::ISceneNode *sphere = smgr->addMeshSceneNode(tangentSphereMesh);
sphere->setPosition(core::vector3df(-70,130,45));
// load heightmap, create normal map from it and set it
video::ITexture* earthNormalMap = driver->getTexture("../../media/earthbump.bmp");
driver->makeNormalMapTexture(earthNormalMap, 20.0f);
sphere->setMaterialTexture(1, earthNormalMap);
// adjust material settings
sphere->setMaterialFlag(video::EMF_FOG_ENABLE, true);
sphere->setMaterialType(video::EMT_NORMAL_MAP_SOLID);
// add rotation animator
scene::ISceneNodeAnimator* anim =
smgr->createRotationAnimator(core::vector3df(0,0.8f,0));
sphere->addAnimator(anim);
anim->drop();
// drop mesh because we created it with a create.. call.
tangentSphereMesh->drop();
}
// add light 1 (nearly red)
scene::ILightSceneNode* light1 =
smgr->addLightSceneNode(0, core::vector3df(50,190,0),
video::SColorf(1.0f, 1.0f, 1.0f, 0.0f), 800.0f);
// attach billboard to the light
scene::ISceneNode* bill =
smgr->addBillboardSceneNode(light1, core::dimension2d<f32>(60, 60));
bill->setMaterialFlag(video::EMF_LIGHTING, false);
bill->setMaterialFlag(video::EMF_ZWRITE_ENABLE, false);
bill->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
bill->setMaterialTexture(0, driver->getTexture("../../media/particlered.bmp"));
/*
Finally, draw everything. That's it.
*/
int lastFPS = -1;
while(device->run())
if (device->isWindowActive())
{
driver->beginScene(true, true, 0);
smgr->drawAll();
env->drawAll();
driver->endScene();
int fps = driver->getFPS();
if (lastFPS != fps)
{
core::stringw str = L"Per pixel lighting example - Irrlicht Engine [";
str += driver->getName();
str += "] FPS:";
str += fps;
device->setWindowCaption(str.c_str());
lastFPS = fps;
}
}
device->drop();
return 0;
}
well sorry then, maybe if confirmed I can move it to the bugs section.
Not really sure what made you think I was talking about directional lights before, nor do I really understand what you mean with 'sun light' ... but, whatever, it's more or less like the title says, "Normal and parallax maps not responding to lighting" except that I mean normal maps in GL only... cant change the title because I didn't start the thread, seemed to fit my problem though.
EDIT: re-read my posts and came to the conclusion that you must have thought directional-light, whereas I was writing direction of light... and it looks like it does react to the direction of light, just seems wrong the way it does it...
EDIT2:
didn't know that... maybe I should give it a try...
|
\/
Not really sure what made you think I was talking about directional lights before, nor do I really understand what you mean with 'sun light' ... but, whatever, it's more or less like the title says, "Normal and parallax maps not responding to lighting" except that I mean normal maps in GL only... cant change the title because I didn't start the thread, seemed to fit my problem though.
EDIT: re-read my posts and came to the conclusion that you must have thought directional-light, whereas I was writing direction of light... and it looks like it does react to the direction of light, just seems wrong the way it does it...
EDIT2:
didn't know that... maybe I should give it a try...
|
\/
Last edited by zillion42 on Thu Mar 12, 2009 9:34 am, edited 1 time in total.
found another thread...
http://irrlicht.sourceforge.net/phpBB2/ ... ght=planet
and another one:
http://irrlicht.sourceforge.net/phpBB2/ ... ght=planet
and another one:
http://irrlicht.sourceforge.net/phpBB2/ ... ght=planet
http://irrlicht.sourceforge.net/phpBB2/ ... ght=planet
and another one:
http://irrlicht.sourceforge.net/phpBB2/ ... ght=planet
and another one:
http://irrlicht.sourceforge.net/phpBB2/ ... ght=planet
-
- Posts: 45
- Joined: Thu Apr 24, 2008 7:54 pm
- Location: Wickede, Germany
I've also some problems like mentioned in this thread:
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=32025
Not solved so far.
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=32025
Not solved so far.
i wish i could say bump, but then again i feel sorry for those able to fix it, cause I'm not...
shader guys, improve tutorial 11 opengl, it's for all of us, a real community thing... i certainly wasn't the first to see its faulty (look at the threads)... it simply is...please... thx... and it should...
shader guys, improve tutorial 11 opengl, it's for all of us, a real community thing... i certainly wasn't the first to see its faulty (look at the threads)... it simply is...please... thx... and it should...
back in the days...
-
- Posts: 1691
- Joined: Sun May 18, 2008 9:42 pm
d3d9
Will the emissive, specular, and ambient colors work with D3D9?
That would be illogical captain...
My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar