青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

4D星宇

c++

  C++博客 :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
  57 隨筆 :: 0 文章 :: 39 評論 :: 0 Trackbacks

2008年12月8日 #

              改寫代碼心得
       由于BLOOD渲染器的API由DX9轉向DX10,在轉化架構和改寫代碼的過程中,出現很多異常。
在測試過程中,發現很多錯誤都是由于沒有進行正確的初始化造成的。比如分配內存的容間,變量的正確賦值等等。已調完VB,IB,TEXTURE,RENDERTARGET等部分,還有MESH等大部未調。
       特此MARK,以作記錄。
posted @ 2008-12-08 10:21 bloodbao 閱讀(222) | 評論 (0)編輯 收藏

2008年11月9日 #

DX9下使用
D3DXPLANE plane; 
 D3DXPlaneFromPointNormal( &plane, &vPoint, &vNormal ); //生成這個平面
D3DXMatrixReflect( &matReflect, &plane ); //取得該平面的反射矩陣
//設置剪切平面,使反射面上的內容被渲染,面下的被丟棄
 m_pd3dDevice->SetClipPlane( 0, plane );
 m_pd3dDevice->SetRenderState( D3DRS_CLIPPLANEENABLE, 0x01 );
DX10下模擬:
User Clip PlanesUser Clip Planes are emulated by specifying a clip distance output from the Vertex Shader with the SV_ClipDistance[n] flag, where n is either 0 or 1. Each component can hold up to 4 clip distances in x, y, z, and w giving a total of 8 clip distances.

    用戶裁減平面通過在VS里設定一個SV_ClipDistance[n]標記,定義一個裁減距離輸出得到,n為0或1。這里一共能存放8個Clip Plane距離,分別使用數組兩個元素的x,y,z,w通道。

In this scenario, each clip planes is defined by a plane equation of the form:

在這個場景里,每個clip plane被一個平面方程定義:

Ax + By + Cz + D =0;

Where <A,B,C> is the normal of the plane, and D is the distance of the plane from the origin. Plugging in any point <x,y,z> into this equation gives its distance from the plane. Therefore, all points <x,y,z> that satisfy the equation Ax + By + Cz + D = 0 are on the plane. All points that satisfy Ax + By + Cz + D < 0 are below the plane. All points that satisfy Ax + By + Cz + D > 0 are above the plane.

<A,B,C>是平面法向,D是平面到原點的距離。把任意點<x,y,z>代入方程能得到它到平面的距離。所有滿足方程=0的點在平面上,<0的點在平面下而 >0的點在平面上。

In the Vertex Shader, each vertex is tested against each plane equation to produce a distance to the clip plane. Each of the three clip distances are stored in the first three components of the output component with the semantic SV_ClipDistance0. These clip distances get interpolated over the triangle during rasterization and clipped if the value every goes below 0.

    在VS中,每個頂點會帶入平面方程做測試。每個三角形的Clip距離存在SV_ClipDistance0語義輸出的前三個通道中。這個距離在光柵化中被線性插值,所有小于0的像素被剔除。

posted @ 2008-11-09 20:47 bloodbao 閱讀(1225) | 評論 (0)編輯 收藏

2008年10月23日 #

近期較閑,主要修改rendering架構,減少DX9的接口,全面使用DX10的接口,修改變動非常大,初調試三千多個ERROR,現減為850多個,不過,內部錯誤還是很多。希望能在DX11發布前,全部改完。第二步,會建立更龐大的ISCENENODE,以滿足快速測試和新版SCENEEDIT需要。暫記下。
posted @ 2008-10-23 21:55 bloodbao 閱讀(201) | 評論 (0)編輯 收藏

2008年9月18日 #

