锘??xml version="1.0" encoding="utf-8" standalone="yes"?>天天久久狠狠色综合,亚洲午夜无码久久久久,日本久久久精品中文字幕http://www.shnenglu.com/lucky420/archive/2008/01/22/41639.html闅忎究鍐欏啓闅忎究鍐欏啓Tue, 22 Jan 2008 06:01:00 GMThttp://www.shnenglu.com/lucky420/archive/2008/01/22/41639.htmlhttp://www.shnenglu.com/lucky420/comments/41639.htmlhttp://www.shnenglu.com/lucky420/archive/2008/01/22/41639.html#Feedback0http://www.shnenglu.com/lucky420/comments/commentRss/41639.htmlhttp://www.shnenglu.com/lucky420/services/trackbacks/41639.html鍦ㄩ」鐩紪璇戞椂瀵圭潃鑹插櫒婧愪唬鐮佽繘琛岀綰跨紪璇戯紝鍙互鍦ㄧ▼搴忚繍琛屽墠紜畾鐫鑹插櫒紼嬪簭鐨勬紜э紝涔熷彲浠ュ姞蹇▼搴忕殑鍔犺澆閫熷害銆?br>
1錛屽皢effect婧愪唬鐮佹枃浠舵坊鍔犲埌欏圭洰涓紝姣斿鏄?Basic.fx
2錛屽湪Solution Explorer涓夋嫨Basic.fx錛?鍙抽敭錛岄夋嫨"Properties",
3錛屽湪General欏甸潰涓紝閫夋嫨Tool 涓?“Custom Build Tool”
4錛屽湪Custom Build Step欏甸潰涓紝緙栬緫Command Line涓?
               fxc /Tfx_2_0 /Fo$(OutDir)/$(SafeInputName).fxo $(InputFileName)
濡傛灉緙栧啓鐨勬槸鐫鑹插櫒鑰屼笉鏄痚ffect錛屽垯瑕佹敞鎰忓湪fxc鍛戒護(hù)涓繕瑕佹寚瀹氱潃鑹插櫒鐨勫叆鍙e嚱鏁般俧xc鐨勫叿浣撶敤娉曞弬鑰僑DK鏂囨。銆?nbsp;  
5錛岀紪杈慜utputs涓?br>               $(OutDir)/$(SafeInputName).fxo
6錛岀紪璇戦」鐩紝榪欐椂IDE浼?xì)瀵笲asic.fx榪涜緙栬瘧錛屽鍚孋++鐨勭紪璇戜竴鏍鳳紝緙栬瘧鐨勭粨鏋滀篃浼?xì)鍦↖DE鐨刼utput紿楀彛鎵撳嵃鍑烘潵銆?br>



