HomeHome  CalendarCalendar  FAQFAQ  SearchSearch  MemberlistMemberlist  UsergroupsUsergroups  RegisterRegister  Log inLog in  

Share | 
 

 Spark Particle Engine with D3D API

View previous topic View next topic Go down 
AuthorMessage
Dante
Guest



PostSubject: Spark Particle Engine with D3D API   Thu Nov 11, 2010 12:10 pm

when I use QuadRender,I have a problem,I need particles face to the camera,How can i compute the matrix for them!
Back to top Go down
Juff
Developer


Messages : 539
Date d'inscription : 2009-07-14
Age : 34

PostSubject: Re: Spark Particle Engine with D3D API   Thu Nov 11, 2010 3:29 pm

Hi, the default orientation of the renderers is particles facing the camera. So normally, particles are oriented towards the camera by default (unless you have specified another type of orientation).

A screenshot of what you get and a bit of code (the renderer set up) might help to fix your issue.
Back to top Go down
View user profile http://spark.developpez.com
Dante
Guest



PostSubject: code   Thu Nov 11, 2010 10:32 pm

Like GLQuadRenderer ,I wrote a class named DXQuadRenderer. Before render in GLQuadRenderer,you get the gl worldviewmatrix,and compute the invworldviewmatrix.Then you call the function precomputeOrientation3D,I follow your steps in my class.
the code like this:
D3DXMATRIX matWorld,matView,InvmatView;
d3ddevice->GetTransform(D3DTS_VIEW, &matView);
d3ddevice->GetTransform(D3DTS_WORLD, &matWorld);
D3DXMATRIXInverse(&InvmatView,NULL, &matView);

then what can i fill with 3 params in function precomputeOrientation3D(group,Vector3D(?,?,?),Vector3D(?,?,?),Vector3D(?,?,?));

I don't know how to compute the right vectors in your axies,I don't know how to convert.So I need help,Thank you!





Back to top Go down
Dante
Guest



PostSubject: forget to say   Thu Nov 11, 2010 10:40 pm

I forget to say,I use left hand axies in D3D! I fill the vertexbuffer like you do in GLQuadRenderer,I just convert the Z axies! z = -z;
Then I set the D3DTS_VIEW and D3DTS_PROJECTION matrixs like common.
Back to top Go down
Juff
Developer


Messages : 539
Date d'inscription : 2009-07-14
Age : 34

PostSubject: Re: Spark Particle Engine with D3D API   Fri Nov 12, 2010 6:26 am

Ok,

There is a direct3D 9 module on the svn already. It is not part of the official release but should work anyway : https://sparkengine.svn.sourceforge.net/svnroot/sparkengine/trunk/

Maybe you can use it instead of reimplementing the D3D support from scratch.

Otherwise the 3 vectors to pass to the precomputeOrientation3D method are :

  • the look vector of the inverse model view
  • the up vector of the inverse model view
  • the position of the inverse model view
Back to top Go down
View user profile http://spark.developpez.com
Juff
Developer


Messages : 539
Date d'inscription : 2009-07-14
Age : 34

PostSubject: Re: Spark Particle Engine with D3D API   Fri Nov 12, 2010 6:45 am

I have checked the DX9 module in the svn and there seem to be a problem with the inverse modelview computation.

In the module, only the view is used whereas the modelview should be used (ie : view * model) and inverted to get the inverse modelview.
Moreover the look vector passed to the precomputeOrientation3D is inverted and it should not be (because D3D uses a left handed system).

You can take a look at the irrlicht quad renderer which uses a left handed system and a matrix system copied on direct3D. Everything is correct in the Irrlicht module.
Back to top Go down
View user profile http://spark.developpez.com
Dante
Guest



PostSubject: can't solve this problem   Fri Nov 12, 2010 10:49 am

i have tried all the ways that i know! but it doesn't work well ! in d3d,the look vector is in viewmatrix,not in invviewmatrix!i'm confused!
Back to top Go down
Juff
Developer


Messages : 539
Date d'inscription : 2009-07-14
Age : 34

PostSubject: Re: Spark Particle Engine with D3D API   Fri Nov 12, 2010 11:34 am

Basically what we want by doing this is the transform of the view in the model space so that we can set the model's vertices correctly oriented accordingly.

In OpenGL you get only one matrix which is the model view, it allows to pass from model space to view space. As we want the inverse transformation (view to model space), the matrix is inverted.

In DirectX you have a view and a model matrix.
The model matrix transforms from model to world space and the view matrix from world to view space. To pass from model to view, we therefore need to multiply both matrices (in the right order). Then we invert it to get the invmodelview matrix (this can be optimized)

Then you can get the orientation vectors of the matrix which are defined in that order : side, up, look (-look for right handed systems), pos. Either per row or per columns depending on the way matrices are structured. We dont care about the fourth homogeneous parameter of the vectors.

Ill correct the D3D renderer on the svn this week end, so that you will be able to use it directly.

Back to top Go down
View user profile http://spark.developpez.com
Dante
Guest



PostSubject: Thank you Juff   Fri Nov 12, 2010 11:59 am

I really want to say thank you!This problem feaze me these days!I like spark particle engine,so i want to make a editor for it!it's really cool!
Back to top Go down
Juff
Developer


Messages : 539
Date d'inscription : 2009-07-14
Age : 34

PostSubject: Re: Spark Particle Engine with D3D API   Fri Nov 12, 2010 5:54 pm

I have corrected the orientation of quads in the DX9QuadRenderer on the svn. You can check out how it is done.
Back to top Go down
View user profile http://spark.developpez.com
Dante
Guest



PostSubject: solved   Sun Nov 14, 2010 12:55 pm

This problem has been solve,thx!
Back to top Go down
Sponsored content




PostSubject: Re: Spark Particle Engine with D3D API   Today at 3:43 am

Back to top Go down
 
Spark Particle Engine with D3D API
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» disable BFE (base filtering engine) service
» Search engines not working

Permissions in this forum:You cannot reply to topics in this forum
 :: English Forum :: Evolution (en)-
Jump to: