Skip to main content
11 votes
Accepted

How to use the SDL viewport properly?

My guess is you're trying to implement a camera, and should not be using SDL Viewports. The viewports are for UI elements like menus, minimaps, etc. It's a way of dividing up the screen into multiple ...
amitp's user avatar
  • 6,046
11 votes

How and when do the model to world, world to view, et cetera multiplications happen?

Think about it logically: What is your goal when you render something? To display it on the screen! What are the constraints? The model must be visible to the camera (i.e. in the view frustum, not ...
Dan's user avatar
  • 501
4 votes
Accepted

Spritesheet with unstable width

When you want to use a spritesheet with non-uniform frame size, then you need to introduce the concept of a separate "pivot point" for each animation frame. The pivot point is the "zero-...
Philipp's user avatar
  • 120k
3 votes
Accepted

How to smooth viewport panning when using minimap (in typical RTS)?

I think you should avoid setting your viewport position to the value selected in GUI in one, single frame. Instead, I'd add a target position and ...
kolenda's user avatar
  • 1,370
3 votes

How and when do the model to world, world to view, et cetera multiplications happen?

Please allow me to elaborate what the responsibility of the GPU should be in the most common scenarios as well as the responsibilities of the CPU, game-engine, and OpenGL. Basics to the OpenGL ...
Nicholas Miller's user avatar
3 votes
Accepted

Custom Camera View Fustrum in Unity

You can simply set the camera’s Viewport in the inspector. It defaults to x,y,w,h= 0,0,1,1. You could, for example, set it to 0.2,0.1,0.6,0.8 You can include another camera (full screen) that doesn’t ...
Ed Marty's user avatar
  • 5,229
3 votes
Accepted

Gdx.graphics.getWidth() vs cam.viewport width

Gdx.graphics.getWidth() returns the width (in pixels) of the window (or on mobile, the screen) that your application is running in. ...
bornander's user avatar
  • 4,516
3 votes
Accepted

ScreenSize vs. WorldSize

The difference between ScreenSize and WorldSize is part of the brilliance of graphics systems like OpenGL. ...
spectacularbob's user avatar
3 votes
Accepted

How to access a ViewportTexture's depth data as an image?

Sadly, there is no built in to do this at the time of writing. Instead this is what exists: A bug report: Getting depth texture from viewports. A proposal: Accessing different viewport buffers ...
Theraot's user avatar
  • 27.2k
2 votes

How to split a screen in half using LibGDX without scaling?

I would suggest having a look at this page and using a viewport to manage both cameras. Since you don't want scaling a ScreenViewport would be the way to go. https://github.com/libgdx/libgdx/wiki/...
Fooble's user avatar
  • 320
2 votes
Accepted

Using Multiple Viewports in LibGDX?? help needed badly

Rather than focusing on the idea of multiple viewports, you should approach this problem in the same way that you approach any game with the game world rendered on one layer, and the HUD rendered on a ...
bazola's user avatar
  • 218
2 votes

How to restrict the players movement win relation to screen bounds in Unity? (Without colliders)

A slightly different approach to the one given by Michael, which I am using on my project, if you are using crossplatform input axis and convert it to vector3 for movement; ...
Murk Entropic's user avatar
2 votes
Accepted

How to restrict the players movement win relation to screen bounds in Unity? (Without colliders)

You can restrict the player position to the viewport like this: ...
House's user avatar
  • 73.3k
2 votes

Change Unity 3d viewport shortcuts to match Blender?

It seems that you're not the only person that wanted to make Unity more like Blender, and on the Unity forum someone has tried to script the editor to make it behave a bit more like Blender by ...
Adam's user avatar
  • 7,384
2 votes
Accepted

How to render picture-in-picture effect with libGDX camera

You can render the drones view to a FrameBuffer, and then draw that FrameBuffer onto your main screen. This is often referred to ...
bornander's user avatar
  • 4,516
2 votes

How do I render a pixel art game in a modern (scalable, smooth, crisp, hdpi friendly) way with Godot?

I believe this tutorial covers most of what you want: How to make a silky smooth camera for pixelart games in Godot. The idea is to have a (Sub)Viewport where you render your game world. And this ...
Theraot's user avatar
  • 27.2k
1 vote
Accepted

LibGDX - Camera and viewport initialization in show()?

TL;DR Create viewports separate from your screens and simply supply them as parameters wherever needed (i.e. your point 2). There is no "correct" way to do it design wise per-se but if we go a bit ...
Charanor's user avatar
  • 7,870
1 vote

Keep player within screen bounds, top down shooter

Change: viewPos.z = Mathf.Clamp(viewPos.z, screenBounds.y + playerDepth, screenBounds.y * -1 - playerDepth); to: ...
Jeffrey Enriquez's user avatar
1 vote

How do I render a cylindrical world space onto a flat, 2D view port in Unity?

The coordinates of any point on a cylinder can be expressed as (r, θ, z), where ...
user1118321's user avatar
  • 2,632
1 vote
Accepted

Unity | Camera - Follow target with view port point's offset from center

If you want to know which way a particular viewport point faces in the world, you can just ask the camera using the ViewportPointToRay method. ...
DMGregory's user avatar
  • 135k
1 vote

Transforming 2D viewport coordinates after scaling the viewport (zoom in/out)

This is all covered by Translation, Rotation (not mentioned by you) and Scaling. You can write separate functions for each transformation but usually it is done using homogeneous coordinates and ...
Peter Parker's user avatar
1 vote

How and when do the model to world, world to view, et cetera multiplications happen?

I think the other answers has already covered the bulk of this, yet I want to make some assertions on the P.S.: P.S. So to stress my point: Why multiply the whole world by anything? Because the ...
Theraot's user avatar
  • 27.2k
1 vote

Custom Camera View Fustrum in Unity

Yes, you can do it easily in unity. But first, you need to understand Camera, RenderTexture, Canvas, and RawImage in Unity. Below is step by step procedure to achieve the result you wanted. Create a ...
Kartik Shah's user avatar
1 vote
Accepted

Setting up a low res viewport to stretch in Unity

Set up a RenderTexture of your desired resolution. You can create this as an asset in your project folder, or via code at the start of the game. Set this RenderTexture as the target texture for your ...
DMGregory's user avatar
  • 135k
1 vote

How to keep an object in a certain part of the camera view?

Take a look at the lookAt matrix : https://www.scratchapixel.com/lessons/mathematics-physics-for-computer-graphics/lookat-function I can't explain to you myself as I use a matrix library for this, but ...
Paul Boursin's user avatar
1 vote
Accepted

Making Minecraft in 2D. Blocks move when player moves

This is exactly what you'd expect to happen. This is the code that draws your dirt blocks: ...
Charanor's user avatar
  • 7,870
1 vote
Accepted

3D camera - window resolution relation

don't mind the different aspect ratios But that's the problem. If you use 2 windows with different sizes but the same aspect ratio you won't see this problem. It looks like you're using the Field of ...
user1118321's user avatar
  • 2,632

Only top scored, non community-wiki answers of a minimum length are eligible