Vision Cone. Visible vs BLACK, Unity - unity3d

I've been trying to get my head around how to do a player vision like what is in Teleglitch (If the player can see the objects they're shown, otherwise it's black).
(gameplay from Teleglitch : http://www.youtube.com/watch?v=0OBXdEwawqI)
I am currently developing an turn-based strategy game where I would like this feature. Problem is that I actually have the Vision Cones already but I am not sure how I would go about doing this.
I've seen some guides around to do the vision cones, how do I actually apply the "darkness"?
I have a feeling that the best way would be a shader, but I can't seem to find what I am looking for.
Thanks

In Teleglitch, it looks like they simply render black polygons over the shadow areas. Another approach in Unity is to use depth masks. Unity 4.2 Pro also supports stencil buffers which are useful for masking effects.

Related

What approach should I use to create animated backgrounds in Unity?

I'm new to Unity and trying to figure out the best way to create animated backgrounds. To be clear, I'm not asking you to give me an exact solution or instructions, and I would be grateful if you just tell me which direction to look in, and I will figure it out by reading the documentation.
I'm interested in how animated backgrounds are created in 2D Unity (for example, as here: https://youtu.be/OxiGlmV6ByA?t=1075 flying leaves are visible on the background). I only thought of using particles or just creating standard animations in Unity. But, the second way seems too long and complex, and about the particles, I'm not sure how much it affects the performance in a mobile game. Google searches mostly give instructions on how to create parallax backgrounds or moving backgrounds in Unity.
In general, I will be grateful if you tell me which approach is the most optimal for creating an animated background in a mobile 2D game in Unity.
The particles system is well optimized, for what you want to do it will not affects the performance, even on mobile.

Using Minecraft character with skin into a unity game

I've decided to use Minecraft like characters in my small game since I do not know how to make 3d models (nor I want to learn how to do such thing in the near future).
However the task now seem a little harder than expected:
I've tried looking in the asset store for prefabs to use but without success.
So, I've decided to try and make a model on blender(by not knowing a thing about non parametric 3d modeling, my knowledge of blender is extremely limited) and import it into my unity game.
And surprisingly, I managed to create the model using McPrep, export it and import it into unity maintaining objects that drive the bones (the output is a bit messy but I think I can manage to clean it up a little).
However the imported version does not have any skin and appears in a gray shade.
Turns out that the output does not keep materials/textures with it!
I've tried getting the texture used by blender and it returns the same skin I fed into mcprep so, by using the same skin, I've tried creating a material with it by getting the .png and using it as texture in a unlit texture material.
However, the result is a bit messy as shown here (left is Blender, right is Unity):
How may I make the texture on unity3d be better and right? (I've heard there is a way using a C# script but I really don't know what it is nor how to do it)
EDIT:
Thanks for the answers before, I did set the filter to point obtaining the texture to be a bit better. However the part that should be transparent is displayed in black on top of the other part (I think).
The image on the right is only filter point and the one on the left is point + alpha is transparency and the transparent shader using unlit transparent
ANSWER FOUND:
As Bart said, make sure the textures' Filter Mode is set to Point, but additionally:
Minecraft player characters are made of 2 layers, the second layer usually has lots of transparency and is used for clothing or other relief detail. So you need to use a transparency-capable shader on your material in Unity.
You're running into a filtering issue. In your case you want no filtering to happen. So select your texture, and in the inspector change the import settings so that your "Filter Mode" is set to "Point". In this case it will do no filtering of the input and your large pixels should appear sharp as you want.

3D AR Markers with Project Tango

I'm working on a project for an exhibition where an AR scene is supposed to be layered on top of a 3D printed object. Visitors will be given a device with the application pre-installed. Various objects should be seen around / on top of the exhibit, so the precision of tracking is quite important.
We're using Unity to render the scene, this is not something that can be changed as we're already well into development. However, we're somewhat flexible on the technology we use to recognize the 3D object to position the AR camera.
So far we've been using Vuforia. The 3D target feature didn't scan our object very well, so we're resorting to printing 2D markers and placing them on the table that the exhibit sits on. The tracking is precise enough, the downside is that the scene disappears whenever the marker is lost, e.g. when the user tries to get a closer look at something.
Now we've recently gotten our hands on a Lenovo Phab 2 pro and are trying to figure out if Tango can improve on this solution. If I understand correctly, the advantage of Tango is that we can use its internal sensors and motion tracking to estimate its trajectory, so even when the marker is lost it will continue to render the scene very accurately, and then do some drift correction once the marker is reacquired. Unfortunately, I can't find any tutorials on how to localize the marker in the first place.
Has anyone used Tango for 3D marker tracking before? I had a look at the Area Learning example included in the Unity plugin, by letting it scan our exhibit and table in a mostly featureless room. It does recognize the object in the correct orientation even when it is moved to a different location, however the scene it always off by a few centimeters, which is not precise enough for our purposes. There is also a 2D marker detection API for Tango, but it looks like it only works with QR codes or AR tags (like this one), not arbitrary images like Vuforia.
Is what we're trying to achieve possible with Tango? Thanks in advance for any suggestions.
Option A) Sticking with Vuforia.
As Hristo points out, Your marker loss problem should be fixable with Extended Tracking. This sounds definitely worth testing.
Option B) Tango
Tango doesn't natively support other markers than the ARTags and QRCodes.
It also doesn't support the Area Learnt scene moving (much). If your 3DPrinted objects stayed stationary you could scan an ADF and should have good quality tracking. If all the objects stay still you should have a little but not too much drift.
However, if you are moving those 3D Printed objects, it will definitely throw that tracking off. So moving objects shouldn't be part of the scanned scene.
You could make an ADF Scan without the 3D objects present to track the users position, and then track the 3D printed objects with ARMarkers using Tangos ARMarker detection. (unsure - is that what you tried already?) . If that approach doesn't work, I think your only Tango option is to add more features/lighting etc.. to the space to make the tracking more solid.
Overall, Natural Feature tracking by Vuforia (or Marker tracking for robustness) sounds more suited to what I think your project is doing, as users will mostly be looking at the ARTag/NFT objects. However, if it's robustness is not up to scratch, Tango could provide a similar solution.