不知不覺,九月已經過去太半了,而我卻由于沉迷于游戲,反而沒學到什么東西,這樣浪費時間,真的是一種罪過。 過了一個多月時間,只簡單的支持了XML和一點點LIGHT。小貓的引擎,離我承諾的精彩的水面,漂亮的粒子系統,復雜的天氣系統,流暢的骨骼動畫和人工智能,越來越遠。 革命遠未成功,小貓還需努力,為了錢和生活,多一點自制,少玩一些游戲吧! 退路已斷,前方無路,人生豈能如些墮落。貓行天下,人生何缺悲壯,也需幾多拼搏。十分耕耘,萬分努力,或許成功! 期小貓自勉!
posted @ 2008-09-18 21:58 bloodbao 閱讀(189) | 評論 (0)編輯 收藏

2008年8月11日 #

                     Main Features in my blood engine
Direct3D 9 is used to render the scene
User input is gathered though DirectInput
Single pass multi-texturing using the fixed-function pipeline (FFP)
Light-mapping
Frustum culling
Simple skybox
Keyframe Animation with GPU-based frame interpolation through a custom vertex and pixel shader written in HLSL. This technique is also known as Vertex Tweening or even Morph Target
Support for Quake2 models (.md2)
Support for DirectX models (.x)
Support for PCX texture loading in addition to the other image formats already supported by Direct3D
Support for Quake3:Arena levels
Lightmaps
Curved surfaces using Bezier patches
Partial support of Quake3 materials and effects (.shader)
Uses the BSP/PVS to quickly discard non visible geometry
Collision detection using the BSP tree (supports ray, sphere and box sweeps)
A flexible scene graph system where entities can be attached to each other in order to perform hierarchical transformations and geometry culling
Quake-like player movement physics
A powerful in-game console system:
Outputs vital information
Can take command inputs from the user
Console variables can be dynamically edited at runtime
Commands and console variable settings can be loaded from a user-specified text file (cfg)
Garbage collection of unused resources through reference counting
Control keys can be dynamically changed in-game through the console, using the bind command
User input is abstracted through an Action Manager which maps inputs to actions
A smart chase-camera controller that will detect collisions with the world to prevent the view from being occluded by other pieces of world geometry.
Error handling through exceptions
The in-game HUD can display vital performance statistics about the game, such as frames per second, total number of triangles on the screen, number of textures loaded, etc…
posted @ 2008-08-11 15:05 bloodbao 閱讀(236) | 評論 (0)編輯 收藏

2008年8月6日 #

       為了這次面試,我休息了很多天,都沒工作。結果,得到的又是一個失敗的結局。分析原因,都認為我的C++基礎很薄弱吧,要不就是因為我以前從事的工作和現在的工作差別太大了。
      作為一名新手,我很迷茫,在學習的道路我沒有被打敗,卻在兩次面試中,深受打擊。我不僅在想,這是否是我要選擇的路。僅剩半個多月的時間,暑期就結束了,我再不出去,就沒機會了。事實上,做不做游戲,我無所謂,但現在的生活一直不是我想要的。我不斷地在否定自已的路上,越走越遠,找不到真實的我。
      兩個月很快就過去了,我只能靜下心來去做事情,把這些煩人的事,都拋于腦后。路還是要走,人總是要成長的,希望能從失敗中走出來。
      記下今天的失敗,以作自勉。

posted @ 2008-08-06 10:36 bloodbao 閱讀(482) | 評論 (10)編輯 收藏

2008年7月20日 #


主要是用模板緩沖區來實現。
DepthStencilState StencilShadow
{
    DepthEnable = true;
    DepthWriteMask = ZERO;
    DepthFunc = LESS;
   
    StencilEnable = true;
    StencilReadMask = 0xFFFFFFFF;
    StencilWriteMask = 0xFFFFFFFF;
   
    FrontFaceStencilFunc = ALWAYS;
    FrontFaceStencilPass = INCR;
    FrontFaceStencilFail = Keep;
   
    BackFaceStencilFunc = ALWAYS;
    BackFaceStencilPass = DECR;
  BackFaceStencilFail = Keep;
};
BlendState AdditiveBlending
{
    AlphaToCoverageEnable = FALSE;
    BlendEnable[0] = TRUE;
    SrcBlend = SRC_ALPHA ;
    DestBlend = INV_SRC_ALPHA ;
    BlendOp = ADD;
    SrcBlendAlpha = ZERO;
    DestBlendAlpha = ZERO;
    BlendOpAlpha = ADD;
    RenderTargetWriteMask[0] = 0x0F;
};

