Implementing a 3D Minimap for VR in Unreal Engine - camera

I am working on a VR tower defense game. I want to place my towers on a small map of the field and at the same time show the field/units/towers on the small map, in 3D. Like this:
http://halo.bungie.net/images/games/Halo3ODST/imagery/screenshots/H3ODST_PreparetoDropCinematic.jpg
The map would be something like a small clone of the field. Is there a way to do so with camera etc. So that my minimap is just a re-render/clone of the field.
Sorry if this is the wrong place, but the Unreal Engine Forum is not working at the moment.

I dont know of a simple camera projection to 3D (since the camera map would be about scene capture onto 2D textures)
You can do a fake/tricky camera implementation tho. You just show a normal camera projection and put it into the world. Now you let the actual camera position depend on where the users location is in relation to the map.
You can cover this up with particle effects so it doesnt look like some TV that is following you....
depending on the complexity of your game and how u like the solution obove it might be better to implement a calculated model.
Like you have miniature models of everything u want to show on the map and then let a map class project every "object that is shown on map" the miniature version onto the map object.
Ofc this requires tons of work compared to just setting up a camera but you have alot of better control of how the map looks and what it can do (u could add functionallity, control options and special views etc....)

Related

AnyLogic travelling camera

I want my model to be displayed in a cool video, in which a camera goes through my model.
Is there any guide for smooth tracking shots and functions that can be used?
I could not find good information in the AnyLogic Library :(
You can design any camera movement you like.
Simplest way is to create a custom agent with a camera at its origin and make the agent move around. Or add a camera to existing agents to "view over their shoulder".
Or check the example models with search term "camera".
Or make your camera positions dynamic:
You can do anything you want :)

How would I hide an object from a specific camera in Godot 3D?

I'm working on a multiplayer horror game in Godot and I want to make it so you can't see your own body but others can. I heard about culling masks for this but I have no idea how they work and if what I'm trying to achieve is possible using them. The body is a Skeleton node and others should be able to see it but my camera (a sibling of the skeleton node) shouldn't be able to. Could someone explain how I might be able to do this?
The Skeleton is not visible. However, you must have some children VisualInstances (usually MeshInstance) which are actually visible.
In the usual setup, you have a Skeleton node, with multiple MeshInstance as children, which also have their skeleton property set to the Skeleton node.
I don't know how you are setting up your multiplayer, but if it is not split-screen you probably can swap or remove the player character but not those of the other players. If removing the Skeleton is not viable, you should still be able to remove or hide its children VisualInstances.
Anyway, if you do need to setup multiple cameras, you can se the layers on the MeshInstance (or whatever VisualInstance you are using) and the cull_mask on the Camera. If they overlap (they have common bit flags) then the Camera will render that MeshInstance, otherwise it wont.
See also Hide an object for a specific camera.

Hide an object for a specific camera

