Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Everything posted by CacheMiss

  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. 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?
  4. @frob I'd be very interested in hearing more if you'd care to elaborate? :)
  5. 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.
  6.   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?
  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. 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 :)  
  9. 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 :)
  10. 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 :)
  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. :)
  15. Hello all,   I'm approaching the end of my time at university and have been applying for a number of game development positions (programming, preferably engine/core-tech). However, I'm sad to say I have not been having much luck as of late; complete honesty: the two rejections I have so far both pretty much claim my C++ is "not yet where we need it to be". Beyond that they give no feedback so I'm unsure as to how I can improve; I appreciate some may say write more code (practice etc) but surely without some feedback to point out your weaknesses simply writing more code/practice isn't as effective as it could otherwise be?   One test for example was to write a function which given a string-based representation of an integer could produce an integer with the same value, to which I gave this solution (I'd like to reduce it to one loop if possible, however the test was timed and I had to rush a bit, I'm sure there are other optimizations that could be made). I'm just giving this as a piece of example code, I could provide more if anyone wants as I very much want to learn and improve. int ConvertStringToInt(char *c) { bool isNegative = false; if(*c == 45) { isNegative = true; ++c; } int size = 0; while( *c >= 48 && *c <= 57 ) { ++size; ++c; } c -= size; int returnValue = 0; for( int i=0; i<size; ++i ) { returnValue += (*c - 48) * std::pow(10, size-(i+1)); ++c; } return isNegative? -returnValue : returnValue; } I'm not going to lie, the whole thing has me feeling very down; I'm not looking for sympathy though, I'm eager for some advice on how I can improve and hopefully do better in future applications.   Thank you everyone, - Jamie
  16. Josh, sorry, wasn't trying to put words in your mouth there. I will say though that I think (while it wasn't in the brief) that it may be worth taking into consideration, hence I added it more for flexibility than anything. Also, I will indeed get involved in the projects going on here once my current project is finished up (shouldn't take long), I'll also put large portions of the code up here for review.
  17.   That is beautifully simple, however the question/brief did say it should handle negative values (- prefix) and Josh makes a case for supporting '+' as a prefix (the switch boiled down to fewer assembly instructions than an if else. Taking some inspiration from the link though I've come up with this (which also boils down to fewer assembly statements): int ConvertStringToInt( const char *string ) { char sign = 1; switch( *string ) { case '-': sign = -1; case '+': ++string; break; } int value = 0; while( *string >= '0' && *string <= '9' ) { value = ( value * 10 ) + ( *string - '0' ); ++string; } return value * sign; } I like this much more because it solves the two loops issue; it rids me of worrying about having to know which power I should raise 10 to each loop iteration. Anyway, I don't want this to be all about string-to-int (though if the code can be further improved please say), I'm really looking for advice on technical interviews.   Thank you all.
  18. Thanks for your reply Josh, I did indeed make a small mistake in describing the function intent and thank you for the critique, you make many valid points and I shall go back and revise the code with them in mind (I'll also post some personal project work for critique). The only thing I will say is the brief for the question said it was safe to assume a valid string (one representing a numerical value) was being passed, hence the absence of a check for non-sensical values. I also appreciate that interview are to give a look into ones thought process, though this test was done remotely, not on site.   - Jamie    Edit: Improved the code a bit with your feedback in mind (I'm going with the assurance made in the test that a non-null, integer value in string form will be passed). Also replaced the conditional at the end as it resulted in 11 assembly instructions, whereas the multiply is only 2. int ConvertStringToInt( const char *string ) { char sign = 1; switch( *string ) { case '-': sign = -1; case '+': ++string; break; } int size = strlen( string ); int returnValue = 0; for( int i=1; i<=size; ++i ) { returnValue += ( *string - '0' ) * std::pow( 10, size-i ); ++string; } return returnValue * sign; }
  19. Time for some truthiness: you're being unduly sad. It's expected that someone who hasn't yet graduated is not going to get a job offer, and it's expected that someone who hasn't yet graduated does not yet have the C++ chops. After graduation, you'll need to work on some games, during which process you will increase your choppiness. And even then, you should expect to get numerous rejections to job applications. While the game industry is very much in need of programmers, that does not mean the industry has to lower its qualification standards. Patience, young jedi. Much have you yet to learn. Keep on keeping on.   Thank you for the encouragement, much appreciated. :)
  20. CacheMiss

    Engine / VR MSc Project

    Hello All,   Firstly, I'm new to the forum so hi! I'm here to ask for some input and advice if I may:   I recently finished my CS BSc and will be undertaking an MSc this September and would like my project to be games-oriented, more specifically, something to do with game-engine or VR technology. I was hoping for some input on common engine/VR issues or opportunities that would make for an interesting project?    Any input would be appreciated, thank you.
  • 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!