Rendering Shadows

At the top level, the rendering steps look like the following:

  • If ambient lighting is enabled, render the entire scene with ambient only.
  • For each light in the scene, do the following:
    • Disable depth-buffer and frame-buffer writing.
    • Prepare the stencil buffer render states for rendering the shadow volume.
    • Render the shadow volume mesh with a vertex extruding shader. This sets up the stencil buffer according to whether or not the pixels are in the shadow volume.
    • Prepare the stencil buffer render states for lighting.
    • Prepare the additive blending mode.
    • Render the scene for lighting with only the light being processed.

Shadow Volume并不是一個沒有缺陷的技術。除了高像素填充率和陰影邊界檢測外,在繪制過程中還可能出現錯誤。錯誤的主要原因是當一個幾何模型在計算自陰影時,它的面通常被完全照亮或者完全變暗,這取決于這個面是否朝向光源。光照計算必須使用頂點法向而非表面法向。對于接近平行光源的面,它會被完全照亮或者完全變暗,而實際上應該部分處于光源中。這是從stencil shadow volume中繼承來的問題,在計算陰影時必須被考慮。這個問題可以通過增加mesh密度來解決,這也增加了處理mesh的時間。頂點法向和面法向越接近,表面的問題就越少。如果程序不能把問題限制在可接受的范圍內,就必須考慮使用其他的算法,比如PRT或者Shadow Map。
posted @ 2008-07-20 10:48 bloodbao 閱讀(357) | 評論 (0)編輯 收藏

Fixed-function Lighting Pipeline
ColorsOutput CalcLighting( float3 worldNormal, float3 worldPos, float3 cameraPos )
{
    ColorsOutput output = (ColorsOutput)0.0;
   
    for(int i=0; i<8; i++)
{
     //光線方向
        float3 toLight = g_lights[i].Position.xyz - worldPos;
         //離光源距離
        float lightDist = length( toLight );
         //atten=(1/(a[2]*d*d+a[1]*d+a[1])
        float fAtten = 1.0/dot( g_lights[i].Atten, float4(1,lightDist,lightDist*lightDist,0) );
        float3 lightDir = normalize( toLight );
         //H
        float3 halfAngle = normalize( normalize(-cameraPos) + lightDir );
       
         //Phong方程,逐頂點光照
        output.Diffuse += max(0,dot( lightDir, worldNormal ) * g_lights[i].Diffuse * fAtten) + g_lights[i].Ambient;
        output.Specular += max(0,pow( dot( halfAngle, worldNormal ), 64 ) * g_lights[i].Specular * fAtten );
    }
   
    return output;
}
簡單ALPHA測試
//
// PS for rendering with alpha test
//
float4 PSAlphaTestmain(PSSceneIn input) : COLOR0
{       
         float4 color =  tex2D( g_samLinear, g_txDiffuse, input.tex ) * input.colorD;
         if( color.a < 0.5 )
                 discard;
         return color;
}
霧化:

//
// Calculates fog factor based upon distance
//
// E is defined as the base of the natural logarithm (2.71828)
float CalcFogFactor( float d )
{
         float fogCoeff = 1.0;
        
         if( FOGMODE_LINEAR == g_fogMode )
         {
                 fogCoeff = (g_fogEnd - d)/(g_fogEnd - g_fogStart);
         }
         else if( FOGMODE_EXP == g_fogMode )
         {
                 fogCoeff = 1.0 / pow( E, d*g_fogDensity );
         }
         else if( FOGMODE_EXP2 == g_fogMode )
         {
                 fogCoeff = 1.0 / pow( E, d*d*g_fogDensity*g_fogDensity );
         }
        
         return clamp( fogCoeff, 0, 1 );
}

Finally, the pixel shader uses the fog factor to determine how much of the original color and how much of the fog color to output to the pixel.

最后,PS使用霧化參數確定霧顏色和紋理顏色的混合程度。
return fog * normalColor + (1.0 - fog)*g_fogColor;

