Gamasutra is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Gamasutra: The Art & Business of Making Gamesspacer
Refractive Texture Mapping, Part One
View All     RSS
February 28, 2020
arrowPress Releases
February 28, 2020
Games Press
View All     RSS







If you enjoy reading this site, you might also want to check out these UBM Tech sites:


 

Refractive Texture Mapping, Part One


November 10, 2000 Article Start Previous Page 4 of 4
 

First Simulation Using Sphere Mapping

If sphere mapping is applied to a perturbed polygonal mesh, a very interesting effect can be achieved (Figures 7 and 8 show the results, Figure 9 shows the textures used). The implementation is a combination of the two techniques explained before, plus the vertex normal calculations, because the mesh deforms each frame. Finally, when the perturbation values are tuned (amplitude, frequency, velocity, and so on), it's important to use small amplitudes for the waves. In tall waves the textures stretch too much, creating undesirable effects. The code for the render function is shown in Listing 3.

Listing 3. Render function using sphere mapping

result water_render (WATER *water)
{

resulterror_code;

//check param
if (!water)
{

return (WATER_ERROR_PARAM_IS_NULL);
}

//apply perturbations
water_compute_perturbations (water);

//compute vertex normals
water_compute_normals (water);

//mapping technique (sphere mapping)
water_compute_reflection (water);

//this sends all the polygons to the hardware to be transformed and rendered
error_code = polyd3d_render (&water->mesh_info);
if (error_code < 0)
{

return (WATER_ERROR_CANNOT_RENDER);
}

return (WATER_OK);

}

 


Figures 7 and 8. Sphere mapping and perturbations.


Figure 9. Textures used in
Figures 7 and 8.

Next time, in part two of this article, I will dive into refractive texture mapping for simulating water refraction. I'll also provide a second simulation as well as some optimizations and the sample application.


References

Möller, Tomas, and Eric Haines. Real-Time Rendering. A.K. Peteres, 1999. pp 131-133.

Direct X 7 SDK Help (Microsoft Corp.)

Serway, R. Physics for Scientists and Engineers with Modern Phyisics, 4th ed. HBJ, 1996. pp. 1023-1036.

Ts'o, Pauline, and Brian Barsky. "Modeling and Rendering Waves: Wave-Tracing Using Beta-Splines and Reflective and Refractive Texture Mapping." SIGGRAPH 1987. pp. 191-214.

Watt, Alan, and Fabio Policarpo. The Computer Image. Addison-Wesley, 1997. pp. 447-448.

Watt, Alan, and Mark Watt. Advanced Animation and Rendering Techniques: Theory and Practice. Addison-Wesley, 1992. pp. 189-190

Harris, John W., and Horst Stocker. Handbook of Mathematics and Computational Science. Springer Verlag, 1998.

PlayStation Technical Reference Release 2.2, August 1998 (Sony Computer Entertainment)

Elias, Hugo. http://freespace.virgin.net/hugo.elias/graphics/x_water.htm

Lander, Jeff. "A Clean Start: Washing Away the New Millennium." Game Developer (December 1999) pp. 23-28.

Haberman, Richard. Elementary Applied Partial Differential Equations, 3rd ed. Prentice Hall, 1997. pp. 130-150.

Graff, Karl F. Wave Motion In Elastic Solids. Dover Publications, 1991. pp. 213-272.

 

 

 


Article Start Previous Page 4 of 4

Related Jobs

Vicarious Visions / Activision
Vicarious Visions / Activision — Albany, New York, United States
[02.28.20]

Senior Software Engineer
Sucker Punch Productions
Sucker Punch Productions — Bellevue, Washington, United States
[02.28.20]

Gameplay Programmer
Boston Dynamics
Boston Dynamics — Wallham, Massachusetts, United States
[02.28.20]

Software Engineer, Entertainment
Insomniac Games
Insomniac Games — BURBANK, California, United States
[02.27.20]

Sr Character TD





Loading Comments

loader image