Post

 Resources 

Console

Home | Profile | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 VBGamer
 VBGamer
 D3D9 How To Combine vert alpha with texture alpha
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

cbx
Swordmaster

Canada
296 Posts

Posted - Apr 10 2003 :  12:12:33 PM  Show Profile  Visit cbx's Homepage  Send cbx an ICQ Message  Click to see cbx's MSN Messenger address  Send cbx a Yahoo! Message  Reply with Quote
The D3D9 managed "How to" docs has a "Blend a texture with vertex color" example. But, what I think many people want is to apply a texture to there mesh and use the vertex color for setting the ammount of transparency. I am posting this because from the fourm posts that I have read, many people are having trouble doing this.


1: To do this make sure you load your texture with a color key. For example ...

Public Function Add(ByVal Dev As Direct3D.Device, _
ByVal Filename As String, ByVal ColorKey As Color) As Integer
Dim Tex As Direct3D.Texture

Tex = Direct3D.TextureLoader.FromFile(Dev, Filename, _
0, 0, 1, 0, Direct3D.Format.Unknown, _
Direct3D.Pool.Managed, Direct3D.Filter.Linear, _
Direct3D.Filter.Linear, ColorKey.ToArgb)

Return Add(Tex)
End Function


2: Then spesify these texture states when you render your verts ...

' Blend a Texture with Vertex Color
.TextureState(0).ColorOperation = _
Direct3D.TextureOperation.Modulate
TextureState(0).ColorArgument1 = _
Direct3D.TextureArgument.TextureColor
.TextureState(0).ColorArgument2 = _
Direct3D.TextureArgument.Diffuse
.TextureState(0).AlphaOperation = _
Direct3D.TextureOperation.Modulate

... These are the same texture states that you find in the how to example but with one difference. The last line of code ...

.TextureState(0).AlphaOperation = _
Direct3D.TextureOperation.Modulate

... specifies modulate instead of disable.

Created by: X
http://www.createdbyx.com/
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
VBGamer © Go To Top Of Page
This page was generated in 0.09 seconds. Snitz Forums 2000

Copyright © 2002 - 2004 Eric Coleman, Peter Kuchnio , et. al.