Mirrors with Irrlicht

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.
Post Reply
sandfisch
Posts: 3
Joined: Fri Aug 20, 2004 9:12 am

Mirrors with Irrlicht

Post by sandfisch »

Hi,

I got a question concerning mirrors in Irrlicht. I want to make mirrors for a car or a truck. How can I do this with Irrlicht? I've already got a little experience in using 3D-engines. I was using Crystal Space so far, but I'm trying to migrate to Irrlicht, since it is much more comfortable and Crystal Space seems to me as an ever growing monolith, where you get about 10 ways to do a thing and each release replaces 8 of these things by other ways. And last but not least, Irrlicht seems to have much better performance than CS has.
But back to my mirrors:
In CS the technique was to draw a polygon and make it a portal to that point in the world, where the mirror should face. Is this method similar to Irrlicht or are mirrors done totally different? Sadly I couldn't find any useful information in the API-documentation and even searching this forum didn't help me out.

Thanks in advance and greetings to all
sandfisch
Peter Müller
Posts: 292
Joined: Sun Mar 14, 2004 5:28 pm
Location: Germany
Contact:

Post by Peter Müller »

Portal rendering is (afaik) not directly supported by Irrlicht. But you can set a texture as render target (your mirror's texture), and change the camera into the mirror's looking direction (like you would see the scene if you were the mirror).
Than you render the scene (on the texture).

Now you switch back to the original camera and render the hole scene.
Finished.
http://www.games-forge.de - Die Community für Nachwuchsprogrammierer
knightoflight
Posts: 199
Joined: Sun Aug 24, 2003 5:47 pm
Location: Germany

Post by knightoflight »

How do you render to a texture in Irrlicht v0.6 ?
Peter Müller
Posts: 292
Joined: Sun Mar 14, 2004 5:28 pm
Location: Germany
Contact:

Post by Peter Müller »

knightoflight wrote:How do you render to a texture in Irrlicht v0.6 ?
i thougt this is implemented jet *g*
http://www.games-forge.de - Die Community für Nachwuchsprogrammierer
Midnight
Posts: 1772
Joined: Fri Jul 02, 2004 2:37 pm
Location: Wonderland

Post by Midnight »

In quake 3 atleast the engine you could do a mirror texture using a special type of texture. no idea how it works exactly though.

Only thing in Irrlicht I've seen as far as mirrors is the very poor reflection you witness in the meshviewer demo.

The only problem with Irrlicht is that it's still very new and alot of things have not even been finished or fixed let alone implamented.

Anyways mostly I had a question about what you wanted this feature for.

I know in quake 3 when a "true" mirrored texture was placed EVERYTHING that texture could "see" was drawn just like the rest of the world. effectivly doubling all poly within visability of the texture. inorder for this to work with a multiplayer map for example without causing lag or slow down was to keep it in a confined space like for example a bathroom mirror.

I just thought I would mention this to anyone that cares because using mirrors could potentially cause increased system resource nessasity. especially if they were used in a model like truck mirrors and were placed throughout an entire level outdoors.

Good Luck
sandfisch
Posts: 3
Joined: Fri Aug 20, 2004 9:12 am

Post by sandfisch »

Thanks a lot for your replies.
Anyways mostly I had a question about what you wanted this feature for.
I'm developing a driving simulator for trucks and unfortunately these vehicles carry at least three mirrors: one on the left, one on the right and one above the right door, through which you can see the distance to the roadborders.
I will try your proposals and give you all feedback, which one was best fitting for this kind of problem. But it could take a while, since I have to migrate the ready parts from Crystal Space to Irrlicht and I also don't have much time.

Anyways, I'm very thankful for each and every comment or proposal on this topic.

Greets
sandfisch
Peter Müller
Posts: 292
Joined: Sun Mar 14, 2004 5:28 pm
Location: Germany
Contact:

Post by Peter Müller »

Midnight wrote:Anyways mostly I had a question about what you wanted this feature for.
Because it looks good, it's an eyecandy
http://www.games-forge.de - Die Community für Nachwuchsprogrammierer
bal
Posts: 829
Joined: Fri Jun 18, 2004 5:19 pm
Location: Geluwe, Belgium

Post by bal »

Peter Müller wrote:
Midnight wrote:Anyways mostly I had a question about what you wanted this feature for.
Because it looks good, it's an eyecandy
Indeed, why does everyone wants shaders? Same.
General Tools List
General FAQ
System: AMD Barton 2600+, 512MB, 9600XT 256MB, WinXP + FC3
Midnight
Posts: 1772
Joined: Fri Jul 02, 2004 2:37 pm
Location: Wonderland

Post by Midnight »

duh.. the reason I said that was because for example.

lets say I build a FPS with a truck on a multiplayer map.

lets say this truck had 3 mirrors and there was 5 trucks throughout the level... hell lets even go as far to say that some of these trucks mirrors could see each other...that would cause one hell of a problem...

I know WHY he wants mirrors...I wanted to know WHAT he wanted them for.

Do you know what a hall of mirrors effect can do to your computer?

I am the only person in the world that has a set of mirror textures for return to castle wolfenstien...I know what I'm talking about here.
----------------------------------------------------------

However 3 mirrors that can not see each other on a single player game potentially low poly truck model should be fine and dandy at most your only doubling the visable poly 3 times with a total of 4 drawn models.... if he keeps it all low poly it won't even warm up my graphics card.

here is an example...the game X2 the threat...you can have 6 screens visable through the game so each one could be drawing from a different ship in a different system (space game) you can also speed up time.

when I have only 2 windows open and time as fast as it will go my graphics card can handle the textures fine and dandy but it heats up rapidly because of all the extra poly...and thats in the same system.

even if you only have 2 cameras which esentially a mirror is another camera you'll notice that your computer has to draw everything EACH camera (or mirror) can see...more poly...potentially double or more...not good for most situations.

poop I havent even talked about what those mirrors potentially draw...better yet what they potentially see...do you know what occluders are? have you set them up to work with mirrored textures?

this subject should not be taken lightly mirrors are not as easy as they might seem...why do you think there are no mirrors in any of todays modern FPS'ers ??

----------------------------------

not to mention the TYPE of mirror for the right situation... a true camera might have the abiliy for you to adjust the mirrors view (like a trucks rear view mirror) however a texture alone could not achieve this.

for what he wants I would do it the third way...have another view all together for the rear view like most racing games...it then could have the ability to be "turned off" or set invisable like any GUI Element giving you the option to use it or not and possably using it as an advanced graphics option for faster systems....I mean what good is a rear view mirror that only see's the front of a trailer for example..assuming it's a semitruck.
Peter Müller
Posts: 292
Joined: Sun Mar 14, 2004 5:28 pm
Location: Germany
Contact:

Post by Peter Müller »

Sure, if you use mirrors wrong, they can kill your performance. But if you clip them if they are too small or too far away, it's ok.
http://www.games-forge.de - Die Community für Nachwuchsprogrammierer
l0calh05t
Posts: 68
Joined: Wed Apr 07, 2004 7:08 pm

Post by l0calh05t »

Peter Müller wrote:Sure, if you use mirrors wrong, they can kill your performance. But if you clip them if they are too small or too far away, it's ok.
Or, if implemented using portals you could simply count the number of times the same mirror may be reflected.
Midnight wrote:[...]
this subject should not be taken lightly mirrors are not as easy as they might seem...why do you think there are no mirrors in any of todays modern FPS'ers ??
That's simply not true, most modern portal based games support (and use) mirrors (doom 3 has a few)
Raw data for raw nerves

My main PC: Athlon XP 2800+, 512MB RAM, ATI Radeon 9700 Pro 128MB, Win2k SP4
My secondary PC: Pentium III 500 Mhz, 256MB RAM, TNT2 64, Gentoo Linux
Visitor

An idea.....

Post by Visitor »

Hi,

I have not programmed with the irrlicht engine... but what about using "mini-cameras".
each number stands for a camera view as you would see it on the screen:

111111111111111111111111111111111111111111
1 1
122222 333331
12 2 3 31
12 2 3 31
122222 333331
144444 555551
14 4 5 51
144444 555551
1 1
111111111111111111111111111111111111111111

Does that make sense? :?
Peter Müller
Posts: 292
Joined: Sun Mar 14, 2004 5:28 pm
Location: Germany
Contact:

Post by Peter Müller »

I don't really know that you want to tell us.
http://www.games-forge.de - Die Community für Nachwuchsprogrammierer
sandfisch
Posts: 3
Joined: Fri Aug 20, 2004 9:12 am

Post by sandfisch »

Midnight wrote:
not to mention the TYPE of mirror for the right situation... a true camera might have the abiliy for you to adjust the mirrors view (like a trucks rear view mirror) however a texture alone could not achieve this.

for what he wants I would do it the third way...have another view all together for the rear view like most racing games...it then could have the ability to be "turned off" or set invisable like any GUI Element giving you the option to use it or not and possably using it as an advanced graphics option for faster systems....I mean what good is a rear view mirror that only see's the front of a trailer for example..assuming it's a semitruck.
The mirrors of a truck are on the outside, because on the inside you would just see the back of your drivercabin. Since this is developed for educational purposes, it would be very nice indeed if the mirrors where movable, so that you can adjust them for your purpose. The bigger the realism the better is the educational effect because the student feels more like in a real truck. That's why I want to make real mirrors, which are correctly attached to the side of the truck and just can be viewed when the head is turned.
Therefore I think that I will take a shot at that cameraaproach and hope that I can get the picture of the camera in the right place (the mirror mesh)
NovaCoder
Posts: 28
Joined: Wed May 26, 2004 11:36 am
Contact:

Post by NovaCoder »

Yep portals would be the best way to go for mirrors.

Out of interest, how for is this Engine from doing this with portals? In otherwords can this Engine do anything with portals, are they even used internally?

Thanks
- Nova
Post Reply