Display _very far_ objects

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
gbrinon
Posts: 11
Joined: Tue May 19, 2009 3:02 pm

Display _very far_ objects

Post by gbrinon »

Hi,

I have a question, i suppose it's not specific to irrlicht, but i'am working with it so...

I try to display a large space. If and object is near the player's ship, i display it. But if something is very far, i want to display a little sign. (just as eve online do http://linuxoutlaws.com/files/eve-online.jpg )

I thought i had to use LOD but the sign must always have the same size however the distance between the object and the ship.

How can I do such a thing ?

P.S : Sorry for my English (I'm french)
Guillaume ... hopes HEMERA project will be finished before world's end ;)
FuzzYspo0N
Posts: 914
Joined: Fri Aug 03, 2007 12:43 pm
Location: South Africa
Contact:

Post by FuzzYspo0N »

These little icons are generally done in 2d, there is a function in the collision manager to get a screen coordinate from a 3d position, just draw an icon at the position in 2d, and fade its alpha in based on a distance factor
gbrinon
Posts: 11
Joined: Tue May 19, 2009 3:02 pm

Post by gbrinon »

:oops: .... good idea, i should have thought to that :oops:

I'll try to find this function.

If i don't want to display the objects whitch are too far (in order to replace them with the 2d image), i use the LOD ?

Thanks a lot :)
Guillaume ... hopes HEMERA project will be finished before world's end ;)
Lonesome Ducky
Competition winner
Posts: 1123
Joined: Sun Jun 10, 2007 11:14 pm

Post by Lonesome Ducky »

Also, if you have a lot of objects you may want to think about calculating the distance every 100 ms or so instead of every frame, as sqrt() isn't exactly the fastest function.
Halifax
Posts: 1424
Joined: Sun Apr 29, 2007 10:40 pm
Location: $9D95

Post by Halifax »

Lonesome Ducky wrote:Also, if you have a lot of objects you may want to think about calculating the distance every 100 ms or so instead of every frame, as sqrt() isn't exactly the fastest function.
You could always fade based on magnitude squared.
TheQuestion = 2B || !2B
lymantok
Posts: 67
Joined: Mon Dec 31, 2007 6:13 am

Post by lymantok »

Hi,

It looks like the function you want to use in Irrlicht 1.6 is:

virtual core::position2d< s32 > getScreenCoordinatesFrom3DPosition (core::vector3df pos, ICameraSceneNode *camera=0)=0
Calculates 2d screen position from a 3d position.

From:

http://irrlicht.sourceforge.net/docu/cl ... nager.html
gbrinon
Posts: 11
Joined: Tue May 19, 2009 3:02 pm

Post by gbrinon »

Thank you very much !!! :D
I'll try this one. I hope it exists on irrlicht 1.3.1, actually i'm using jirr, so i cannot use the newest irrlicht version.

But thanks a lot
Guillaume ... hopes HEMERA project will be finished before world's end ;)
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

could you not use one of the text scene nodes or text billboard scene node things... one of those displays text at 3D positions always at the same size.
Image Image Image
gbrinon
Posts: 11
Joined: Tue May 19, 2009 3:02 pm

Post by gbrinon »

All your ideas works well. Thanks a lot again

Now i just have to use a LOD to make the models disapear when they are too far.

The problem will be to compute all the distances everytime (or maybe all the 100ms or more like Lonesome Ducky said)
Guillaume ... hopes HEMERA project will be finished before world's end ;)
Post Reply