Jump to content

  • Log In with Google      Sign In   
  • Create Account


AlanWu

Member Since 03 Dec 2012
Offline Last Active Apr 10 2014 04:32 AM
-----

Posts I've Made

In Topic: DirectX: Questions about Alpha blending !Help !

03 January 2014 - 04:32 PM

I'm not entirely sure on questions 3, 4 and 6, that's why I rather not answer them.

 

So take these with a grain of salt (answer might be wrong):

 

3)

I didn't find any mention of separate blending. My guess is you mean multi-pass blending? If you do, it means to build the final color of a pixel by several draw calls after each other.This lets you combine more than two sources for a final image.

 

4)

Not really as far as I can see. You could however inject your custom factor by changing the vertex alpha or color by using D3DBLEND_SRCCOLOR or D3DBLEND_SRCALPHA. A different way could be changing the material attributes.

 

6) Not directly as far as I can see. This is a prime example for multi-pass blending though.

Ok. I see.

Thank you so much!


In Topic: DirectX problem:DrawIndexedPrimitive not working with more than 2 triangle

02 January 2014 - 08:16 PM

 


For the NumVertices . I don't think you are right. MSDN:
NumVertices [in] UINT

Number of vertices used during this call. The first vertex is located at index: BaseVertexIndex + MinIndex.

 

Well, since you are using a index buffer, you are really drawing 6 vertices (or 12 respectively), and not 4. Four sort of worked with the trianglestrip since for a strip, 4 indices form a quad, but each index gets expandet to its corresponding vertex, so unless I am very mistaken (I'm just recalling this from the top of my head) it should be the number of indices in a index-buffer driven render process here. Or is it working the way you have it now with trianglelist and 4/8?

 

I think I am correct because the writer of Inroduction to 3D GAME Programming with DirectX 9.0 write this code:

Device->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, 8, 0, 12);

It is a cube. It has 8 vertices, 6 surface (12 triangles).


In Topic: DirectX: Questions about Alpha blending !Help !

02 January 2014 - 05:01 PM

Regarding 1) Where do you take the (as,as,as,as) or (as,rs,gs,bs) statements from?

 

2) D3DBLEND_SRCBLEND with D3DBLEND_SRCALPHA just tells Direct3d to take the source blend factor for the modulation formula from the source alpha.Whether and how color and alpha is treated is determined by D3DTSS_COLOROP and D3DTSS_ALPHAOP.

 

5) For color operations all colors are projected as float from 0.0 to 1.0. So 255 (= 1.0) * 255 (= 1.0) becomes 255 (1.0)

Thank you a lot. I understand it now.

For Question No.1, (as,as,as,as) is from MSDN. http://msdn.microsoft.com/en-us/library/windows/desktop/bb172508(v=vs.85).aspx

What about Question No.3 ,4 and 6?


In Topic: DirectX: Questions about Alpha blending !Help !

01 January 2014 - 07:47 PM

I think this might answer a few of your questions.

No. It doesn't. But thank you!

 

Anybody else can help me?


In Topic: DirectX problem:DrawIndexedPrimitive not working with more than 2 triangle

31 December 2013 - 06:17 PM

 


Device->DrawIndexedPrimitive(D3DPT_TRIANGLESTRIP,0,0,4,0,2);

 

D3DPT_TRIANGLESTRIP is wrong. You want D3DTP_TRIANGLELIST. Check google for what a trianglestrip actually is, I'm not really good at describing this kind of thing, but lets just say for generally unconnected triangles (you know, except that the indicies of the neighboring triangles align), you almost alway want a triangle list.

 

Also, you shouldn't specify "4" here, its not the number of vertices from the vertex buffer you set for numVertices, its the number of indices from the index buffer. So it should be "6" or "12" respectively, since you are drawing 6 vertices per quad really and not 4.

 

 

Well. I see where I did wrong. It is because of the D3DPT_TRIANGLESTRIP. I made it a other way round.

For the NumVertices . I don't think you are right. MSDN:

NumVertices [in] UINT

Number of vertices used during this call. The first vertex is located at index: BaseVertexIndex + MinIndex.


PARTNERS