Jump to content
  • Advertisement

newObjekt

Member
  • Content Count

    50
  • Joined

  • Last visited

Community Reputation

208 Neutral

About newObjekt

  • Rank
    Member
  1.   I've already fixed the problem but that made my night. 
  2. newObjekt

    AMD GLSL "subtle" or "quiet" error.

    Haha that is really odd. You might want to submit that as a bug report to OpenGL/Nvidia/AMD. I have no idea how you would go about doing that though.
  3. newObjekt

    AMD GLSL "subtle" or "quiet" error.

    That was it. Some times you overlook the simplest things like that haha. That's kind of embarrassing. I do wonder why AMD let it complie and didn't even try and warn me about it though. I have all the error logging stuff on but the shader compiled without any actual errors.       Didn't know you could write it that way. Thanks. I'm sure I can clean things up like that in a few places.
  4. My GLSL shader in my game engine has a very odd bug that my roomate found today. On his AMD graphics card any model that is skinned/animated is invisible. The models show up fine on my Nvidia card so this is ATI specific. The shaders compile fine on his card and there are no errors in the AMD GPU shader analyzer which is very odd.   We messed with this for a few hours and I found the block of code that causes the invisible models glitch. It's the part of the GLSL vertex shader that does the rotation for skinned meshes. Something here IS causing the problem. If I comment this out everything renders fine but nothing rotates obviously.   Here are all my uniforms, attributes, and varyings in the vertex shader: uniform bool bRotation; uniform vec4 modelPosition; uniform vec4 modelRotation; uniform float modelScale; uniform bool bSkin; uniform vec3 bonesOffset[64]; uniform vec3 bonesPos[64]; uniform vec4 bonesRot[64]; uniform vec4 sunLocation; uniform vec3 sunDir; varying vec3 halfVec; varying vec3 eyeVec; varying vec3 lightVec; varying vec4 position; varying vec3 normal; attribute vec3 indices; attribute vec3 weights; attribute vec3 tangent; varying vec4 nearShadowCoord; varying vec4 farShadowCoord; Here is the part of the vertex shader that is causing the problem: //do rotation i = 0; vec4 v = pos; vec4 rot[3]; vec4 nor[3]; while(i < 3) { vec4 r = bonesRot[int(indices[i])]; rot[i] = vec4(quatRotation(vec3(v.x, v.y, v.z), r), 0.0f); nor[i] = vec4(quatRotation(normal, r), 0.0f); i++; } //Average the rotations by weight and apply them i = 0; vec4 final; normal = vec3(0.0f,0.0f,0.0f); while(i < 3) { final.x += (rot[i].x * weights[i]); final.y += (rot[i].y * weights[i]); final.z += (rot[i].z * weights[i]); normal.x += (nor[i].x * weights[i]); normal.y += (nor[i].y * weights[i]); normal.z += (nor[i].z * weights[i]); i++; } pos = final; And here is the quatRotation() function that is used in the above code on lines 8 and 9: vec3 quatRotation(vec3 v, vec4 r) { float q00 = 2.0f * r.x * r.x; float q11 = 2.0f * r.y * r.y; float q22 = 2.0f * r.z * r.z; float q01 = 2.0f * r.x * r.y; float q02 = 2.0f * r.x * r.z; float q03 = 2.0f * r.x * r.w; float q12 = 2.0f * r.y * r.z; float q13 = 2.0f * r.y * r.w; float q23 = 2.0f * r.z * r.w; vec3 f = vec3(0.0f,0.0f,0.0f); f.x = (1.0f - q11 - q22) * v.x + (q01 - q23) * v.y + (q02 + q13) * v.z; f.y = (q01 + q23) * v.x + (1.0f - q22 - q00) * v.y + (q12 - q03) * v.z; f.z = (q02 - q13) * v.x + (q12 + q03) * v.y + (1.0f - q11 - q00) * v.z; return f; } I have no idea what's actually wrong with my code. I develop on Nvidia and everything works great. I'm stumped D:
  5. Yeah I implemented KryoNet into my engine a couple of weeks ago. It's great. It's much easier to work with than Java Socket.
  6.     Yeah, I used Native Java Socket originally and it worked but it was very finicky and sometimes it would refuse to connect for unknown reasons. KryoNet so far has been very good. It was a little annoying to build the jar for it and get all the build paths set up but it's so easy to use and it's very stable. It's great. I'd recommend it to anyone who needs a fast and simple Server/Client set up.
  7. Alright, so to start off I am currently using the native Java Socket implementation and everything works fine. I'm planning on rewriting the networking portion of the game engine to improve and clean it up and I'm not sure if I should move to another API or not.   From what I've read, my options are: Native Java Socket Java Fast Socket RMI   The game engine in question is 3d, with an aim of 2 - 24 players on a server at a time. I use floats for location/velocity/rotation updates.   What would be the best option? Latency and stability are extremely important. No one likes lag and random disconnects.   Also, there is an API I saw a while back that was an optimized network packet API for Java. I can't remember the name unfortunately... Anyone know what it was called?     -edit-   And of course, I immediately find some good anwsers after I post this thread.   Looks like I should use Kryonet which is designed for this kind of thing, or I should build my own thing off of Java NIO.
  8. There's a glitch at 0:36     That's most likely just encoding. When I record my desktop with ffmpeg it tends to skip a few frames every once and a while.
  9. Made the changes and problem is solved. Thanks again AllEightUp.  
  10.   Keep in mind that this is an "overall" performance item.  It won't likely show up notably unless you really beat on things.  I.e. early engines won't show any notable difference, only when you have a fair sized simulation are you likely to notice the difference in major ways.  Any initial game is likely not to see any benefit, only when your simulation times start eating up notable portions of your frame time does this really make a difference.     Yeah I very well understand that. When I want to stress test something I make the engine load the BSPs of 5 maps at once or spawn in 200 bouncing physics boxes. Etc etc... Regardless you seem very knowledgeable about this so I'd take your word that it will make a difference either way. :P
  11.   Alright. I'll make that my project for tomorrow. Out with Euler in with Quat. I understand Quat moderately well as I have worked with it extensively with skinned meshes and animations. It'll be nice to have the whole engine using the same rotation code heh.   I'll also make a branch and convert the engine from doubles to floats and see how much of a difference it makes since it sounds like it might have an impact on performance.   Thanks for the advice. Cheers.
  12. This is unlikely gimbal lock and more than likely a simple math problem.  The problem is likely 'related' to gimbal lock but not in the way you might be thinking.  Converting from quat to euler can and should be a perfect operation, there is no orientation which can not be represented in euler, but the way you perform the conversion has to account for the order of rotations which Euler implies, as such as things near various axis' the order of rotations will cause changes in how the Euler angles are represented.  Assuming a fairly normal Euler representation, most will be BPH ordered if I remember correctly.  (Bank, pitch then heading.)  If your engine uses a different order then the conversion of a quat to Euler will likely look correct in 90% of the cases and then do what I see in the video, all of a sudden change.   Overall, if you are using Euler for rendering, you have got to change it.  It's just a bag of pissed off cats waiting to bite you.  Euler angles are great for UI representations, pretty much everywhere else, avoid them like the plague.   Yeah, the use of Euler was a choice I made before I had much experience. Won't ever do it again in the future. As it stands just actor rotations use Euler angles. Animations and what not use Quaternions.   As for the ordering, I might have it wrong. I will swap them around tomorrow morning when I start working and see if it solves the problem.   Looking for an honest opinion, should I just go ahead and rewrite the actors to use quats and call it done? I believe I have a quat slerp fucntion already written for animations (not on linux atm so can't check) so I could pretty easily convert it. It'd take maybe an hour or two to do it.   Oh and here's a random question. How much of a speed difference is their between using floats and doubles for graphics and physics. I was considering switching to floats if it's a big enough difference.
  13. Ah okay. Can MotionStates give me the rotation in Euler angles?  My engine currently requires that I get object rotations in Euler angles but I can convert the engine to use Quaternions if that will fix the problem I am having with the spastic rotations.   With the .getBasis() method I assume the matrix would be: location.x rotation.x velocity.x location.y rotation.y velocity.y location.z rotation.z velocity.z   Or something similar?
  14. Here's a quick video I recorded:     Currently I am using bullet physics to calculate my RigidBody physics actors. After each bullet step I basically run this code on my RigidBody game actors to get their position and rotation from bullet.         //the variable "physics" is the bullet RigidBody object         Vector3f c = physics.getCenterOfMassPosition(new Vector3f());         setLocation(new Vertex(c.x, c.y, c.z + 10));         Quat4f q = physics.getOrientation(new Quat4f());         setRotation(MathUtil.convertQuat2Euler3(new Quat(q.x, q.y, q.z, q.w)));   Problem A: I'm currently converting the Quaternion that is returned by the RigidBody to an Euler angle then applying that to the object and rendering. I'm like 99% sure thats causing gimbal lock. I can rewrite my renderer to use Quat's instead of Euler angles and solve the problem if that is it. It's a lot of work though so I want to confirm that this is the problem.   Problem B: I have to add 10 to the location.z value of the RigidBody for some odd reason. I have no idea why.   Thanks :)
  15. newObjekt

    I don't even know where to begin - Licenses

    Ah alright. I'm going to call and talk to a local law firm and see how much it would cost. Being super broke is hard D:
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!