會員登入 新使用者?立即註冊

這是一個以Visual C++、XNA、3ds Max、DirectX9、Unity為主的部落格,主要內容是我在各討論網站的問與答,還包含我的技術性文章,大部分都附有完整程式碼,其他還有關於語音辨識與影像處理的程式,遊戲攻略、圖學與電腦技巧的相關資料。

關閉
你好,歡迎參觀我的部落格! 我要留言

最新文章

分類: XNA Article
2012/05/18 22:30

custom effect兩個方法都可以,後者比較簡潔

//method1

   myEffect.Parameters["World"].SetValue(myWorld);
   myEffect.Parameters["View"].SetValue(myView);
   myEffect.Parameters["Projection"].SetValue(myProjection);

   foreach (ModelMesh mesh in myModell.Meshes)
   {
    foreach (ModelMeshPart meshPart in mesh.MeshParts)
    {
     graphics.GraphicsDevice.Indices = meshPart.IndexBuffer;
     graphics.GraphicsDevice.SetVertexBuffer(meshPart.VertexBuffer);

     foreach (EffectPass currentPass in myEffect.CurrentTechnique.Passes)
     {
      currentPass.Apply();
      graphics.GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, meshPart.NumVertices, meshPart.StartIndex, meshPart.PrimitiveCount);
     }
    }
   }

 //method2

 myEffect.Parameters["World"].SetValue(myWorld);
  myEffect.Parameters["View"].SetValue(myView);
  myEffect.Parameters["Projection"].SetValue(myProjection);

   foreach (ModelMesh mesh in myModell.Meshes)
   {
    foreach (ModelMeshPart part in mesh.MeshParts)
    {
     part.Effect = myEffect;
    }
    mesh.Draw();
   }

reference:  custom effect with mesh Draw

回應(0) 引用(0)
分類: 美術
2012/04/24 00:03




20120424

右上角的筆刷可以設定回來

 

回應(0) 引用(0)
分類: 日記
2012/04/23 23:03

iOS SDK 開發範例大全 (The iOS 5 Developer's Cookbook Core Concepts and Essential Recipes for iOS Programmers, 3-e)

精通 Objective-C 程式設計, 4-e (Programming in Objective-C, 4-e)

百變CG 電繪職人技

 

回應(0) 引用(0)
分類: XNA skills
2012/04/21 21:26

Q:

I want to draw a quad with red color, but xna always show the white quad. Does somebody know how to solve this problem?

1 VertexPositionColor[] hpVertex;
2 VertexBuffer hpVertexBuffer;
3 BasicEffect hpBasicEffect;
4
5 Init
6 hpBasicEffect = new BasicEffect(device);
7
8 float hpHeight = 0.20f;
9 float hpWidth = 1.0f;
10
11 hpVertex = new VertexPositionColor[4];
12
13 hpVertex[0] = new VertexPositionColor(new Vector3(0.0f, hpHeight, 0.0f), Color.Red);
14 hpVertex[1] = new VertexPositionColor(new Vector3(hpWidth, hpHeight, 0.0f), Color.Red);
15 hpVertex[2] = new VertexPositionColor(new Vector3(0.0f, 0.0f, 0.0f), Color.Red);
16 hpVertex[3] = new VertexPositionColor(new Vector3(hpWidth, 0.0f, 0.0f), Color.Red);
17
18 hpVertexBuffer = new VertexBuffer(device, VertexPositionColor.VertexDeclaration, 4, BufferUsage.WriteOnly);
19 hpVertexBuffer.SetData (hpVertex, 0, hpVertex.Length);
20
21 Draw
22
23 hpBasicEffect.World = Matrix.Identity;
24 hpBasicEffect.View = camera.view;
25 hpBasicEffect.Projection = camera.projection;
26
27 foreach (EffectPass currentPass in hpBasicEffect.CurrentTechnique.Passes)
28 {
29 currentPass.Apply();
30
31 device.SetVertexBuffer(hpVertexBuffer);
32 device.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 2);
33 }

 

A:

try adding this in Init

hpBasicEffect.VertexColorEnabled = true;

and if you still get white, make sure the lighting is off

hpBasicEffect.LightingEnabled = false;

 

Q:

Thanks! My problem is solved. But I have another problem.
If I enable lighting, like hpBasicEffect.LightingEnabled = true; , and then XNA will crash at Line 10 and appears the error message as below:

The current vertex declaration does not include all the elements required by the current vertex shader.

Does somebody meet the situation and solve it?

1 foreach (EffectPass currentPass in hpBasicEffect.CurrentTechnique.Passes)
2 {
3 currentPass.Apply();
4
5 device.SetVertexBuffer(hpVertexBuffer);
6 device.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 2);
7
8 }
9
10 spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);

 

A:

If you enable lighting your vertex data has to include normals. VertexPositionColor does not, hence the error.

 

reference: VertexPositionColor vertex, vertex color problem

回應(0) 引用(0)
分類: 日記
2012/04/11 01:25

2012年連任微軟XNA/DirectX MVP,要多加努力寫技術文章

回應(0) 引用(0)
2012/04/11 00:29

安琪拉-心地善良的女孩,卻因為想獲得永恆的生命,而背叛自己的良心,化身為正義的天使--西卡莉,其實真實的面目是個吸取靈魂的惡魔。影響她心智的東西就是"光水晶",由於這是一種完全正義意識的礦物,過度地視惡如仇,不容許有任何錯誤產生,所以使用者會有一種將世界所有惡的事物剷除的使命。

20120408 低模型面數

20120409 拆UV,剩下半邊頭髮

 

20120411 移除頭髮多餘的面,並重拆UV

 

20120414 上色,prototype的模型我必須耐心地做完,把程式寫完,再看看是否可以加面數,現在先用最低規格製作,動畫到位就可以了

回應(0) 引用(0)
分類: Unity
2012/04/03 23:40

安裝步驟

1.應用程式的未知來源要打開

2.到Market下載AndExplorer

3.將編譯好的APK檔透過檔案總管放到手機的SD Card空間

4.開啟AndExplorer安裝APK

 

如果遇到APP無法關閉,請先按下Home Button,先到Market下載Advanced Task Killer ,選取要移除的APP,然後移除

 

PS:

什麼是 APK?要如何手動安裝 Android 的軟體呢?

How to Close all Active Apps in Samsung Galaxy S

回應(0) 引用(0)
2012/04/01 00:00

烏德--心機很重,以自我為利益的中心。遊說神族與魔族之間,是一個交談的能手。雖然說是牆頭草,但這卻是亂世的生存之道。烏德因為在教導葛瑞斯的時候,發現他的潛能超越自己本身加上元素石的能力,才生出歹念。日後卻良心發現,與主角們救出葛瑞斯。

 

20120401

差一條線的效果




 

20120402

加骨架

 

20120407

Figure Mode輸出XFile會有問題,動畫不會動

Unwrap UVW需要Collpase to "Unwrap UVW",否則貼圖顯示會有問題

 

Collpase to  "Unwrap UVW"後,材質就正常了

 

回應(0) 引用(0)

部落格聯播

搜尋

站長工具

個人相片
天秤座

統計資料

  • 今日人數:7
  • 累計人數:42973
  • 發表文章:733
  • 相片數量:358
  • 回應數量:47

文章分類

  1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31  

更新日期

2012/05/18 22:30

Blogger

BlogAD

微軟技術支援小

Win 7

雅虎資訊 版權所有 © 2012 Yahoo! Taiwan All Rights Reserved
「本服務設有管理員」 服務條款 隱私權政策