Unity3d; Skybox on mesh like in Source engine.

In older games Ive made levels in, like unreal or half-life the skybox is a parallaxed texture that you assign to world geometry, for instance, the ceiling of your room, to give the illusion of the room being open to the sky.
There are some neat tricks or weird things you can achieve with this 'sky portal' method. For example you could have 'sky' in an underground room. or walk through a hole in the sky.
I'm wondering is it possible to make a mesh in unity3d render as part of the skybox like in these older engines.
You can do this yes. Usually you assign a "SkyBox" to your camera and change the "Clear Flags" for her "SkyBox". However, there are other ways to do.
Learn more here: http://docs.unity3d.com/Documentation/Components/class-Skybox.html
Hope this help !

How to draw images on Terrain in unity

I am working on game in unity in which i need some images to be placed on terrain as in the attached image yellow arrows and "P in blue circle" are rendered on surface in unity.
Any idea or method will be appreciated.
There's no built-in support for decals in Unity. You could just create separate gameObjects with transparent texture and place them above the terrain here, or use one of several packages for decals in Unity Asset Store, like this one. (I have only briefly tried it and can't say anything about it's quality).
I know it's an old topic - but for those who are still not satisfied:
I would recommend using Easy Decal.
It's a very powerful decal projector. It's easy to use and you can stick decals also on uneven surfaces like bumpy terrains.
You could try putting a plane with the texture aligned with the surface normal slightly above the surface. Or you could try an extension that does decals for you. This is what i found:
Decal System for Unity3D
As previously mentioned Easy decal is a good choice. It's easy to use, has extensive fuctionalities and you'll get a lot for your money. But if you need skinned decals there's no way around Decal System Pro by Edelweiss interactive. It's more expensive, but beside the skinned mesh support it also supports texture atlases which saves you draw calls.