闅忎究鍐欏啓 2008-01-22 14:01 鍙戣〃璇勮
]]>
Bump Mapping鐨勫疄鐜?/title><link>http://www.shnenglu.com/lucky420/archive/2007/12/31/40038.html</link><dc:creator>闅忎究鍐欏啓</dc:creator><author>闅忎究鍐欏啓</author><pubDate>Mon, 31 Dec 2007 02:06:00 GMT</pubDate><guid>http://www.shnenglu.com/lucky420/archive/2007/12/31/40038.html</guid><wfw:comment>http://www.shnenglu.com/lucky420/comments/40038.html</wfw:comment><comments>http://www.shnenglu.com/lucky420/archive/2007/12/31/40038.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/lucky420/comments/commentRss/40038.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/lucky420/services/trackbacks/40038.html</trackback:ping><description><![CDATA[<p>//vertex shader:<br><br>float3 fvLightPosition;<br>float3 fvEyePosition;<br>float4x4 matView;<br>float4x4 matViewProjection;</p> <p>struct VS_INPUT <br>{<br>   float4 Position : POSITION0;<br>   float2 Texcoord : TEXCOORD0;<br>   float3 Normal :   NORMAL0;//閫氬父鍙渶瑕佷袱涓悜閲忥紝鍥犱負(fù)鍙︿竴涓彲浠ュ弶涔樺緱鍒?br>   float3 Binormal : BINORMAL0;<br>   float3 Tangent :  TANGENT0;<br>   <br>};</p> <p>struct VS_OUTPUT <br>{<br>   float4 Position :        POSITION0;<br>   float2 Texcoord :        TEXCOORD0;<br>   float3 ViewDirection :   TEXCOORD1;<br>   float3 LightDirection:   TEXCOORD2;<br>   <br>};</p> <p>VS_OUTPUT vs_main( VS_INPUT Input )<br>{<br>   VS_OUTPUT Output;</p> <p>   Output.Position         = mul( Input.Position, matViewProjection );<br>   Output.Texcoord         = Input.Texcoord;<br>   <br>   float3 fvObjectPosition = mul( Input.Position, matView );<br>   <br>   float3 fvViewDirection  = fvEyePosition - fvObjectPosition;<br>   float3 fvLightDirection = fvLightPosition - fvObjectPosition;<br>     <br>   float3 fvNormal         = mul( Input.Normal, matView );<br>   float3 fvTangent        = mul( Input.Tangent, matView );<br>   float3 fvBinormal       = mul( Input.Binormal, matView );//閫氬父杈撳叆鍙渶瑕乶ornal鍜宼angent錛宐inormal鍙互鐢變袱鑰呭弶涔樺緱鍒?br>   //fvBinormal = cross( fvNormal, fvTangent );<br>  <br>//灝嗚鏂瑰悜鍜屽厜綰挎柟鍚戦兘杞崲鍒版硶綰跨┖闂達(dá)紙鎴栬呯О鍒囩嚎絀洪棿錛?nbsp;   <br>   Output.ViewDirection.x  = dot( fvTangent, fvViewDirection );<br>   Output.ViewDirection.y  = dot( fvBinormal, fvViewDirection );<br>   Output.ViewDirection.z  = dot( fvNormal, fvViewDirection );<br>   <br>   Output.LightDirection.x  = dot( fvTangent, fvLightDirection );<br>   Output.LightDirection.y  = dot( fvBinormal, fvLightDirection );<br>   Output.LightDirection.z  = dot( fvNormal, fvLightDirection );<br>   <br>   return( Output );<br>   <br>}<br><br>//Pixel Shader<br><br>float4 fvAmbient;<br>float4 fvSpecular;<br>float4 fvDiffuse;<br>float fSpecularPower;</p> <p>sampler2D baseMap;<br>sampler2D bumpMap;</p> <p>struct PS_INPUT <br>{<br>   float2 Texcoord :        TEXCOORD0;<br>   float3 ViewDirection :   TEXCOORD1;<br>   float3 LightDirection:   TEXCOORD2;<br>   <br>};</p> <p>float4 ps_main( PS_INPUT Input ) : COLOR0<br>{      <br>   float3 fvLightDirection = normalize( Input.LightDirection );<br>   float3 fvNormal         = normalize( ( tex2D( bumpMap, Input.Texcoord ).xyz * 2.0f ) - 1.0f );<br>   float  fNDotL           = dot( fvNormal, fvLightDirection ); <br>   <br>   float3 fvReflection     = normalize( ( ( 2.0f * fvNormal ) * ( fNDotL ) ) - fvLightDirection ); <br>   float3 fvViewDirection  = normalize( Input.ViewDirection );<br>   float  fRDotV           = max( 0.0f, dot( fvReflection, fvViewDirection ) );<br>   <br>   float4 fvBaseColor      = tex2D( baseMap, Input.Texcoord );<br>   <br>   float4 fvTotalAmbient   = fvAmbient * fvBaseColor; <br>   float4 fvTotalDiffuse   = fvDiffuse * fNDotL * fvBaseColor; <br>   float4 fvTotalSpecular  = fvSpecular * pow( fRDotV, fSpecularPower );<br>   <br>   return( saturate( fvTotalAmbient + fvTotalDiffuse + fvTotalSpecular ) );<br>      <br>}</p> <p> </p> <p><br> </p> <img src ="http://www.shnenglu.com/lucky420/aggbug/40038.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/lucky420/" target="_blank">闅忎究鍐欏啓</a> 2007-12-31 10:06 <a href="http://www.shnenglu.com/lucky420/archive/2007/12/31/40038.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鍓硶綰垮拰姝e垏鏄粈涔?http://www.shnenglu.com/lucky420/archive/2007/06/11/18184.html闅忎究鍐欏啓闅忎究鍐欏啓Mon, 11 Jun 2007 08:09:00 GMThttp://www.shnenglu.com/lucky420/archive/2007/06/11/18184.htmlhttp://www.shnenglu.com/lucky420/comments/18184.htmlhttp://www.shnenglu.com/lucky420/archive/2007/06/11/18184.html#Feedback0http://www.shnenglu.com/lucky420/comments/commentRss/18184.htmlhttp://www.shnenglu.com/lucky420/services/trackbacks/18184.html
浠庣綉涓婃壘浜嗕竴孌墊眰鍒囩嚎鍜屽壇娉曠嚎鐨勪唬鐮?
鏍規(guī)嵁涓変釜欏剁偣鐨勪綅緗潗鏍囧拰綰圭悊鍧愭爣姹傞潰鐨勫壇娉曠嚎鍜屾鍒?br>
 1//let P = v1 - v0
 2D3DXVECTOR3 P = v1.pos - v0.pos;
 3//let Q = v2 - v0
 4D3DXVECTOR3 Q = v2.pos - v0.pos;
 5float s1 = v1.s - v0.s;
 6float t1 = v1.t - v0.t;
 7float s2 = v2.s - v0.s;
 8float t2 = v2.t - v0.t; 
 9
10//we need to solve the equation
11// P = s1*T + t1*B
12// Q = s2*T + t2*B
13// for T and B
14
15
16//this is a linear system with six unknowns and six equatinos, for TxTyTz BxByBz
17//[px,py,pz] = [s1,t1] * [Tx,Ty,Tz]
18// qx,qy,qz     s2,t2     Bx,By,Bz
19
20//multiplying both sides by the inverse of the s,t matrix gives
21//[Tx,Ty,Tz] = 1/(s1t2-s2t1) *  [t2,-t1] * [px,py,pz]
22// Bx,By,Bz                      -s2,s1     qx,qy,qz  
23
24//solve this for the unormalized T and B to get from tangent to object space
25
26
27float tmp = 0.0f;
28if(fabsf(s1*t2 - s2*t1) <= 0.0001f)
29{
30    tmp = 1.0f;
31}

32else
33{
34    tmp = 1.0f/(s1*t2 - s2*t1 );
35}

36
37tangent.x = (t2*P.x - t1*Q.x);
38tangent.y = (t2*P.y - t1*Q.y);
39tangent.z  = (t2*P.z - t1*Q.z);
40
41tangent = tmp * tangent;
42
43binormal.x = (s1*Q.x - s2*P.x);
44binormal.y = (s1*Q.y - s2*P.y);
45binormal.z = (s1*Q.z - s2*P.z);
46
47binormal = tmp * binormal;

鏍規(guī)嵁Maya閲岄潰鐨勮祫鏂欏啓浜嗕竴涓眰鍙杢angent鐨勫嚱鏁幫紝杈撳叆涓?涓《鐐圭殑浣嶇疆錛屾硶綰垮拰綰圭悊鍧愭爣錛岃緭鍑烘槸鍒囩嚎鍊鹼紝鍓硶綰垮彲浠ョ敱鍒囩嚎鍜屾硶綰垮弶涔樺緱鍒般?br>
inline bool floatEqual(float a, float b)
{
    
return abs(a-b) < 0.00001f;
}


