Archived

This topic is now archived and is closed to further replies.

How to use cube mapping

This topic is 4947 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, basicly, ever since i saw that smooth water in Wizard Duel 2. Ive wanted to make something like it. The problem is, i havnt been able to find any tutorials on it at all. Could anyone tell me how to do it, or *point me to a tutorial. PS: PLEASE, ont tell me to go on that shitty Nvidia thing on cubemapping, its rubbish. ------------ "Here lies a toppled God, His fall was not a small one, We but built his pedastle, A narrow, and a tall one" Frank Herbert (Dune:Messiah)

Share this post


Link to post
Share on other sites
http://oss.sgi.com/projects/ogl-sample/registry/ARB/texture_cube_map.txt

if thats still too complicated: youre in the center of the cube and the 3d texcoord is the direction from there to whichever point in the cubemap you want.

Share this post


Link to post
Share on other sites
OK,i read thru that article,but i id not fin any code on doing it. Also if Benjamin Bunny could tell me where he put his CubeMap function in Wizard Duel 2,that would also be great.

[edited by - Kris2456 on May 30, 2004 6:37:33 AM]

Share this post


Link to post
Share on other sites
quote:
Original post by Kris2456
OK,i read thru that article,but i id not fin any code on doing it. Also if Benjamin Bunny could tell me where he put his CubeMap function in Wizard Duel 2,that would also be great.

[edited by - Kris2456 on May 30, 2004 6:37:33 AM]


From memory, it''s in the sea.cpp file, although it''s been a while since I looked at that code.

I won''t go into detail, but the way I did it was to render the sea as a heightmap, animating the vertices with a sine function. I used a lookup table for the sines to speed it up (but you could get better results with a vertex program). Obviously the normals had to be calculated each frame too. I did this using the heights of the 4-connected neighbours of each vertex.

I used the NV_texgen_reflection extension to generate the texture coords on the fly (which has since been promoted to the core) as well as the cube map extension.

I blended the water according to its depth by varying the alpha values of the vertices and blending with a GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA blend mode.

It''s all there in the code anyway.

Share this post


Link to post
Share on other sites
lol,im not trying to beg for the code. Its just that i want to know the syntax for it. So far ive only found stuff on, how cube mapping works and loads of technical diagrams. In response to Ben''s answer,i had a look in the sea.cpp file, but all there is is something saying DrawCubeMap() which i am trying to find the location for.

begging for code *tsk*

Share this post


Link to post
Share on other sites
see the prob is i USe Dev-C++, so i cant opn project, oh well. Ultimategameprogramming.com is going to release a CubeMapping tut soon, ill check that out. Itd also be good if NeHe did one, cos he always seems to explain stuff well.

Share this post


Link to post
Share on other sites