Textured Custom SceneNode

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
OemmeS
Posts: 6
Joined: Tue Jun 21, 2005 4:39 pm
Location: Kempen, Germany

Textured Custom SceneNode

Post by OemmeS »

Hi all!

I've been playing around with Irrlicht for some time now, and I started a little project of mine. Well, in the distant future I hope it becomes something like Frontier: First Encounters (yeah I know I'm not the only one trying this ;-) )

For now, it is nothing more than a "Planet Simulator", wich means that I am able to display a Planet (no random Planet at the Moment, I'm still working with an Earth Texture) at different Levels of Detail regarding to the distance to the ground.

Everything works fine, and I am pretty pleased with the results (I used this http://www.gamedev.net/reference/articl ... le2074.asp algorithm and with a few modifications it looks really promising)

Anyways, at the moment I don't use any textures on the Mesh, just colours for the corners that I pick from the Earth Texture and the Earth BumpMap from the PerPixel Lightning Demo for the geometric detail

For more detail I add some random noise to the colors and the heighmap.


It would look much better if I were able to apply textures to the triangles, but I don't know how to do that. Applying one Texture to the whole Mesh is no option, because the Mesh is highly dynamic and changes quite often.

I have searched the API for some time, but I could not find any function to draw a texture to a single triangle. Does Irrlicht support this? Or if it does not, could I use some OpenGL functions?
OemmeS
Posts: 6
Joined: Tue Jun 21, 2005 4:39 pm
Location: Kempen, Germany

Post by OemmeS »

No idea?
Guest

Post by Guest »

How about:
http://irrlicht.sourceforge.net/docu/cl ... r.html#a56

PS: I've looked at that link, and I get the impression that there are going to be masses of T-junctions. So you may get pixel-sized artifacts.
Thulsa Doom
Posts: 63
Joined: Thu Aug 05, 2004 9:40 am
Location: Germany

Post by Thulsa Doom »

Nice article about tesselation, but seems like massive work to implement.
Just two ideas:
1) Pick the color from textures with different static resolution (dynamic scaling) depending on your mesh resolution or distance to the viewpoint.
2) Calculate a 2D-projection of your vertices on a texture to get the u,v coords and color. This will also ensure to get the correct curvature effect of the sphere's texture.

With good hope for some nice screenshots soon,
:)
OemmeS
Posts: 6
Joined: Tue Jun 21, 2005 4:39 pm
Location: Kempen, Germany

Post by OemmeS »

Thanks for the replies!

@ Guest: I don't think that setMaterial would work. This way I could apply one texture to the whole mesh, but I would like to set the texture for every triangle seperately because they all have a different LOD.

You are right about the t-junctions and the resulting artifacts, but I think I can live with it. Also, I have thought of a very simple solution: I just set a sphere with a similar texture but much less polys inside the planet-mesh, so all I would see through these artifacts would be a pixel with almost the right color, wich shouldn't be too disturbing


@ Thulsa Doom: The idea with the different textures is really nice, because I could save VERY much memory. At the moment I need about 350 mb :oops:(two 16384*8192*24 bit textures + unoptimized data structure)

Your second point is already implemented :) It is exactly the way I do it, but of course the ground detail is limited to the triangle size. With textures it could be much higher


Btw, the implementing was not that hard (except for bugfixing - one wrong return statement can really ruin your day :wink: )


Screenshots will have to wait until I get some webspace :?
Phenix
Posts: 51
Joined: Sat Nov 15, 2003 3:15 pm
Location: Earth
Contact:

Post by Phenix »

Currently I am using in my game 6 runtime-generated textures for a planet when the player is quite far to that (some km from the surface), and another (just one, maybe I'll correct it in the future) when the camera is near to the surface. It's just a grey scale texture, I use vertex colors to paint it.
Results are quite ugly, the runtime generated texture isn't realistic and the switch between the generated texture and the grey scale one isn't completely seamless, but I'm too lazy to change it :)
I just hope Thargoids won't hurt me if their planet is ugly :(
Post Reply