I use godot to create my 3d game. I ran into a problem while creating portals using camera viewport rendering to texture. The problem is that the camera captures unnecessary objects that are behind portal. I partially solved this problem by setting the parameter "near " for the camera at a distance from the camera itself to the portal, but the part behind the portal began to be cut off.
The question is, is it possible to hide objects for a particular camera so that other cameras can see them? Perhaps there is another way to do this, for example by creating a static clipping plane?
Proximity Fade
Probably not what you are looking for, but I'll mention it for completeness sake.
The default material has proximity fade and distance fade, which you can use to make the material disappear if it is too close or to distant from the camera, respectively.
It is important to note that this is not a cull plane, and that the fading is gradual.
Thus, using proximity fade you can make objects near the camera appear semitransparent.
Using Visibility layers and cull mask
is it possible to hide objects for a particular camera so that other cameras can see them?
Every VisualInstance (you know, all things that are visible in 3D) has layers. And every Camera has a cull_mask. If the cull_mask of the Camera does not include any of the layers of a VisualInstance, then the Camera does not see that VisualInstance.
A VisualInstance with no layers will not show on no Camera, even if the Camera has all the layers in its cull_mask (which is the default).
You can either edit the cull_mask of the camera to not include the layers of the VisualInstance, or edit the layers of the VisualInstance, or both.
Using a custom shader cull plane
Perhaps there is another way to do this, for example by creating a static clipping plane?
You can use a custom spatial shader to cut things out based on a plane.
You need to define the plane as a uniforms. For this answer I'll use a point-normal definition of a plane:
n·(r - r_0)
That is:
dot(plane_normal, (world_position - plane_point)
Thus, we define a plane_normal and plane_point uniforms:
uniform vec3 plane_normal;
uniform vec3 plane_point;
The plane_normal gives us the orientation of the plane, while the plane_point is a point on the plane which allows us to position it.
And then use this logic:
vec3 wold_position = (CAMERA_MATRIX * vec4(VERTEX, 1.0)).xyz;
ALPHA = clamp(sign(dot(plane_normal, wold_position - plane_point)), 0.0, 1.0);
Here we are converting the coordinates of the current point to world space, and then using definition of the plane to find the points on one side (using sign), and set ALPHA based on that, such that everything on one side of the plane becomes invisible.
Note: This is not the only way to define the plane. Another popular definition is a 4D vector, where the xyz are the normal, and the w is the distance from plane to the origin.
Sadly, I don't think there is a way to make this work with multiple material passes, because ALPHA controls the blending of the passes, and will not result in transparency. And no, using discard; does not solve it either, because the other passes can write the fragment regardless. Thus, you are going to need to modify your materials to include that.
Further Sadly Godot 3.x does not support global uniforms (see Godot 4.0 gets global and per-instance shader uniforms). Which means you will have to set these parameter everywhere you need them.
Using Constructive Solid Geometry (CSG)
Add a CSGCombiner make the geometry that needs to disappear with other CSG nodes as children.
Then you can, for example, add a CSGSphere with operation set to "Subtraction", and move it with the Camera (for this purpose, I suggest to add a RemoteTransform node as child to the Camera and set its remote path to the CSGSphere).
Of course, it does not have to be a CSGSphere, you can use any CSG nodes for this purpose. For the portal, I imagine you could use a CSGBox and align it to the portal plane.
Note: Currently on Godot 3.3 CSG nodes do not support baking lights. This is a regression. See: Unable to bake lightmap with CSG due to the lack of ability to generate UV2 for CSG nodes.
Portals, actually
Bartleby Lawnjelly has a portal (godot-lportal) module for Godot 3.x.
Being a module, they require to build Godot from source. See Compiling on the official Godot documentation. It is not that bad, I promise. Or use build from godot-titan.
I have to explain that these portals are not portals in the Valve Portal video game series sense… The module lets you define areas as "rooms", and planes as "portals" that connect those rooms, in such way that you can look from one to the other. The purpose of this is to cull entire rooms unless you are looking through one of the portals.
Hopefully that makes more sense with a video. This is a somewhat old one, but good to get the idea across: Portal rendering module in Godot 3.2 - Improved performance. Seeing shadow pooping in the video? Bartleby Lawnjelly also has a custom lightmapper.

Create scene in blender

How can one create a scene/terrain like clash royal's game scene in blender? The game scene seems like top view but is not exactly top view. At what angle should the camera be placed to get that effect?
You would be looking for isometric projection or maybe 2.5D, also called 3/4 perspective. You can find several isometric tutorials on youtube.
While I'm not sure if there are any strict rules to follow unless you are making graphics that must fit in an existing game, it is common to use an orthographic camera at about a 45 degree angle.
Clash Royale looks like it could be close to a 45 degree orthographic camera angle.

how to highlight countries in ios maps

I am building an app in which I have to highlight some countries dynamically in the world map.
In short I want to customize the whole view of ios maps as shown in the images.
can this be done using MapKit or is there any other method. Thanks in advance
You want to look into the Mapbox iOS SDK which will allow you to do this and more with a MapKit-like API. In particular, you will want to quickly make a custom map with TileMill using the provided Natural Earth data set for world country borders, enable UTFGrid interactivity so that the tapped regions can be identified, and use the RMShape class on an RMAnnotation onto the map view to add/color country polygons as needed. This sounds a little complex but the tools exist, are entirely free and open source, and I can help you with this process.