Jump to content
  • Advertisement

CacheMiss

Member
  • Content Count

    19
  • Joined

  • Last visited

Community Reputation

194 Neutral

About CacheMiss

  • Rank
    Member
  1. CacheMiss

    OpenGL Depth Issue

    Thanks Spinning, I knew something was up with it but your comment prompted me to check other parts of the code. I'm using sfml and hadn't provided it with a non-zero bit depth  <_< Normally not something I'd of missed but along with integrating it into forms etc. it slipped by - thank you for taking the time!  :)
  2. Hi all, I've been looking at this for ages, have tried everything I can think of and can't make progress so I need to ask for some help. Long story short: I have a camera at <0,0,0> looking down <0,0,1> and an object at <0,0,3> and am having rendering issues which suggest something is wrong with the depth-test? I've included an image to give you a better idea of what's happening. I've tried changing the depth-test, changing the winding-order, changing the cull-mode, changing the handedness during model loading - none of it helps... My current set-up for depth and culling: glFrontFace( GL_CW ); glCullFace( GL_BACK ); glEnable( GL_CULL_FACE ); glEnable( GL_DEPTH_TEST ); glEnable( GL_DEPTH_CLAMP ); glDepthFunc( GL_LESS ); Any help would be really appreciated. - Thank you
  3. @frob I'd be very interested in hearing more if you'd care to elaborate? :)
  4. I think he's saying that reduced performance is the trade-off you make for a more flexible engine -> one size fits all VS. custom tailored.
  5.   I'd agree with this; more focus on content creation and less focus on visual fidelity. That said, what non-graphics challenges are really left?
  6. Hey all,   I've been wondering for a while, with recent advancements into areas like:   - Physically-Based Rendering - VR - Low-level APIs - Ray-tracing - Improving artist/content-creator workflow (blue-prints/visual scripting etc.)   and others which I've surely missed. I have to ask: what ground is left to break in terms of game engine technology, more specifically, ground that could be broken by a small team or even one single programmer? I can't help but pine for the times described in Masters of Doom, wherein Carmack single handedly pushed the state of the art with things like Adaptive Tile Refresh (Commander Keen), then the advancements he made with the Wolfenstein 3D and DOOM engines.   I appreciate that Carmack wasn't/isn't the only person that's pushed the state of the art forward of course. I'm also aware that things like texture-mapping weren't down to Carmack and that John Abrash was brought in to help build the Quake engine (Quake and the move to true 3d arguably being what broke id). Still, when working/tinkering with my own engine efforts, despite the enjoyment I normally derive from them, I can't help but get a little down thinking it's all been done already (hundreds if not thousands of times at that).   So I have to ask: in your view, what problems are really left to solve as far as game engines are concerned?
  7. CacheMiss

    Frustum Culling Question

    Sorry for my delayed response, thanks for getting back to me Khatharr. Here's some code:   Frustum plane extraction: --- void FirstPersonCamera::ConstructFrustum( const glm::mat4x4& objTransform ) { glm::mat4x4 clipMatrix( GetProjectionMatrix() * GetViewMatrix() * objTransform ); mFrustum.planes[LEFT].a = clipMatrix[3][0] + clipMatrix[0][0]; mFrustum.planes[LEFT].b = clipMatrix[3][1] + clipMatrix[0][1]; mFrustum.planes[LEFT].c = clipMatrix[3][2] + clipMatrix[0][2]; mFrustum.planes[LEFT].d = clipMatrix[3][3] + clipMatrix[0][3]; mFrustum.planes[RIGHT].a = clipMatrix[3][0] - clipMatrix[0][0]; mFrustum.planes[RIGHT].b = clipMatrix[3][1] - clipMatrix[0][1]; mFrustum.planes[RIGHT].c = clipMatrix[3][2] - clipMatrix[0][2]; mFrustum.planes[RIGHT].d = clipMatrix[3][3] - clipMatrix[0][3]; mFrustum.planes[TOP].a = clipMatrix[3][0] - clipMatrix[1][0]; mFrustum.planes[TOP].b = clipMatrix[3][1] - clipMatrix[1][1]; mFrustum.planes[TOP].c = clipMatrix[3][2] - clipMatrix[1][2]; mFrustum.planes[TOP].d = clipMatrix[3][3] - clipMatrix[1][3]; mFrustum.planes[BOTTOM].a = clipMatrix[3][0] + clipMatrix[1][0]; mFrustum.planes[BOTTOM].b = clipMatrix[3][1] + clipMatrix[1][1]; mFrustum.planes[BOTTOM].c = clipMatrix[3][2] + clipMatrix[1][2]; mFrustum.planes[BOTTOM].d = clipMatrix[3][3] + clipMatrix[1][3]; mFrustum.planes[NEAR].a = clipMatrix[3][0] + clipMatrix[2][0]; mFrustum.planes[NEAR].b = clipMatrix[3][1] + clipMatrix[2][1]; mFrustum.planes[NEAR].c = clipMatrix[3][2] + clipMatrix[2][2]; mFrustum.planes[NEAR].d = clipMatrix[3][3] + clipMatrix[2][3]; mFrustum.planes[FAR].a = clipMatrix[3][0] - clipMatrix[2][0]; mFrustum.planes[FAR].b = clipMatrix[3][1] - clipMatrix[2][1]; mFrustum.planes[FAR].c = clipMatrix[3][2] - clipMatrix[2][2]; mFrustum.planes[FAR].d = clipMatrix[3][3] - clipMatrix[2][3]; NormalizeFrustumPlanes( mFrustum ); } ---   Normalizing the planes: --- void NormalizeFrustumPlanes( Frustum& frustum ) { for( U32 i=0; i<6; ++i ) { float mag = std::sqrtf( frustum.planes[i].a * frustum.planes[i].a + frustum.planes[i].b * frustum.planes[i].b + frustum.planes[i].c * frustum.planes[i].c ); frustum.planes[i].a /= mag; frustum.planes[i].b /= mag; frustum.planes[i].c /= mag; frustum.planes[i].d /= mag; } } ---   Testing the sphere against the frustum: bool FirstPersonCamera::TEMP_SphereFrustumIntersection( const Sphere& sphere ) { for( U32 i=0; i<6; ++i ) { float d = ( mFrustum.planes[i].a * sphere.center.x + mFrustum.planes[i].b * sphere.center.y + mFrustum.planes[i].c * sphere.center.z ) + mFrustum.planes[i].d; if( d < -sphere.radius ) { return false; } } return true; } ---   An example of this problem is: placing the camera at <0,0,0> with forward being either <0,0,1> or <0,0,-1> and an object being placed in the scene at positions such as <20,0,0> or <0,0,-5> causes the test to fail. Placing the object at <20,0,0> for example causes the culling to bounce back and forth between working correctly and incorrectly as you rotate about the object on the xy plane.
  8. CacheMiss

    Frustum Culling Question

    Hello again everyone.    Thanks again for taking the time to get back to me previously, if it's alright, I have another question. I've continued experimenting with frustum culling and have essentially found that certain camera position/objection position/camera-forward combinations do not work correctly. As stupid and wrong as it may potentially be I'm assuming there's some relationship between these three things (object-pos, camera-pos and camera-forward)?   Thanks :)
  9. CacheMiss

    Frustum Culling Question

    Hey guys, thank you all for taking the time to get back to me on this, much appreciated.   @GameGeezer: It was after looking at rastertek's tutorial on this topic that I decided to post the question, in the tutorial, he uses only the view and projection matrices (from the looks of it anyway), that's why I thought I was missing a trick or something.   @Tangletail: Thanks for mentioning spatial partitioning, I am indeed aware of this and how it can help you discard large swathes or objects/entities at a time. This is what I'll be looking into in more detail next.   Thanks again everyone :)
  10. Hi all,   I have a quick question regarding my current frustum-culling implementation, that being: is it necessary to factor in the transformation matrix of each game object/entity (it's model->world transform) when constructing the clip matrix? I haven't seen any references sources do this and it sounds very ineffecient to have to reconstruct the clip matrix for each object? I'm currently constructing the clip matrix via : projection * view * model->world and can't help but think that while it works it's wrong in some way...   I can include code if required but I think the question is relatively self-contained.   Any help would be appreciated :)  
  11. CacheMiss

    Axis aligned boxes and rotations

    Thanks, think I have an idea what's up with mine...
  12. CacheMiss

    Axis aligned boxes and rotations

    Thanks for you response @Pilpel, I apologize if it seems like I'm trying to "hijack" the thread (just trying to keep related questions together). I pretty much have the same solution as you, only when I rotate the object the AABB only ever grows in size (never shrinks). Does you approach work in all cases?
  13. CacheMiss

    Axis aligned boxes and rotations

    Hi everyone, I've been having the exact same issues as the OP so I was hoping I might be able to join the discussion here (if anyone is against this I'll happily make my own thread)? I've been attempting to essentially "rebuild" the 8 corner points of the AABB using the current min/max, then I transform them and lastly I get a new min/max by comparing these 8 transformed corner points with the current min/max. However, when I rotate the object the AABB only ever grows in size and scaling simply doesn't seem to work at all (translation works fine). // Bounds indexing: 0 = min, 1 = max void Transform( const glm::mat4x4 &transform ) { // Translation glm::vec3 translation( transform[3][0], transform[3][1], transform[3][2] ); bounds[0] += translation; bounds[1] += translation; // Rotation/scale // Recreate the original 8 corner points from the current min/max glm::vec4 cornerPoints[8] = { // starting from the top left going clockwise; back-face glm::vec4( bounds[0].x, bounds[1].y, bounds[0].z, 0.f ), glm::vec4( bounds[1].x, bounds[1].y, bounds[0].z, 0.f ), glm::vec4( bounds[1].x, bounds[0].y, bounds[0].z, 0.f ), glm::vec4( bounds[0].x, bounds[0].y, bounds[0].z, 0.f ), // front-face glm::vec4( bounds[0].x, bounds[1].y, bounds[1].z, 0.f ), glm::vec4( bounds[1].x, bounds[1].y, bounds[1].z, 0.f ), glm::vec4( bounds[1].x, bounds[0].y, bounds[1].z, 0.f ), glm::vec4( bounds[0].x, bounds[0].y, bounds[1].z, 0.f ), }; // Create "new" AABB for( U32 i=0; i<8; ++i ) { cornerPoints[i] = cornerPoints[i] * transform; // Try and find new min/max if( cornerPoints[i].x < bounds[0].x ) bounds[0].x = cornerPoints[i].x; if( cornerPoints[i].y < bounds[0].y ) bounds[0].y = cornerPoints[i].y; if( cornerPoints[i].z < bounds[0].z ) bounds[0].z = cornerPoints[i].z; if( cornerPoints[i].x > bounds[1].x ) bounds[1].x = cornerPoints[i].x; if( cornerPoints[i].y > bounds[1].y ) bounds[1].y = cornerPoints[i].y; if( cornerPoints[i].z > bounds[1].z ) bounds[1].z = cornerPoints[i].z; } // Lastly, set center and size center = ( bounds[0] + bounds[1] ) / 2.f; size = ( bounds[1] - bounds[0] ) / 2.f; }
  14.   You should make a new thread for that.   I was planning to do that, didn't mean to imply I'd be putting it here. :)
  • 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!