HRESULT ComputerTangent(D3DXVECTOR3 position[
3], D3DXVECTOR3 normal[3], D3DXVECTOR2 texcoord[3],D3DXVECTOR3 oTangent[3])
{
    D3DXVECTOR3 edge1;
    D3DXVECTOR3 edge2;
    D3DXVECTOR3 crossP;

     
//==============================================
    
// x, s, t
    
// S & T vectors get used several times in this vector,
    
// but are only computed once.
    
//==============================================
    edge1.x = position[1].x - position[0].x;
    edge1.y 
= texcoord[1].x - texcoord[0].x;// s-vector - don't need to compute this multiple times
    edge1.z = texcoord[1].y - texcoord[0].y;// t-vector

    edge2.x 
= position[2].x - position[0].x;
    edge2.y 
= texcoord[2].x - texcoord[0].x;// another s-vector
    edge2.z = texcoord[2].y - texcoord[0].y;// another t-vector

    D3DXVec3Cross(
&crossP,&edge1,&edge2);
    D3DXVec3Normalize(
&crossP,&crossP);

    
bool degnerateUVTangentPlane = floatEqual(crossP.x, 0.0f);
    
if(degnerateUVTangentPlane)
        crossP.x 
= 1.0f;

    
float tanX = -crossP.y / crossP.x;

    oTangent[
0].x = tanX;
    oTangent[
1].x = tanX;
    oTangent[
2].x = tanX;

    
//--------------------------------------------------------
    
// y, s, t
    
//--------------------------------------------------------
    edge1.x = position[1].y - position[0].y;

    edge2.x 
= position[2].y - position[0].y;
    edge2.y 
= texcoord[2].x - texcoord[0].x;// another s-vector
    edge2.z = texcoord[2].y - texcoord[0].y;// another t-vector

    D3DXVec3Cross(
&crossP,&edge1,&edge2);
    D3DXVec3Normalize(
&crossP,&crossP);

    degnerateUVTangentPlane 
= floatEqual(crossP.x, 0.0f);
    
if(degnerateUVTangentPlane)
        crossP.x 
= 1.0f;

    
float tanY = -crossP.y / crossP.x;

    oTangent[
0].y = tanY;
    oTangent[
1].y = tanY;
    oTangent[
2].y = tanY;

     
//------------------------------------------------------
    
// z, s, t
    
//------------------------------------------------------
    edge1.x = position[1].z - position[0].z;

    edge2.x 
= position[2].z - position[0].z;
    edge2.y 
= texcoord[2].x - texcoord[0].x;// another s-vector
    edge2.z = texcoord[2].y - texcoord[0].y;// another t-vector

    D3DXVec3Cross(
&crossP,&edge1,&edge2);
    D3DXVec3Normalize(
&crossP,&crossP);

    degnerateUVTangentPlane 
= floatEqual(crossP.x, 0.0f);
    
if(degnerateUVTangentPlane)
        crossP.x 
= 1.0f;

    
float tanZ = -crossP.y / crossP.x;

    oTangent[
0].z = tanZ;
    oTangent[
1].z = tanZ;
    oTangent[
2].z = tanZ;

    
//------------------------------------------------------
    forint i = 0; i < 3; i++)
    
{
        
// Ortho-normalize to normal
        float dot = D3DXVec3Dot(&oTangent[i],&normal[i]);
        oTangent[i] 
-= normal[i] * dot;

        
// Normalize tangents
        D3DXVec3Normalize(&oTangent[i],&oTangent[i]);
    }


    
return S_OK;
}



闅忎究鍐欏啓 2007-06-11 16:09 鍙戣〃璇勮
]]>
久久国产精品一区| 99久久精品国产一区二区| 亚洲精品乱码久久久久久久久久久久| 亚洲一区中文字幕久久| 俺来也俺去啦久久综合网| 亚洲级αV无码毛片久久精品| 污污内射久久一区二区欧美日韩 | 91久久精一区二区三区大全| 影音先锋女人AV鲁色资源网久久| 精品久久久久久无码不卡| 亚洲人成无码www久久久| 久久久久久亚洲精品影院| 2020国产成人久久精品| 久久香综合精品久久伊人| 新狼窝色AV性久久久久久| 久久国产精品无码HDAV| 亚洲一区中文字幕久久| 久久综合精品国产一区二区三区| 亚洲人成电影网站久久| 人妻久久久一区二区三区| 成人综合伊人五月婷久久| 久久国产热这里只有精品| 久久受www免费人成_看片中文 | 久久精品国产一区二区电影| 亚洲国产婷婷香蕉久久久久久| 久久天天躁狠狠躁夜夜av浪潮| 一本色道久久88综合日韩精品| 一本色道久久88精品综合| 国产精品久久一区二区三区| 久久久不卡国产精品一区二区| 国产成人精品综合久久久| 青青草国产精品久久久久| 亚洲第一永久AV网站久久精品男人的天堂AV| 欧美亚洲国产精品久久高清 | 一本色道久久HEZYO无码| 久久亚洲国产中v天仙www| 久久人人爽人人爽人人片AV不| 国产精品久久久久久福利69堂| 久久精品国产精品亜洲毛片| 久久ww精品w免费人成| 久久综合亚洲色HEZYO国产|