occen
所属分类:游戏
开发工具:Visual C++
文件大小:3652KB
下载次数:17
上传日期:2009-09-08 09:33:26
上 传 者:
zhyinty
说明: 使用了顶点着色器和像素着色器的海面渲染。。。。。。。。。。。。。。
(Using the vertex shader and pixel shader rendering the sea)
文件列表:
occen\Debug\BuildLog.htm (32920, 2009-09-08)
occen\Debug\d3dapp.sbr (1812509, 2009-09-08)
occen\Debug\dxutil.obj (49947, 2009-09-08)
occen\Debug\dxutil.sbr (1675343, 2009-09-08)
occen\Debug\OceanWaterDebug.exe.embed.manifest (2048, 2009-09-08)
occen\Debug\vc80.idb (314368, 2009-09-08)
occen\Debug\vc80.pdb (217088, 2009-09-08)
occen\directx.ico (1078, 2001-07-13)
occen\framework\d3dapp.cpp (75328, 2009-09-08)
occen\framework\d3dapp.h (9179, 2009-09-08)
occen\framework\d3dfile.cpp (24189, 2009-09-08)
occen\framework\d3dfile.h (4344, 2001-10-31)
occen\framework\d3dfont.cpp (23795, 2009-09-08)
occen\framework\d3dfont.h (2487, 2001-10-31)
occen\framework\d3dres.h (1664, 2001-08-17)
occen\framework\d3dutil.cpp (23266, 2001-10-31)
occen\framework\d3dutil.h (10718, 2009-09-08)
occen\framework\dxutil.cpp (23668, 2001-10-31)
occen\framework\dxutil.h (5147, 2001-10-31)
occen\media\ocean6.dds (393344, 2002-07-05)
occen\media\oceangradient.bmp (24888, 2001-12-10)
occen\media\Waterbump3.bmp (263224, 2001-10-03)
occen\OceanWater.cpp (26227, 2009-09-08)
occen\OceanWater.dsp (5271, 2002-07-10)
occen\OceanWater.dsw (629, 2002-07-05)
occen\OceanWater.exe (356352, 2002-07-10)
occen\OceanWater.ncb (7826432, 2009-09-08)
occen\OceanWater.sln (884, 2009-09-08)
occen\OceanWater.suo (16896, 2009-09-08)
occen\OceanWater.vcproj (9189, 2009-09-08)
occen\OceanWater.vcproj.20090903-1344.Administrator.user (1423, 2009-09-08)
occen\resource.h (1380, 2001-09-21)
occen\shaders\OceanWater.psh (1279, 2002-07-05)
occen\shaders\OceanWater.vsh (4613, 2002-07-05)
occen\winmain.rc (5124, 2001-09-21)
occen\shaders\Debug (0, 2002-07-22)
occen\shaders\Release (0, 2002-07-22)
occen\Debug (0, 2009-09-08)
occen\framework (0, 2009-09-08)
... ...
//-----------------------------------------------------------------------------
// 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.
近期下载者:
相关文件:
收藏者: