How to use cube mapping

Started by
8 comments, last by Kris2456 19 years, 10 months ago
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)
------------ "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)
Advertisement
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.
f@dzhttp://festini.device-zero.de
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]
------------ "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)
Kris2456: I suggest that you take the articles and attempt to do it yourself, begging for the code won''t get you anywhere.
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.

____________________________________________________________www.elf-stone.com | Automated GL Extension Loading: GLee 5.00 for Win32 and Linux

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*
------------ "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)
If you're using VC++ just right click on the call to DrawCubeMap and select "Go To Definition Of DrawCubeMap".

-UltimaX-
|Designing A Screen Shot System|

"You wished for a white christmas... Now go shovel your wishes!"

[edited by - UltimaX on May 30, 2004 1:48:35 PM]
Nope, i cant find it.
------------ "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)
If all else fails, use find in files.

____________________________________________________________www.elf-stone.com | Automated GL Extension Loading: GLee 5.00 for Win32 and Linux

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.
------------ "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)

This topic is closed to new replies.

Advertisement