Three newbie questions

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
jpeq
Posts: 8
Joined: Fri Jun 02, 2006 2:29 am
Location: Berkeley, CA

Three newbie questions

Post by jpeq »

Hi all,

I started to test Irrlicht two weeks ago for a scientific project.
However, I still did not find a way to implement a few essential things. Namely:
  • --How to draw splines in the 3D space? Like, suppose I have a function which defines a curve in the 3D space. Is it possible to render it somehow with Irrlicht?

    --How to implement a switch to make objects visible/invisible?

    --Is it possible to change the transparency of an object on the fly? Like fade it from opaque to transparent
Thanks for any help.
dhenton9000
Posts: 395
Joined: Fri Apr 08, 2005 8:46 pm

Post by dhenton9000 »

for opaque to transparent, what I've done is set the material type to EMT_TRANSPARENT_ADD_COLOR then darken the color of the texture of the material to black. You need a custom node for this.


setvisible(true) for invisible/visible

if I wanted splines, i'd have to go strictly opengl, write a customnode, and take over the rendering routine to use opengl commands to draw 3d curves. If i remember right, there are a WHOLE bunch of cool commands for curves in opengl.

HTH
Skip Talbot
Posts: 2
Joined: Sun May 07, 2006 4:18 pm
Location: Illinois
Contact:

Post by Skip Talbot »

You could approximate your spline with line segments and draw them with driver->draw3DLine()

Skip
Skip Talbot
Skip's Webzone
jpeq
Posts: 8
Joined: Fri Jun 02, 2006 2:29 am
Location: Berkeley, CA

Post by jpeq »

dhenton,

Thanks for the reply.
So, setvisible(true) solves my problem of the visibility switch.
I'm not familiar with the OpenGL API, but will give it a try, maybe it solves my problem.
Now, for the transparency your solution does not seem to work, since when you set a material type as EMT_TRANSPARENT_ADD_COLOR, it's ALLWAYS transparent. If you set the emission color of the material with objectNode->getMaterial(0).EmissiveColor.set(0,255,255,255)
and then
objectNode->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR)
the object is still transparent.

How to solve this?


Skip,

The curves must have a lot of precision and be seen both from very close and very far. They also must be generated on the fly, from parameters written in a XML file. So, I prefer not to use your method, although it can be useful for other purposes.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

You'll get the very same results with the OpenGL API as with manual triangulation becuase OpenGL also uses trinagle approximation. You can even use the GLU API to get hold of the triangle data. But it's no problem, just use enough triangles, maybe depending on the distance to the camera (dynamic LOD). Using triangulation with NURBS is not really involved, just a handful of math functions.
jpeq
Posts: 8
Joined: Fri Jun 02, 2006 2:29 am
Location: Berkeley, CA

Post by jpeq »

OK, so suppose I use OpenGL (for the sake of simplicity) to generate my splines. Would the Irrlicht camera then display it?

Manual triangulation... I don't know how to do it efficiently. You see, I'll have to generate the 3d functions on the fly and then display the curves.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Yes, of course it will display it. Just create a custom scene node (read the example on that) and put the OpenGL code into the render method. Some threads on combination of OpenGL code with Irrlicht can be found in these forums, but it shouldn't be too hard if you know how to code the OpenGL parts.
jpeq
Posts: 8
Joined: Fri Jun 02, 2006 2:29 am
Location: Berkeley, CA

Post by jpeq »

Hummm... OK, I guess that should work, thanks.
Any clue on how can I then interact with these splines (like, select them)

Thanks.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

That will work via the usual scene node selection based on bounding boxes. But only as long as you don't need point exact selection. That would require tesselation and conversion into Irrlicht S3DVertex structures.
Post Reply