free compiler with lightmaps?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
ZDimitor
Posts: 202
Joined: Fri Jul 16, 2004 3:27 am
Location: Russia

Post by ZDimitor »

Here you go!
It take not more than a half hour, and here is my new implementation of MeshLoader (Irr.0.6), example and test scene (ss you have seen).

http://zdimitor.nm.ru/MY3DExample.zip

Have fun :lol: .....
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

whoa, great!

I got your source to compile ok. I also created my own 3d format. Your plugin exports ok, but I couldn't use the loader for Irrlicht. Let's see if your example makes things easier!!

many thnx for your help!
Image
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

Just ran your example, amazing!!! Beautigul lightmaps, congrats for the job.

I'll use your bin version of the dle to get things running and try to load my own model with lightmaps.

ps. Have you tried collision with your model format?

cheers, and thnx!
Image
ZDimitor
Posts: 202
Joined: Fri Jul 16, 2004 3:27 am
Location: Russia

Post by ZDimitor »

Collision works fine (just like with Q3 BSP). I have not problems with it.

But as i told many things has to be done, to be able export from MAX (lights, transparent materials, animation!!!! e.t.c).

Its possible create in max transparent stuff (like portals, flame or other) an then get them into Irrlicht.
etcaptor
Posts: 871
Joined: Fri Apr 09, 2004 10:32 pm
Location: Valhalla
Contact:

Post by etcaptor »

Great!!!
keep your good working.
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

works like a charm. Even with Irr0.7 and VC7. I got a question though, what's the Ilogger for?

I made some changes to your main.cpp file:

Code: Select all

        #include <irrlicht.h>
	#include <stdio.h>
	#include <windows.h> 
	#include "CMY3DMeshFileLoader.h"	
	
	using namespace irr;
	using namespace irr;	
	using namespace core;
	using namespace scene;
	using namespace video;
	using namespace io;
	using namespace gui;
	
	#pragma comment(lib, "Irrlicht.lib")
	
	ILogger* logger=NULL;

//-----------------------------------------------------------------------------------------------//	
	int main()
	{
	    IrrlichtDevice *device =
	   createDevice(video::EDT_DIRECTX9, core::dimension2d<s32>(640, 480),false,false,false,0);
	
	    video::IVideoDriver* driver = device->getVideoDriver();
	    scene::ISceneManager* smgr = device->getSceneManager();
	    io::IFileSystem *fs = device->getFileSystem();
	    logger = device->getLogger();

//-----------------------------------------------------------------------------------------------//	
    scene::IMeshLoader *my3dloader = new scene::CMY3DMeshFileLoader(fs,driver);
    smgr->addExternalMeshLoader(my3dloader);

    scene::IAnimatedMesh* mesh = smgr->getMesh("test/test.my3d");
    scene::ISceneNode* node = 0;

    if (mesh)
        node = smgr->addOctTreeSceneNode(mesh->getMesh(0));
//-----------------------------------------------------------------------------------------------//	
	//wasd navigation
	SKeyMap keyMap[8];

	keyMap[1].Action = EKA_MOVE_FORWARD;
	keyMap[1].KeyCode = KEY_KEY_W;

	keyMap[3].Action = EKA_MOVE_BACKWARD;
	keyMap[3].KeyCode = KEY_KEY_S;

	keyMap[5].Action = EKA_STRAFE_LEFT;
	keyMap[5].KeyCode = KEY_KEY_A;

	keyMap[7].Action = EKA_STRAFE_RIGHT;
	keyMap[7].KeyCode = KEY_KEY_D;

//-----------------------------------------------------------------------------------------------//    
    scene::ICameraSceneNode* camera = 0; 
    camera = smgr->addCameraSceneNodeFPS(0,80.0f,300.0f,-1, keyMap, 8); //1st value= obligatory 0-2nd value= mouse sensitivity-3rd value handles cam speed
	 camera->setPosition(core::vector3df(-150,70,-70)); //1st=pos in x-2nd value= spawn height-3rd=pos in y
	 camera->setFarValue (  50000.0f  ) ; //sets the distance for the clipping plane, the bigger the farther
	 camera->setFOV(1.1f); // a value of 0.5 makes it look alienish
	 camera->setTarget( core::vector3df(-150,70,0)); //target camera position-3rd value negative =90, positive=0 -1st value (-) rotates camera
	 camera->setRotation(core::vector3df(0,90,0)); //rotate the camera x,y,z degrees
//-----------------------------------------------------------------------------------------------//
    device->getCursorControl()->setVisible(false);
//-----------------------------------------------------------------------------------------------//	
    int lastFPS = -1;

    while(device->run())
    {
        driver->beginScene(true, true, video::SColor(0,0,0,0));
        smgr->drawAll();
        driver->endScene();

        int fps = driver->getFPS();

        if (lastFPS != fps)
        {
            wchar_t tmp[1024];
            swprintf(tmp, 1024, L"MY3D Mesh Loader Example - Irrlicht Engine v.0.7 (fps:%d) Triangles:%d", 
                fps, driver->getPrimitiveCountDrawn());

            device->setWindowCaption(tmp);
            lastFPS = fps;
        }
    }
    device->drop();    
    return 0;
}

