• Content count

  • Joined

  • Last visited

Community Reputation

128 Neutral

About Zaph-0

  • Rank
  1. Quote:Original post by jyk Quote:I need the euler angles for a sort of steering behaviour where I need to know the angle the object is facing in all 3 directions to calculate its behaviour relative to other objects in the area.I don't believe it :-) Ok, maybe I'm wrong, and you do need Euler angles here, but I'll continue to play devil's advocate anyway. Say you have an object, A, and want to determine its behavior based on the relative position (and possibly orientation) of object B. Take A's transform, invert it, and multiply it with B's transform; this will give you B's transform expressed in A's local space. It seems to me that this would give you pretty much all the information you'd need for the purposes of AI. From this, you can determine whether the object of interest is above or below, to the right or to the left, in front or behind, facing away or facing towards, etc., and can then apply steering behaviors as appropriate. It's not really clear to me how this would be easier to accomplish using Euler angles. Euler angles would be easier because I don't only need how the locations relative to another but also the angles they are facing each other in global numbers. And even if it would work with matrices I made a huge chunk of AI and steering behaviour that took me ages to perfect and don't really want to change it. So euler angles it is... ^_^
  2. Quote:Original post by jyk Quote:Original post by Zaph-0 Quote:Original post by jyk Not sure if I understand the question completely, but if you store the orientation in matrix or quaternion form (rather than as Euler angles), you can apply whatever rotations you want to it on a per-update basis. Thats exactly what I cannot do as I need to keep the rotation as numbers (euler angles) for other things that are going on. As I understood it I cannot go back from a rotation matrix to the angles and I need them so I have to do it this way.I'm always a little skeptical when people say they 'have to have' Euler angles - can you say anything about what you need them for? Anyway, it is possible to convert a rotation matrix to a set of Euler angles. It's a little tricky, and the solution is often non-unique, but if you need to go back and forth for some reason, it's certainly possible. I need the euler angles for a sort of steering behaviour where I need to know the angle the object is facing in all 3 directions to calculate its behaviour relative to other objects in the area. Is there no way where I can simply rotate the 3 angles as if I were applying rotation matrices one after the other ?
  3. Quote:Original post by jyk Not sure if I understand the question completely, but if you store the orientation in matrix or quaternion form (rather than as Euler angles), you can apply whatever rotations you want to it on a per-update basis. Thats exactly what I cannot do as I need to keep the rotation as numbers (euler angles) for other things that are going on. As I understood it I cannot go back from a rotation matrix to the angles and I need them so I have to do it this way.
  4. Hi guys, as the title says, I have a question regarding the rotation of an object. When I render an object right now I create its rotation matrix at render time like this: D3DXMatrixRotationYawPitchRoll(&rotationmatrix, y , x , z ); For this I need to have the individual x,y,z angles at render-time to create the rotation matrix. The problem I have now is that I want to rotate an object several times (always based on the preceeding rotation). I cannot simply add the angles onto another (x on x, y on y, etc...) because then they are not aware of the other axis angles and the rotation turns out wrong. Its like a merry-go-round that keeps rotating around its z-axis and even if you tilt the ground (x or y axis) the z-axis tilts as well and it keeps rotating around the tilted z-axis. What I want is that at subsequent rotations the angles are calculated as if the already rotated object was not rotated and the rotation affects now all 3 axis accordingly. It would be much easier if I would simply calculate several rotation matrices and apply them one after the other (I think that should work) but I do some complicated math with the angles so I cannot change my approach and need to create the whole rotation (as mentioned above) at render time. I am not sure how I can do this and would really appreciate some help.
  5. c++ mfc and cdialog

    Hi, I use mfc with dx9, maybe that can help you somewhat: I create an mfc app (any kind will do, view/doc, dialog, etc...) and then create an extra cwnd with the parent set to the cwnd of the app window: screenwnd.CreateEx(parent, x, y, cx, cy); and then create the dx device with the wnd handle of the created cwnd: d3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, screenwnd.m_hWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &d3dpp, &d3ddevice ); and then when I do: d3ddevice->Clear(); d3ddevice->BeginScene(); ..Render... d3ddevice->EndScene(); d3ddevice->Present(&visiblerc, NULL, NULL, NULL); I see the rendered screen.
  6. Quote:Original post by NumberXaero Unfortunately Im yet to find a an exporter for the more complex formats that isnt broken in some way (fbx, COLLADA, etc.). Ah, thats really bad. I mean, didn't anyone who got a usable version running that somehow just exports geometry, material and matrix based animation ? Quote:Original post by NumberXaero Which version of max are you using? I am using 3ds Max 2010 32-bit on xp. I cannot use another version as that is the only one available to me. Quote:Original post by NumberXaero I wouldnt use the built in collada exporters, the OpenCOLLADA exporters work pretty well I find. Yeah, the built in exporter created broken geometry while that at least looks alright with the opencollada exporter. Quote:Original post by NumberXaeroIm curious how the materials are coming out wrong, I know of a at least one bug with materials having to do with specular level textures in OpenCOLLADA, why you dont get any animations is odd, they always worked for me. Or is it that the viewer just doesnt support them. What I find strange is that the materials are black/look off on the same parts of the object where the ogremax exporter somehow made them look translucent or kind of rendered the backfaces. In max everything looks ok, though so I am a little confused with this. Could you recommend a Collada Viewer that supports animation ? Quote:Original post by NumberXaero It seems the only way to get a flawless export the way you want it is to write one yourself. All exporters seem broken in some way if you use them long enough and exhaust all the features. COLLADA aimed to support everything and be easy to understand and use, but a lot of poorly written code that didnt follow or misinterpreted the spec sort of knocked it off track. Maya COLLADA seems to work very well, 3DS Max has loads of problems unfortunately. Is there a place where I can start with that ? I really don't want to waste any time with something basic like this which I thought wouldn't be an issue at all. I mean, I'd still use my old 3ds importer if not for the animation...
  7. Yeah well, I considered it, but I don't really want to. It's way too much effort that I am sure someone else has done before and I don't really need to duplicate. I mean, thats what (open) formats are there for. And considering how many broken exporters I found so far, I don't really think its all that easy or they wouldn't all fail that badly. The last thing I need now is to invest alot of time into something like writing a max exporter and then find out its a flaw in max. It is somewhat irritating that most exporters seem to have problems with the mostly same parts of my object (and the animation). I already wasted lots of time writing an x-file importer (can't use d3dx) just to find out the x-file exporters don't really work for my mesh.
  8. Hi, thanks for your reply. I just tried collada and it looks as if the export using the built-in autodesk collada exporter as well as the opencollada export plugin you mentioned deliver broken results. While both of them export wrong materials for some objects the built-in autodesk collada exporter creates also misplaced objects. And neither of them seems to export any animation at all, although I selected the animation option for the exported file. Well, at least no viewer was able to show me any animation at least. Strangely the ogre exporter showed me the same parts as strangely transparent looking that the opencollada exporter had problems with (completely black objects in the viewer). Is there maybe something I need to do before exporting or is there maybe something else that I could use ? I mean, I cannot be *that* hard to export a somewhat complex object, or can it ?
  9. Hi, as the title already says, I need to somehow import 3DS Max files with animation. I don't think importing a .max file is practical therefore I think about exporting a file from max in a different format and then importing that. I already tried the panda x-porter and kw x-port x-file and the ogremax .mesh exporter but they all gave broken results with the geometry being off. As I need the animation in a matrices-format and not like .3ds where the full meshes are included for every frame I am not sure which format to choose. There are a few that formats Max can export by default like fbx, dae, dwf and others but I am not certain about how (or even if) anyone of them includes animation and delivers usable results. The material is not important as long as it exports the name of the material used in max. I don't really care about which format as long as it has the full geometry, matrix-based simple animation and doesn't take too much time to code an importer for my app. Thanks for any advice...
  10. How to make billboards ?

    Ah, it seems I got it working, but I found a few things a little strange so I'm not sure what to make of this. 1. Instead of using the position x,y,z at m.14, m.24, m.34 they are at m.41, m.42, m.43. 2. The billboard is being displayed clockwise and must be created that way. Ah well it works, thats all that matters for now... ^_^
  11. How to make billboards ?

    Hi, thanks alot for your reply. I read your link but unfortunately I don't really understand how to implement it. I created a matrix from the view matrix like you mentioned there which looks like this: matBillBoard._11 = matView._11; matBillBoard._12 = matView._21; matBillBoard._13 = matView._31; matBillBoard._14 = x; matBillBoard._21 = matView._12; matBillBoard._22 = matView._22; matBillBoard._23 = matView._32; matBillBoard._24 = y; matBillBoard._31 = matView._13; matBillBoard._32 = matView._23; matBillBoard._33 = matView._33; matBillBoard._34 = z; matBillBoard._41 = 0; matBillBoard._42 = 0; matBillBoard._43 = 0; matBillBoard._44 = 1; I have now 3 questions to this. 1. Is this correct ? 2. what exactly is x,y,z ? I tried putting there some values but to no avail. 3. How do I exactly apply this matrix ? My usual way of applying matrices is like this: object->matObject * matWorld * matView * matProj; How does this new matrix fit into there ? Thanks in advance... ^_^ [Edited by - Zaph-0 on December 27, 2009 6:00:33 PM]
  12. Vertexshader - No z-test?

    might sound stupid, but is the zbuffer enabled ? d3ddevice->SetRenderState( D3DRS_ZENABLE, D3DZB_TRUE );
  13. Hi guys, I've been combing the internet for hours and found (as usual) nothing useful. I want to do billboards with c++ and dx9. The reason I chose billboards over point sprites is that I want to rotate them and I heard thats not that easy possible with them and they are just generally to unflexible. Anyway, I managed to display a bunch of objects but now I want to display billboards for some special effects. For that I made a square out of 2 triangles that I display a texture on which works pretty good, but of course I cannot apply my usual matrices because when the camera position moves I look on the billboard from a different angle until it disappears (backface, etc...). The point of the billboard is that its always facing the camera and that is where my problems start. The way I take it I have to rotate every billboard according to the angle it is regarding to the camera, right ? Or is it enough to simply rotate all billboards that they are parallel to the viewing plane ? I am not really sure and would appreciate any help with this, especially as to how I create a new view matrix/matrices for the billboards.
  14. Hi, I have a little Problem and hope anyone of you can help me with this. I have 2 identical transparent objects in 3D space. From the Camera object one (lets call it A) is behind the other one (lets call this one B). Obviously A looks smaller as it is further away. And on screen it looks as if they are centered around the same point, which of course they aren't in 3D space but only because of the conversion to 2D and the current camera position. My problem now is that I need to increase the scale of object A so that the they match each other on screen. In 3D space object A would be much bigger than object B but because B is closer they would look the same. Kind of complicated but I can't really figure the math out as to how to scale object A based on its distance to B. I would really appreciate some help with this. Thanks in advance.
  15. Changing it to int4 changed nothing but changing the code to if((In.VertexData.g > 99.9) && (In.VertexData.g < 100.1)) { Out.Color = tex2D(Tex0, In.Texture) * float4(0,1,1,1); } else { Out.Color = tex2D(Tex0, In.Texture); } seems to have done the trick as it works every time now. I think thats a really lame solution because then I could have just used the color arguments from 0.0 to 1.0 that are supported everywhere instead of the less common ubyte4 where I can use values from 0 to 255. I would never have thought that floats are that unprecise. I know that I can not make exact comparisons after I did some math with the floats but those where just set and passed along. Well, I guess my gpu is taking some shortcuts somewhere... Maybe I'll just round the value. That seems to work as well. Thanks for your help. ^_^