posted @ 2008-07-20 10:31 bloodbao 閱讀(346) | 評論 (0)編輯 收藏

2008年7月17日 #

剛開始學習DX10,發覺模型文件已經從原來的X格式變為SDKMESH格式,也就是說DX10不直接支持X文件了,
那現在該怎么辦,我在NVSDK下找到了他的解決方案,先用DX9的接口打開X文件,再用DX10接口來渲染文件。
         在DX10下,缺少了很多以前在DX9下的元素。比如,光照,材質等。
         要實現這些元素,就必須在SHADER下手動去實現,那就意味著你必須熟悉圖形學的內容,特別是其中的光照模型等內容。
比如,方向光的實現:
    //directional light-----------------------------------------------------------------
    float3 lightDir = g_lightPos - In.worldPos;
    float3 lightDirNorm = normalize(lightDir);
    float3 SDir = normalize( g_lightPos - g_eyePos);
    float cosGammaDir = dot(SDir, V);
    float dirLighting = g_Kd*dirLightIntensity*saturate( dot( N,lightDirNorm ) );
    //diffuse
    float3 diffuseDirLight = dirLighting*exDir;       
    //airlight
    float3 dirAirLight = phaseFunctionSchlick(cosGammaDir)* dirLightIntensity*float3(1-exDir.x,1-exDir.y,1-exDir.z);
    //specular
    float3 specularDirLight = saturate( pow(  dot(lightDirNorm,reflVect),g_specPower)) * dirLightIntensity * g_KsDir * exDir;
點光源的實現:
  //point light 1---------------------------------------------------------------------
    //diffuse surface radiance and airlight due to point light
    float3 pointLightDir = g_PointLightPos - In.worldPos;
    //diffuse
    float3 diffusePointLight1 = calculateDiffusePointLight(0.1,Dvp,g_DSVPointLight,pointLightDir,N,V);
    //airlight
    float3 airlight1 = calculateAirLightPointLight(Dvp,g_DSVPointLight,g_VecPointLightEye,V);
    //specular
    float3 specularPointLight = Specular(g_PointLightIntensity, g_KsPoint, length(pointLightDir), Dvp, g_specPower, normalize(pointLightDir), reflVect);
計算點光源的漫射光:
float3 calculateDiffusePointLight(float Kd,float Dvp,float Dsv,float3 pointLightDir,float3 N,float3 V)
{

    float Dsp = length(pointLightDir);
    float3 L = pointLightDir/Dsp;
    float thetas = acos(dot(N, L));
    float lightIntensity = g_PointLightIntensity * 100;
   
    //spotlight
    float angleToSpotLight = dot(-L, g_SpotLightDir);
    if(g_useSpotLight)
    {    if(angleToSpotLight > g_cosSpotlightAngle)
             lightIntensity *= abs((angleToSpotLight - g_cosSpotlightAngle)/(1-g_cosSpotlightAngle));
         else
             lightIntensity = 0;        
    }  
   
    //diffuse contribution
    float t1 = exp(-g_beta.x*Dsp)*max(cos(thetas),0)/Dsp;
    float4 t2 = g_beta.x*Gtable.SampleLevel(samLinearClamp, float2((g_beta.x*Dsp-g_diffXOffset)*g_diffXScale, (thetas-g_diffYOffset)*g_diffYScale),0)/(2*PI);
    float rCol = (t1+t2.x)*exp(-g_beta.x*Dvp)*Kd*lightIntensity/Dsp;
    float diffusePointLight = float3(rCol,rCol,rCol); 
    return diffusePointLight.xxx;
}
計算高光:
float3 Specular(float lightIntensity, float Ks, float Dsp, float Dvp, float specPow, float3 L, float3 VReflect)
{
    lightIntensity = lightIntensity * 100;
    float LDotVReflect = dot(L,VReflect);
    float thetas = acos(LDotVReflect);

    float t1 = exp(-g_beta*Dsp)*pow(max(LDotVReflect,0),specPow)/Dsp;
    float4 t2 = g_beta.x*G_20table.SampleLevel(samLinearClamp, float2((g_beta.x*Dsp-g_20XOffset)*g_20XScale, (thetas-g_20YOffset)*g_20YScale),0)/(2*PI);
    float specular = (t1+t2.x)*exp(-g_beta.x*Dvp)*Ks*lightIntensity/Dsp;
    return specular.xxx;
}
下一步,考慮如何不通過DX9接口,直接導入X文件。

posted @ 2008-07-17 10:26 bloodbao 閱讀(868) | 評論 (2)編輯 收藏

2008年7月15日 #

       唉,終于放署假了,我應該做些什么了。
      本來想寫個程序的,可是我發覺自已的自控力太差了。剛摸到一本小說,就被迷住了,以至于這一周都在看那本小說,程序方面是一點進度都有。那是本關于SC的小說,但為一個星際迷,我深深地被吸引了,每當我一摸到電腦,就不自覺地點進小說的網頁中,進入那個SC的虛幻空間。
看完小說,本以為還能干點什么,結果又下了本DOOM啟示錄,又迷進去了。哎,看來小說是不能碰啦,我可不想永遠呆在這個鬼地方。
等找到工作,再看小說吧。
posted @ 2008-07-15 15:53 bloodbao 閱讀(183) | 評論 (0)編輯 收藏

僅列出標題  下一頁
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            美女视频黄a大片欧美| 亚洲人成在线观看网站高清| 亚洲欧美日韩视频二区| 亚洲蜜桃精久久久久久久| 男女av一区三区二区色多| 久久综合免费视频影院| 牛夜精品久久久久久久99黑人 | 亚洲精品一区二区三区av| 亚洲激情另类| 亚洲国产精品一区二区第四页av| 最近中文字幕mv在线一区二区三区四区| 欧美激情性爽国产精品17p| 亚洲黄色三级| 亚洲欧美www| 久久婷婷久久一区二区三区| 欧美肥婆在线| 久久福利精品| 亚洲美女在线国产| 一本色道久久综合精品竹菊| 亚洲一区在线观看视频| 欧美在线日韩| 欧美激情精品久久久久久黑人| 欧美日韩国产黄| 国产精品嫩草99av在线| 国语自产精品视频在线看抢先版结局 | 欧美午夜欧美| 尤物99国产成人精品视频| 亚洲激情综合| 欧美一区二区高清| 欧美激情一区二区三区蜜桃视频| 一区二区三区www| 久久精品国产一区二区三区| 欧美激情 亚洲a∨综合| 国产精品视频1区| 亚洲精品午夜精品| 久久精品九九| 一区二区91| 免费观看亚洲视频大全| 国产精品高潮在线| 亚洲黄色小视频| 久久久久高清| 日韩午夜一区| 免费日韩av片| 国产午夜精品一区二区三区欧美| 亚洲精品久久久久久一区二区| 欧美中文在线免费| 亚洲毛片一区| 欧美jizz19性欧美| 日韩午夜免费视频| 久久这里只精品最新地址| 国产精品国产三级国产aⅴ无密码| 一区二区三区在线视频播放| 欧美亚洲免费| 中文国产亚洲喷潮| 欧美理论大片| 一本色道久久88亚洲综合88| 久久亚裔精品欧美| 国产一区二区电影在线观看| 午夜精品久久久久久| 亚洲精品乱码视频| 欧美久久久久免费| 夜夜嗨av一区二区三区四季av | 久久久久综合网| 欧美亚洲色图校园春色| 国产农村妇女精品| 久久成人一区| 欧美在线视频不卡| 狠狠做深爱婷婷久久综合一区| 久久精品国产69国产精品亚洲| 亚洲欧美激情视频在线观看一区二区三区 | 久久久久欧美精品| 韩日在线一区| 美女福利精品视频| 噜噜噜久久亚洲精品国产品小说| 尤物yw午夜国产精品视频明星| 久久人人爽爽爽人久久久| 欧美综合二区| 激情一区二区三区| 亚洲第一黄网| 欧美激情一区二区三区在线视频观看 | 影音先锋久久久| 欧美波霸影院| 欧美成人一品| 中日韩男男gay无套| 夜色激情一区二区| 国产精品区一区| 久久久成人网| 欧美国产视频日韩| 亚洲小视频在线| 先锋资源久久| 亚洲狠狠丁香婷婷综合久久久| 亚洲国产精品一区二区尤物区| 欧美黑人多人双交| 亚洲婷婷在线| 久久久精品网| 亚洲视屏在线播放| 欧美一区二区三区在线看| 亚洲国产视频一区| 国产亚洲精品高潮| 99re热这里只有精品视频| 久久综合网色—综合色88| 欧美www视频在线观看| 91久久久久久久久| 欧美激情亚洲自拍| 国产精品成人v| 蜜桃av噜噜一区| 欧美午夜在线视频| 欧美二区在线观看| 国产精品午夜电影| 最新国产成人av网站网址麻豆 | 久久久噜噜噜久噜久久| 欧美日韩国产在线看| 久久夜色精品亚洲噜噜国产mv| 欧美日韩岛国| 欧美激情1区2区3区| 国产日韩欧美成人| 亚洲精品视频免费| 亚洲国产精品久久精品怡红院| 亚洲伊人伊色伊影伊综合网 | 欧美日韩在线第一页| 另类专区欧美制服同性| 国产精品一区二区三区成人| 亚洲精品乱码久久久久久日本蜜臀 | 国产综合av| 亚洲午夜国产成人av电影男同| 最新日韩欧美| 久久午夜色播影院免费高清| 欧美一区午夜精品| 国产精品久久久一区麻豆最新章节| 亚洲高清视频在线| 亚洲国产影院| 麻豆精品视频在线| 免费不卡在线观看| 精品白丝av| 久久久久久电影| 毛片基地黄久久久久久天堂| 国产真实精品久久二三区| 午夜国产欧美理论在线播放| 亚洲一区日本| 欧美天堂亚洲电影院在线观看| 亚洲黄一区二区| 亚洲伦理中文字幕| 欧美精品国产一区二区| 欧美激情在线| 日韩一级大片| 欧美日韩国产成人在线免费| 99国产精品久久久久久久成人热| 一本大道久久a久久综合婷婷| 欧美精品一线| 亚洲美女毛片| 亚洲欧美日韩在线综合| 国产精品综合不卡av| 性欧美激情精品| 裸体一区二区三区| 亚洲欧美国产精品va在线观看| 亚洲欧美在线aaa| 久久伊人精品天天| 亚洲大胆在线| 亚洲深夜福利视频| 国产精品视频午夜| 久久国产精品久久久| 男女视频一区二区| 99精品国产在热久久婷婷| 欧美日韩成人综合在线一区二区| 亚洲午夜一二三区视频| 久久九九免费| 亚洲精品日产精品乱码不卡| 欧美午夜精品久久久久久人妖| 亚洲一区二区在线免费观看视频| 久久精品亚洲精品| 亚洲三级电影在线观看| 国产精品久久久久久久久久免费看| 亚洲欧美在线另类| 农夫在线精品视频免费观看| 一本色道久久综合狠狠躁篇的优点 | 亚洲日本中文字幕免费在线不卡| 亚洲综合视频1区| 依依成人综合视频| 欧美视频在线观看一区| 欧美一区二区三区婷婷月色 | 久久精品国产v日韩v亚洲| 亚洲国产日韩欧美| 欧美一级在线视频| 亚洲国产综合在线看不卡| 国产精品久久久久久久久婷婷| 久久亚洲精品中文字幕冲田杏梨| 日韩视频精品在线| 猛男gaygay欧美视频| 亚洲欧美日韩精品久久奇米色影视 | 国产伦精品一区二区三区四区免费| 久久亚洲一区二区| 亚洲欧美成人一区二区三区| 亚洲国产精品小视频| 久久午夜视频| 小黄鸭精品密入口导航| 99国产精品| 亚洲精品免费在线播放| 国产一区二区三区视频在线观看| 欧美日韩一区二区三区免费看 | 欧美激情女人20p|