Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

291 Neutral

About wild_pointer

  • Rank

Personal Information

  • Interests

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Looking for some advice. I have a toy graphics framework I use for experimenting and the vast majority of the time I spend is on tweaking/debugging shaders. And a big part of that involves tweaking constants and other options to get the look or effect right or to just debug problems. Right now my process looks like this: 1. Add variable(s) to "material debug" cbuffer in hlsl. 2. Add variable(s) to mirrored C++ struct that I use to update the constant buffer (while being careful not to break alignment/padding requirements) 3. Add entries into debug gui 4. Fix inevitable copy/paste errors Has anyone found a satisfactory combination of build pipeline, code generation, reflection or otherwise that could automate some or all this? I suppose another option is to quit the reliance on on screen gui and instead implement some form of shader reloading so I can edit constants directly in hlsl.
  2. wild_pointer

    Horizon:zero Dawn Cloud System

    My results look a bit like yours, taylorswift: If I drop the absorption rate to get rid of the dark areas then the clouds get blown out. But I'm not modeling scattering yet, so I think this makes sense. The only light is that which comes directly from the sun but isn't absorbed on the way. I'll see what happens when I add ambient lighting and the henyey greenstein term but right now I'm trying to make sure what I already have is correct-ish. But it looks like you already have both. What happens if you remove them? I'm not very happy with my cloud shapes either. I don't get very clean edges even at really high sample counts. It ends up looking pretty fuzzy. Your first image looks really good in that respect. Maybe I need some kind of exponential ramp on the density. I also don't like how the clouds appear near the horizon but in that case I might just need some fog. Really looking forward to Andrew's talk in a couple weeks.
  3. I was looking at this post: which shows how to derive the sampling function for both Phong and GGX distributions given the PDF, but I'm not sure how the author got the PDF to start with?
  4. wild_pointer

    Terminology regarding splines

    I'm curious. Given a spline we can evaluate it's position at any point P=[0..1] along a segment. Does P have a name? Similarly, if we have a point P=[0..N] where N is the entire length of the spline, does that P have a name? I'm trying to make it easier to distinguish between position as a float and position as a point in some code I've written
  5. wild_pointer

    World Space to Clip Space

    From world coordinates i'd like to get back coordinates in 2D in the range [-1, 1]. I can get there by discarding the Z component if I transform into clip space, right? I'm having trouble trying to remember how this works and when I google it I usually just get suggestions to use some handy-dandy API function that isn't available to me If I have... vec3 p(30, 30, -1500); p = vec3.transform(p, viewMatrix); p = vec3.transform(p, projMatrix); Now what space is 'p' in?
  6. I'm working on a game where the world is composed of tiles. I'm using a simple SAT implementation to generate contacts. This works fine for the most part except for the following situation: The blue box is my player and is separated from the yellow box by 0 units along the Y-axis and so I generate a contact between the blue box and the yellow box with the normal <0, 1, 0> and distance 0. Which is fine. Now the player is trying to move left and it finds that it's also 0 units from the red box but on both the X-axis and the Y-axis. If I'm allowed to move over the seam comes down to the order I test the axes. If I test the Y-axis first I generate a contact with normal <0, 1, 0> and distance 0. Then I test the X-axis and I get <-1, 0, 0> and distance 0 but that's ignored because the distance isn't any closer to the first one. That's fine too. But if I test the X-axis and then the Y-axis I'm prevented from going over the seam. Obviously I can just always test the Y-axis first but then my problem just becomes sliding along walls instead of sliding along the floor. Is there some common approach to dealing with this problem? I've looked a little into welding but in my game you can add and remove tiles during gameplay so it would need to be something that could be done really quickly. I could also probably do something like tagging the faces of the blocks as obscured/ignored but that's starting to seem hacky and would start to add coupling between my physics systems and game code. Hoping for a more general solution and I'm sure I'm not the first to run into this anyways
  7. I've been playing with speculative contacts as described by Paul here: http://www.wildbunny...pproach-part-1/ My game world is made up mostly of AABBs which I use as tiles. The speculative contacts require that I supply a positive "penetration distance" to the contact solver so collisions can be dealt with before they're actually solved. To do this in the AABB vs AABB case, I just kinda adapted the normal overlap test: public void Collide(Vector3 position, Shape otherShape, Vector3 otherPosition, ref List<Contact> contacts) { if (otherShape is AABB) { AABB otherAABB = (AABB)otherShape; Vector3 displacement = position - otherPosition; Vector3 seperation = Utils.Abs(displacement) - (HalfWidth + otherAABB.HalfWidth); bool overlapping = seperation.X < 0 && seperation.Y < 0 && seperation.Z < 0; if (seperation.X >= seperation.Y && seperation.X >= seperation.Z) { contacts.Add(new Contact(displacement.X > 0 ? Vector3.UnitX : -Vector3.UnitX, overlapping ? -seperation.X : seperation.X, seperation)); } else if (seperation.Y >= seperation.X && seperation.Y >= seperation.Z) { contacts.Add(new Contact(displacement.Y > 0 ? Vector3.UnitY : -Vector3.UnitY, overlapping ? -seperation.Y : seperation.Y, seperation)); } else if (seperation.Z >= seperation.X && seperation.Z >= seperation.Y) { contacts.Add(new Contact(displacement.Z > 0 ? Vector3.UnitZ : -Vector3.UnitZ, overlapping ? -seperation.Z : seperation.Z, seperation)); } } else { throw new NotImplementedException(); } } Kinda ugly but seemed to work well enough. The problem I ran into is this case: The red arrow represents the blocks velocity. The rest are static (my ground). In this case, the penetration in X and Y are equal so my logic above will just select the first case and a contact will be created along the X-axis with distance = 0. That is.. not quite right. I kinda hacked around this by just throwing away contacts that have 2 or more components of the penetration = 0 but obviously that's not right either. The problem seems to be that my distance check is completely wrong in the case where they are not overlapping as checking the distance along each axis like I'm doing is only really works when they overlap on at least one of those axes. Unfortunately, it seems finding the distance between 2 AABB is a fairly uncommon operation since google isn't much help. I think the minimum amount of work I would need to do is to find the distance between each point on 1 aabb and each face on the other? I think I'm mostly looking for a sanity check before I go forward, so any thoughts would be appreciated.
  8. wild_pointer

    Walking - Logic

    The formatting makes it seem so at a glance. At any rate, my advice stands. There's not really enough information to guess what might be wrong. I have no idea what your animate or move functions do or how you detect that you've reached a new tile and what you do then. Who knows, maybe the animation itself just doesn't loop seamlessly. There's nothing really special to game development in this case, if you're an experienced programmer then bring your standard deductive reasoning skills to to bear =P
  9. wild_pointer

    Walking - Logic

    How would you expect movement to continue through multiple tiles when movement only begins after you have held down the key and then release it? I'd suggest better separating the moving and turning states of the player and better defining exactly what you want to have happen when the player presses the movement button and then proceeding from there.
  10. I already only add visible blocks to the physics system. My question is more about only keeping the static objects nearby to dynamic ones in the simulation and if this is a usual way of dealing with lots of terrain (And if so how is there some generic way that my collision system could handle this for me? Otherwise I'd handle adding and removing objects in the game code).
  11. Not sure if this belongs here or in game programming, sorry. I'm working on a toy terrain engine that's made up of thousands of cubes just like Minecraft. I put some basic collision detection in but it's really slow as I'm naively testing against hundreds of thousands of objects. I can implement a broadphase and I will have to eventually but I think a better first step would be to take advantage of the fact that nearly everything is static and further that I can very quickly index my cubes by position. My idea is to only add and remove the static cubes from the physics simulation depending on if any dynamic objects are nearby (the player,. mostly). This way I'm not testing against them and I'm also not paying to keep all those objects in memory. This wouldn't be hard to do so I'm mainly asking because I'm sure not the first person to deal with this kind of problem and I want to know if this is the "right" way. Is there some reference implementation anyone knows of I could borrow from? I looked around a little and couldn't find any physics engines that seemed to do this but I'm not sure if that's because my approach is stupid or maybe my situation is relatively unique (though I imagine anyone doing collision with arbitrary terrain would run into the same thing). Thanks!
  12. wild_pointer

    Distance between AABB

    Thanks for the replies. Sorry to dig this back up but I haven't had much time these last few days to think about it. Paul, your article on speculative contacts is actually what I'm working from. From what I understand, that requires I be able to supply the smallest distance between the 2 bodies so that a contact can be generated (hopefully) before they're actually intersecting. If I use the approach you and others outlined I end up with D but from what I can tell it's really only useful for deciding binary overlap. For example: centreA = (0, 0), centreB = (-1, -1), halfExtentsA = <1, 1>, halfExtentsB = <1, 1> D = |(0, 0) - (-1, -1)| - (<1, 1> + <1, 1>) = <1, 1> - <2, 2> = <-1, -1> So I can see they're overlapping. Now with centreB = (1, 1). D = |(0, 0) - (1, 1)| - (<1, 1> + <1, 1>) = <1, 1> - <2, 2> = <-1, -1> Also overlapping. But in a different way with the same resulting value for D. I mean, I can get the distance and normal between 2 points obviously. What it seems like I would then need to do is subtract from that distance the distances from the center of the AABB to the extents of the AABB along that normal. I'm not really sure how to do that though. There is probably some super elegant way to do this all that I am oblivious to.
  13. wild_pointer

    Distance between AABB

    I was wondering how I might best decide the minimum distance and normal between 2 AABB such that the distance is negative when overlapping. I've started writing some code but it's getting ugly and there must be a more elegant approach. As a related question why is it that when I search for intersection tests almost all of them only tell you if two shapes are colliding but nothing about the nature of the collision? A boolean result seems completely useless. For AABB I can understand since probably not many people are using them for actual collision response, but I find that to be the case with most tests I go looking for.
  14. wild_pointer

    Serious slowdown!

    Your problem is almost certainly this outer loop in your Logic function: void Logic(OBJECT* ship, list<OBJECT> *bullets, list<OBJECT> *enemies, INPUTDATA* InputData) { static int time, start_time = GetTickCount(); time = GetTickCount() - start_time; start_time = GetTickCount(); for(int ms = 0; ms < time; ms++) // once per millisecond... { // ... } return; } } This is certainly not doing what you intended. It's almost as if you expect this to be running in another thread but I'll assume for the moment it is not. What does your game loop look like? How are you calling Logic? Assuming something like 30fps that's 33 ms a frame and that means your input handling and collision is going to run 33 times every time you call logic. And it's not going to run every ms, it will happen much more quickly. Think about it: you don't expect your other for loops to take 1ms per iteration so why would this one? In fact, once your framerate starts to drop you'll get crazy pathological behavior where your logic function starts running through that loop even more often due to the larger time delta.
  15. My first suggestion would be to stop making "is it OOP" your first consideration when selecting a solution to a problem. The term is misunderstood to the point of being almost meaningless anyways. A better question might be to ask if given solution is it as simple as possible while satisfying all requirements and being easily maintainable. In which case I'd say an enum is probably fine. As for your updating of components the only things that jumps out at me is first what exactly your entity manager has to do? Why do components need to be enabled or disabled? And second, why are you storing pointers to components in both the entity and the component manager? Does the entity really need to be able to query it's components directly? Could you instead store a mapping from components to their owning entity in your component system and direct all queries through that? And at that point do you even really need an Entity class? Could your entities just be a unique id?
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. 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!