better said, I added some stuff (the usual stuff I use) and separated the code into parts.

great work. This option as a lightmapper was completely unexpected! Tomorrow I'll have fun with this!!!

cheers!
ps. I created it as a new project in Relo and linked everything to the 0.7 source and evrything is working fine. Very good job.
Last edited by afecelis on Wed Sep 15, 2004 3:30 am, edited 1 time in total.
Image
ZDimitor
Posts: 202
Joined: Fri Jul 16, 2004 3:27 am
Location: Russia

Post by ZDimitor »

One last thing:

MAX creating cool lighting maps, but..... not all shadows info included in it (you'll see that some shadows messed up).
MAX creating cool shadowmap textures, but.... not all lighting info included in it.

What we have to do in that case???

Simple!!!!

In MAX/images after rendering into (lightingmaps and shadowmaps) textures we have *LightingMap.tga and *ShadowMap.tga.

And to get best quality lightingmaps we have to do this:

*LightingMap.tga + *ShadowMap.tga -> *LightingMap.tga( super quality lighting maps with cool shadows)

You can do this in Photoshop,
or write you own convertion utility, which allowed you merge two images into one.

The formula you needed for that:
(R1,G1,B1,A1) - pixel color in the 1st map (lightings);
(R2,G2,B2,A2) - pixel color in the 2st map (shadows);
(Rc, Gc, Bc, Ac) - - pixel color in the complex map (lighting+shadows);

Rc = R1*R2/255; Gc = G1*G2/255; Bc = B1*B2/255; Ac = A1*A2/255;

Its a last step :wink:

--------------------------------------------------------------------------------
@LordTrancos: Why did you sayd that it will be last version of LMTools???
Last edited by ZDimitor on Wed Sep 15, 2004 3:30 am, edited 4 times in total.
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

oh yes, and the obligatory screenie!

Image

nice nice.
Image
ZDimitor
Posts: 202
Joined: Fri Jul 16, 2004 3:27 am
Location: Russia

Post by ZDimitor »

afecelis wrote:.... I got a question thought, what's the Ilogger for?
Its needed in file CMY3DMeshFileLoader.cpp to get access to the console logging.
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

Thnx for the explanation. Please keep us informed of any updates.

you just gave the Irrlicht community a great tool.
Image
Captain_Kill
Posts: 124
Joined: Sun Jun 27, 2004 11:02 am
Contact:

Post by Captain_Kill »

ZDimitor: Awesome work :D I'm no artist but I can appreciate the programming :lol: I got a potentially better solution to that problem you mentioned... Instead of combining 2 images, why not just load them both? ;) It's definatly possible and would be a cool addition to Irrlicht. Actually... I think Irrlicht can already load multiple images per mesh... Isn't that done in the SpecialFX demo?
2.8GHz P4 with HT - 512MB DDR - ATI Radeon 9600XT 256MB - Windows XP - VC++ 6 and VC++ 2003

Dark Reign 3 Home Page: http://darkreign3.notwhatyouthink.org/
Dark Reign 3 Forums: http://notwhatyouthink.org/darkreign3bb/
ZDimitor
Posts: 202
Joined: Fri Jul 16, 2004 3:27 am
Location: Russia

Post by ZDimitor »

More textures - more time to load them.
And explain me how you be able to render 3rd texture unit?
1st - main texture;
2nd - lightings;
3rd - shadows;
vermeer
Posts: 2017
Joined: Wed Jan 21, 2004 3:22 pm
Contact:

Post by vermeer »

looks like merging em in adobe ps or gimp would rather easy, if is actually possible is seconds for any artist....


congrats
Finally making games again!
http://www.konekogames.com
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

ZDimitor wrote:Here you go!
It take not more than a half hour, and here is my new implementation of MeshLoader (Irr.0.6), example and test scene (ss you have seen).

http://zdimitor.nm.ru/MY3DExample.zip

Have fun :lol: .....
Well, I'm very interested in your example, but this link doesn't seem to work (for me)... :cry:
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
ZDimitor
Posts: 202
Joined: Fri Jul 16, 2004 3:27 am
Location: Russia

Post by ZDimitor »

@Acki: Give me you mail, i'll sent it you tomorrow.
Post Reply