Jump to content
  • Advertisement
    1. Past hour
    2. davejones

      Keep object in camera view

      Thank you for your detailed comment. Going forward with what you have said, I will try to clarify what it is I am trying to achieve. - I have a 3D mesh in a scene. - I want to be able to track side to side and up/down with the 3D mesh as a reference point. I also want to rotate around the 3D mesh. - The 3D mesh would be the centre point about which rotation occurs - I want to be able to zoom in/out of the mesh - I don't want to be able to infinitely track + or - in the x-axis - I don't want to be able to infinitely move + or - in the Y-axis - The maximum zoom distance from the 3D mesh has to be finite. All of these inputs are to be usable with finger (touch inputs) and also using a computer mouse. I want the inputs to be finite so that the user can't get lost at a random part of the scene. The 3D mesh is in an area and that area needs to be "caged" (bounded, blocked) from getting out of that area. This is so that the user doesn't get lost. I apologise for any confusion caused and I do hope you can understand. I'd be open to any opinions/suggestions.
    3. Steve._.Snow

      Voice Actors Needed

      hey!, you can look in these servers Voice actors: https://discord.gg/A2CGzm https://discord.gg/gXYrjS https://discord.gg/qY6r4a i hope you can find someone!.
    4. Yeah, i already expected this to happen meanwhile. The problem is we have no smooth 'tangents' at the control points, if we would compare the approach to converting a catmull rom spline to bezier spline, which is what i have in mind basically. Should be easy to fix. Lets say we have a catmull rom spline of N quats, and we are at control point i: quat cpQ[N]; for (int i=1, i<N-2, i++) { quat diff_left = rotation from cpQ[i-1] to cpQ[i+1] // 'segment' from previous to next control point (before we used from current to next) // divide angle by 6, because the 'segment' we use to calculate the 'tangent' now is twice as long quat modified_left = rotate cpQ by diff_left int j = i+1; // index for right control point quat diff_right = rotation from cpQ[j+1] to cpQ[j-1] // divide angle by 6 quat modified_right = rotate cpQ[j] by diff_right ... } I'm not really sure this works really continuously, because i miss experience with quad slerp (and i expect some wobbling because the camera view vector likely will not be aligned to the position spline tangent exactly). If it does not work well, you could look at this:
    5. Hi, for this question the knowledge of EU countries tax systems would be helpful, but your general knowledge is also welcomed. Here is a "theoretical" situation. Lets say that i made game and uploaded it to steam. I got some money from sales and now I have 2 options: should i pay taxes for Denmark(where i student) or should i pay taxes for Lithuania(where i technically still a citizen)? In general my question is: under what circumstances I should pay taxes for specific country. I mean if i got a cucumber from country "A", went to country "B" and sold it, I would give taxes for country "B" (because act of selling cucumber took place in country "B"). What about intellectual products? I mean there technically no place where i sold my product, so according to what rules my profit bounds to specific country's tax system? P.S. I doubt that place where I was while putting game into Steam is important, but just in case I will say that I putted game while I was in Lithuania(right before i went to Denmark).
    6. Just made a new song, come check it out!
    7. Thanks! I really appreciate your feedback
    8. Today
    9. lawnjelly

      Keep object in camera view

      Someone has to say it, and I apologise in advance as this will probably come across as overly critical, sorry I'm not very politically correct (we don't know your age / education / whether English is your first language / whether you have learning difficulties) : a lot of the confusion we are having is because a lot of your sentences don't make grammatical sense in English. I have spent a bit of time trying to work out the meaning behind them... This sentence doesn't parse in English. This also makes no sense. Camera (location?) bounds have nothing to do with pitch, roll and yaw, which are rotations. I'm guessing what you are trying to say would be this (but I can't be sure): In terms of camera yaw and pitch it is possible to move the viewpoint so that the target is no longer in view. This isn't much of an issue. My goal is to keep a certain area in view of the camera, rather than a particular target. However this seems to conflict with what you are asking here: Is the object doing the seeing, or the camera? Cameras are used to provide a viewpoint for rendering, so if anything sees, it is the camera, and not the object being viewed (unless of course you are talking about an AI object that does actually see?). This parses but it is ambiguous, you want the camera location to be bounded or the view seen from the camera? Programming in general, and the description of algorithms requires you to be very specific in your language. In natural language we get away with a certain amount of ambiguity, as the meaning can often be inferred from the context. But here when you use the word 'camera' you should specify what property of the camera you are referring to. Also another part of the problem is perhaps unfamiliarity with the terms involved in 3D. This is understandable. At a very basic level objects in 3D have a: Location Rotation (sometimes referred to as orientation) - this is often managed as either a Quaternion, Axis Angle, or Euler angles (yaw, pitch roll) A camera has a location and a rotation, and in addition extra properties such as field of view and aspect ratio. All of these interact to determine what is seen by the camera, the view. So when you refer to a camera or object, you should be specific about which properties you are referring to. If you are unsure of a term, it usually only takes a quick search on wikipedia or similar. In addition to keeping your sentences simple and specific, drawing diagrams may be useful as these are often helpful to convey ideas in 3D. Asking questions and conveying concepts about 3d graphics is not an easy thing to do, even for those who are very familiar with the subject, so please do not take this too harshly, more as practical advice. As it is, you seem to be asking how to keep an object in view of the camera, but you don't mind if the object leaves the view of the camera.
    10. Zakwayda

      Tile map bad performance

      I'm not familiar with JavaFX, but I think the first question would be, can you profile the app? It seems like that could be a good first step in analyzing the problem. You could also do some ad hoc analysis. For example, comment out just the draw calls to make sure it's specifically drawing that's causing the problem. If possible, cache the return values of getLayer*GC() instead of calling those functions repeatedly, just in case they do some non-trivial work. Try a smaller window to see if performance scales with the number of pixels drawn. And so forth. With these kinds of simple experiments you may be able to narrow things down a bit.
    11. turanszkij

      Catmull-Rom for Quaternions?

      Thanks, I tried to code up your suggestion using directxmath, here is what I came up with: XMVECTOR qA = XMQuaternionNormalize(XMLoadFloat4(&a->rotation)); XMVECTOR qB = XMQuaternionNormalize(XMLoadFloat4(&b->rotation)); XMVECTOR qC = XMQuaternionNormalize(XMLoadFloat4(&c->rotation)); XMVECTOR qD = XMQuaternionNormalize(XMLoadFloat4(&d->rotation)); XMQuaternionSquadSetup(&qB, &qC, &qD, qA, qB, qC, qD); XMVECTOR diff_ab = XMQuaternionMultiply(XMQuaternionInverse(qA), qB); // rot from a to b diff_ab = XMQuaternionNormalize(XMVectorMultiply(diff_ab, XMVectorSet(1, 1, 1, 0.33333f))); // div angle by 3 and normalize XMVECTOR modified_a = XMQuaternionNormalize(XMQuaternionMultiply(qB, diff_ab)); // rot b by diff_ab and normalize XMVECTOR diff_dc = XMQuaternionMultiply(XMQuaternionInverse(qD), qC); // rot from d to c diff_dc = XMQuaternionNormalize(XMVectorMultiply(diff_dc, XMVectorSet(1, 1, 1, 0.33333f))); // div angle by 3 and normalize XMVECTOR modified_d = XMQuaternionNormalize(XMQuaternionMultiply(qC, diff_dc)); // rot c by diff_dc and normalize XMVECTOR R = XMQuaternionSquad(qB, modified_a, modified_d, qC, t); If you can't read the code well, I can't blame you. So this kind of works, the movement is not jumping around now, and kind of smooth, but not in a nice way. When reaching the next camera location, the rotation speeds up to remain on the path and then slowly blends to the next. But the rotation is always the shortest now. I made a gif:
    12. ZekeBraiden

      Tile map bad performance

      I'm developing a 2D tile based game in JavaFx in college, I already have the sprites, animations, audio, menu ..., but I found a huge problem in rendering the map. On a 4GB notebook, Intel graphics card, Core i5, where any 2D Steam game works well at 60 FPS, my game runs from 27 to 31 FPS. I noticed that the precarious part is rendering the map, but I do not know why it's so slow. Here is the map rendering code: // Clear Layers this.getLayer1GC().clearRect(0, 0, this.getLayer1GC().getCanvas().getWidth(), this.getLayer1GC().getCanvas().getHeight()); this.getLayer2GC().clearRect(0, 0, this.getLayer2GC().getCanvas().getWidth(), this.getLayer2GC().getCanvas().getHeight()); int index = 0; int tileSize = 64 * Engine.SCALE; // 128x128 int startCol = Math.max(0, (int) (Engine.camera.xView / tileSize)); int endCol = Math.min(this.width, (int) ((Engine.camera.xView + Engine.camera.wView) / tileSize) + 1); int startRow = Math.max(0, (int) (Engine.camera.yView / tileSize)); int endRow = Math.min(this.height, (int) ((Engine.camera.yView + Engine.camera.hView) / tileSize) + 1); int tileX, tileY, indexLayer1, indexLayer2; for (int c = startCol; c < endCol; c++) { for (int r = startRow; r < endRow; r++) { // Tile Index index = this.tileManager.getTileIndex(c, r, this.width); // Tile Coordinates tileX = (int) (c * tileSize - Engine.camera.xView); tileY = (int) (r * tileSize - Engine.camera.yView); // Cache Tileset Images indexLayer1 = this.layer1.tileArray[index]; indexLayer2 = this.layer2.tileArray[index]; // Layer 1 if (indexLayer1 > 0) { this.getLayer1GC().drawImage(this.mapTilset.tileImages[indexLayer1], 0, 0, tileSize, tileSize, tileX, tileY, tileSize, tileSize); } // Layer 2 if (indexLayer2 > 0) { this.getLayer2GC().drawImage(this.mapTilset.tileImages[indexLayer2], 0, 0, tileSize, tileSize, tileX, tileY, tileSize, tileSize); } } }
    13. SilviuShader

      Fancy Ball 2 - Skins

      We are glad to announce that we implemented a skin system for Fancy Ball 2. Here's a video: Let us know in the comments what skin you want to see in the game. Also this week we changed how the gamespeed mechanic works. Previously all the movement equations were something like: velocity += Time.delta * gameSpeed * velocityMultiplier; The problem with this solution was that it didn't work for dynamic body physics (I'm using Unity). I soon realized that Unity has something that can help me. It has Time.timeScale. My initial idea was to make all the movement independent of the gameSpeed and to just assign to Time.timeScale the value of gameSpeed. In my case the maximum value of gameSpeed is 10 so... that solution didn't work really well as it was causing lag. I had to think of another solution. I found a solution that combined both the solutions above. I just multiplied maxSpeed to all the movement equations like so: velocity += Time.deltaTime * maxSpeed * velocityMultiplier; And then what I did was assign Time.timeScale the value gameSpeed / maxSpeed. Something like: Time.timeScale = gameSpeed / maxSpeed; And that is pretty much everything for this week. Thank you for following the development of our games.
    14. Zakwayda

      Keep object in camera view

      I think that's the most straightforward solution I can think of at the moment. I will clarify though that what I suggested is in fact a 3D solution. It's expressed in 2D because that seems to be sufficient for the problem as you've described it (that is, camera only moves parallel to the ground plane, camera only pitches and yaws, pitch is constrained, etc.). So the solution is a 3D solution, but it reduces to a 2D problem (which is actually good, since it makes it easier to implement).
    15. Hi! Im doing a tactical dungeon crawler similar to darkest dungeons and battle brothers but also with influences from diablo, torchlight and the likes. The player controls 3 heroes (early game) and up to 6 heroes in late game and visits dungeons, towns and travels on a map. Right now the item management is composed of equipment (main hand, offhand and two ring-slots) potions, trade items and group resources (gold coins, food and medicine). Equipment has bonuses such as +3 to strength or energy and weapons have damage ratings and shields has block chances. Pretty basic. I have no armour rating right now (heroes are considered being clad in armour belonging to their class, you dont handle armour). Im now thinking to include armour (body and head slot). But maybe that will be too much items to juggle for a group management game? How to plan or evaluate this? Battle brothers had all those items, but it borders fiddly to deal with all that, move around when you get new recruits etc (although that game had 12 characters to manage!). Example of a single hero: What are your thoughts? It also feels slightly strange to manage and collect weapons but not armour. Should I then skip weapons as items as well? (that would be simplifying things to much i think)
    16. davejones

      Keep object in camera view

      In my own head I truly think its a simple solution, I'm just unable to implement what I want. In a nutshell I want the camera to be bounded within a specific area of the scene. This would be in 3D not 2D.
    17. Zakwayda

      Keep object in camera view

      I'll admit I'm still not quite clear as to what you're after. You say you want to restrict the camera's position (and the video you posted seems to demonstrate clearly what you want), but you also say you want to restrict pitch, roll, and yaw, which are rotational parameters. Also, as far as I can tell at least, your camera doesn't roll. In any case, although I haven't implemented this myself, here's what I'd probably try first. I'd ignore pitch and make it a 2D problem, projected onto the ground plane (xz in this case, if I'm not mistaken). Project the point you want to keep in view onto the ground plane by replacing the original y value with 0. Then, using the field of view (I'm assuming perspective projection here) and the minimum and maximum distances from the object you want to allow, create a trapezoid in the ground plane. This trapezoid represents the current valid view area for the camera with respect to the object. If the object is already in the trapezoid, you're good. Otherwise, compute the closest point on the trapezoid to the object position, and move the camera by the vector from the closest point to the object position. This should result in the object now being in view. Maybe there's a simpler solution, but that's the simplest thing I can think of right now.
    18. ThomasG_art

      Alien PBR pack

      Alien environment pack for unity, It feature a fully rigged character and an animated creature. Modular base parts and alien environment, props and plants There several custom shaders for water, cliffs and effects: http://u3d.as/1ehG https://youtu.be/015BJTAm8Wg
    19. Oberon_Command

      As a game dev, what are you most afraid of?

      This one. I'm not interested in receiving death threats.
    20. WitchLord

      Add a callback for the GarbageCollect API

      Yes it is already available in the WIP version. I haven't updated the manual yet though. Here's a small snippet on how I tested it: std::string typeFound; void CircularRefDetected(asITypeInfo *type, const void *obj, void * /* user param */) { if (typeFound != "") typeFound += ","; typeFound += type->GetName(); } bool Test() { bool fail = false; COutStream out; int r; // Test GC callback on detecting circular reference { asIScriptEngine *engine = asCreateScriptEngine(); engine->SetMessageCallback(asMETHOD(COutStream, Callback), &out, asCALL_THISCALL); engine->SetCircularRefDetectedCallback(CircularRefDetected); asIScriptModule *mod = engine->GetModule("test", asGM_ALWAYS_CREATE); mod->AddScriptSection("test", "class testclass \n" "{ \n" " testclass @next; \n" "} \n" "void main() \n" "{ \n" " testclass a; \n" " @a.next = testclass(); \n" " @a.next.next = @a; \n" "}\n"); r = mod->Build(); if (r < 0) TEST_FAILED; r = ExecuteString(engine, "main()", mod); if (r != asEXECUTION_FINISHED) TEST_FAILED; engine->GarbageCollect(); asUINT currentSize; asUINT totalDestroyed; asUINT totalDetected; engine->GetGCStatistics(&currentSize, &totalDestroyed, &totalDetected); if (currentSize != 0 || totalDestroyed != 2 || totalDetected != 2) TEST_FAILED; if (typeFound != "testclass,testclass") TEST_FAILED; engine->ShutDownAndRelease(); } return fail; }
    21. Magogan

      As a game dev, what are you most afraid of?

      Not being able to complete my game. I've been working on this for about 4 years and being "only" a programmer, I have to find a modeler and an animator to continue and I was unable to find anyone with a reasonable amount of time and dedication yet.
    22. I assume what this function does is to negate individual quats so interpolation does not go along the longer arcs. (doc does not mention it, but it must be this) I think that's your problem. More likely the range [0,1] here covers the whole path [a,b,c,d]. So to fit the convention to what you would expect, you would need to modify a and d somehow like this: quat diff_ab = rotation from a to b // eventually need to divide angle of diff_ab rotation by 3; ... not sure quat modified_a = rotate b by diff_ab quat diff_dc = rotation from d to c // eventually need to divide angle of diff_dc rotation by 3 quat modified_d = rotate c by diff_dc (i use words instead multiplications and inversions, because i don't know DX multiplication convention) Then Setup followed by QuadSlerp (b, modified_a, modified_d, c, t) should give the expected result between b and c. Hope this helps.
    23. Gnollrunner

      Voxel meshes and degenerate triangles.

      Thanks, but I just realized I can't use any kind of edge collapsing because it will mess up the interface between chunks. However since my voxels are explicit and non-uniform anyway, I think I'm going to try to just perturbing corners of any voxels who's values are at or near zero. Hopefully I'll get a better mesh up front and I won't have the issue.
    24. Update: We also need someone who creates voxel models.
    25. The main reason I can't write even a simplest game is the problem in the title. In my vision, I should separate the information related to the game (score of a player, a nickname etc) and the information related to the rendering (mesh info, drawing method), which is done, for example, by creating a separate classes (there are other ways of doing so). Due to this, I'm always trying to do in that way, with no result, as you can see. Eventually, a design problem occurs. Namely, how I am to link those things between each other, if I ever have to separate them at all? If you have experience in making completed (operational, finished, not abandoned in the middle of development) games, tell me, how did you design rendering of game objects? I assume object-oriented programming language is used (C++ in my case). Well, it's not exactly an OpenGL problem described above. I'm just using its functionality and think in terms of vertex buffers, shaders and all that GL specific stuff.
    26. Vilem Otte

      Back-projection soft shadows

      And fixed, I'll let you see the problem of light leaking! Even on the vase in Sponza light leaking causes some serious problems. EDIT: By carefully setting parameters one can get rid of light leaking and achieve shadows for larger-scale area lights. See following screenshots: The shadow is still noisy, which can be improved with: Better random samples/random number generator (mine is bad, I just put something fast together) More samples Temporal filtering Although you can clearly see that the performance is hurting from quite large area light (yet shadowing it somewhat as expected). By carefully adjusting parameters I got rid of light leaking to some extent (it seems a bit superior to PCSS in this sense), although comparing to PCSS the performance is lower, and it is still not possible to get rid of the performance dependency on area light size. EDIT2: Actually they do look quite good with improving the noise function a bit. I also increased number of samples so that the shadow is actually smooth. The main problem is still the performance - larger area light tends to kill it. EDIT3: Decreasing samples in ray cast and for area sample points with better noise function and parameters gives almost acceptable results for lights.
  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!