d37724088Ocea3

所属分类:DirextX编程
开发工具:Visual C++
文件大小:497KB
下载次数:19
上传日期:2012-09-15 12:25:01
上 传 者bounces
说明:  d3d 海洋效果,水面效应,很不错啊啊,大家可以来学习学习啊。初学者必备。
(d3d ocean effect, surface effect, very good ah ah, we can learn from ah. For beginners.)

文件列表:
d37724088Ocea3\OceanWater\directx.ico (1078, 2001-07-13)
d37724088Ocea3\OceanWater\framework\d3dapp.cpp (75328, 2001-10-31)
d37724088Ocea3\OceanWater\framework\d3dapp.h (9179, 2001-10-31)
d37724088Ocea3\OceanWater\framework\d3dfile.cpp (24189, 2001-10-31)
d37724088Ocea3\OceanWater\framework\d3dfile.h (4344, 2001-10-31)
d37724088Ocea3\OceanWater\framework\d3dfont.cpp (23795, 2001-10-31)
d37724088Ocea3\OceanWater\framework\d3dfont.h (2487, 2001-10-31)
d37724088Ocea3\OceanWater\framework\d3dres.h (1664, 2001-08-17)
d37724088Ocea3\OceanWater\framework\d3dutil.cpp (23266, 2001-10-31)
d37724088Ocea3\OceanWater\framework\d3dutil.h (10718, 2001-10-31)
d37724088Ocea3\OceanWater\framework\dxutil.cpp (23668, 2001-10-31)
d37724088Ocea3\OceanWater\framework\dxutil.h (5147, 2001-10-31)
d37724088Ocea3\OceanWater\media\ocean6.dds (393344, 2002-07-05)
d37724088Ocea3\OceanWater\media\oceangradient.bmp (24888, 2001-12-10)
d37724088Ocea3\OceanWater\media\Waterbump3.bmp (263224, 2001-10-03)
d37724088Ocea3\OceanWater\OceanWater.cpp (26227, 2002-07-10)
d37724088Ocea3\OceanWater\OceanWater.dsp (5271, 2002-07-10)
d37724088Ocea3\OceanWater\OceanWater.dsw (629, 2002-07-05)
d37724088Ocea3\OceanWater\OceanWater.exe (356352, 2002-07-10)
d37724088Ocea3\OceanWater\resource.h (1380, 2001-09-21)
d37724088Ocea3\OceanWater\shaders\OceanWater.psh (1279, 2002-07-05)
d37724088Ocea3\OceanWater\shaders\OceanWater.vsh (4613, 2002-07-05)
d37724088Ocea3\OceanWater\winmain.rc (5124, 2001-09-21)
d37724088Ocea3\OceanWater\shaders\Debug (0, 2002-07-22)
d37724088Ocea3\OceanWater\shaders\Release (0, 2002-07-22)
d37724088Ocea3\OceanWater\framework (0, 2002-07-22)
d37724088Ocea3\OceanWater\media (0, 2002-07-22)
d37724088Ocea3\OceanWater\shaders (0, 2002-07-22)
d37724088Ocea3\OceanWater (0, 2008-12-30)
d37724088Ocea3 (0, 2012-03-18)

//----------------------------------------------------------------------------- // Name: OceanWater Sample // // Copyright (c) 2002 ATI Technologies Inc. All rights reserved. //----------------------------------------------------------------------------- Description =========== The OceanWater sample demonstrates the use of vertex and pixel shaders to create the effect of a shiny oscillating ocean surface with multiple waves moving in different directions. Rendering realistic ocean water is particularly difficult due to the shape of the surface of the water and combination of multiple waves, and the reflection of the clouds, and the sun in the sky. The vertex and pixel shaders are used to implement a cubic environment map to provide the reflection of the sky and clouds, a deforming grid that simulates the larger waves, two bump maps for smaller waves, and an indexed Fresnel map to provide the surface color. Path ==== Source: source\DirectX\OceanWater User's Guide ============ The following keys are implemented. The dropdown menus can be used for the same controls. Starts and stops the scene Advances the scene by a small increment Prompts user to select a new rendering device or display mode Toggles between fullscreen and windowed modes Exits the app. Programming Notes ================= The input geometry is a grid of quads with 1 set of texture coordinates, normals and tangents. A prerendered sky and clouds texture is used for the cubic environment map. The vertex shader is responsible for generating the combination of sine waves that perturb the position, and cosine waves that perturb the tangent space vectors for the vertex. A Taylor series approximation is used to generate sine and cosine functions within the shader. Each sine wave has fully adjustable direction, frequency, speed, and offset, that is configured in the constant store. The pixel shader is responsible for producing the bump-mapped reflective ocean surface. First, the pixel shader averages the two scrolling normal bump maps to generate a composite normal. Next, it transforms the tangent space composite normal into world space and calculates a per-pixel reflection vector. The reflection vector is used to sample a skybox cubic environment map. The shader also calculates 2*N.V, and uses it to sample a Fresnel 1-D texture. This Fresnel map gives the water a more greenish appearance when looking straight down into it, and a more bluish appearance when looking edge on. The second phase of the pixel shader composites the water color, from the Fresnel map, the environment map, and other specular highlights extracted from the environment map. One trick we use is to square the environment map color values to make the colors brighter, and to enhance the contrast for compositing. To get the specular light sparkles in the water, a specular component is derived from the green channel of the environment map. The desired effect is to have the highlights in the water correspond to bright spots in the sky. To make sure the specular peaks were only generated from the brightest areas of the environment map, the specular value extracted from the green channel was raised to the eighth power. This has the effect of darkening all but the brightest areas of the image.

近期下载者

相关文件


收藏者