Unity3d: Texture viewable from inside object? - unity3d

I am trying to make a globe around the camera so that everywhere the camera views it is surrounded by the texture placed on the globe.
I have been able to achieve the exact effect i am after by setting the shader of the sphere to Particles/Alpha Blended, and putting the camera inside the sphere. This way I have the camera inside a sphere object and all around it is the texture.
My problem though is this. I want to use a chroma key shader (to remove all occurances of a color) on the globe object. This means the shader is not set to Particles/Alpha Blended. And from inside the object the walls of the sphere are not textured.
Can anyone point me in the right direction to how i could achieve the effect i am after. I have a few ideas, however im not sure how to go about it. Im thinking i could:
1) Edit the chroma key shader to work in the same way as a Particles/Alpha Blended shader would (I have no experience in shader coding, or anything of the sort) 2) Use a hollow sphere, rather than the solid one unity creates (Im not sure where i would get that) 3) Use a different object all together that just renders a texture in a sphere shape, without it being a fully solid object (Im not sure if such a thing exists)
Any help would be greatly appreciated, I have searched the forums and cannot find what i am looking for.

Related

Unity How Do I get these blocks

I want to use these cubes in my own game but I have literally no idea how he got them. Look at the cubes with the black outline, the walls the ground the roof, how do I get a cube with the outline like that. I know this is a stupid question but I have tried but I cant find out why.
Thanks in advance!
Those are not individual cubes.
Take as example one of the walls, probably it's a single cube (rectangular prism) for each wall, the trick is that it has a material with a texture applied to it and a normal map.
In simple words:
A texture is an image containing the colors the object has. In this case the blue color of the walls and the black lines simulating cubes.
A normal map is something like an image but it contains information about the "depth" of each pixel in the image. In this case it indicates that the black lines should be "deeper" than the rest of the image.
A material is the object that combines the texture with the normal map and along with other settings can tell the computer how exactly it should look like.
Of course this is only a very brief definition, if you want to know more about it I recommend you to read about: Materials, textures and shaders in Unity. There are some tutorials in Unity web page.
Use photoshop to create a single tile of each type of block and use it.

Custom skybox shader for tiled skybox

I am new to writing shaders. I want to use a texture for 6-sided skybox in unity and I want that texture to be repeated several times also called tiling.
But the default 6-sided skybox shader in unity doesn't have tiling option. Can anyone write a custom shader for 6-sided skybox in unity which has option to tile textures? I also want an option to apply a color tint on the texture if possible. Thanks in advance.
Tiling can be achieved by multiplying texcoord by the number of tiles you want. Or in Surface shader it's uv_YourTex (likely MainTex) instead of texcoord. Writing from a phone so can't post an example, but it's really just one multiplication.
I don't know your specific scenario, but I needed to get more detailed sky with not very detailed texture and instead of UV I used view direction to sample a texture. It made it look like clouds in the distance are further away + clouds can move as you move . It's in this asset.
View direction sampling will not help if you are trying to make space though, which seams to be the case.
Also IMHO tiling on the skybox might be too visible.

How can I use baked lighting on sprites? / How to light up a large area in 2D?

I'm having trouble figuring out how to light up large area(s) of sprites in Unity 2D. My previous knowledge on Unity's lighting is zero.
I first tried using a large amount of point lights and using the "Sprites/Diffuse" material, but about only five would actually render at a time, so I guess there's a limit on that.
Then I tried putting in an area light. That didn't do anything, so that's when I started doing research about baked lighting on sprites (and baked lighting in general). I found stuff like this but I couldn't get it to work either because it's outdated or because I don't know what I'm doing. Other answers I've come across seem to assume that the reader knows anything about lighting in Unity in the first place which, to be honest, I don't. Unity's documentation website had some information on it, but no tutorials that go into how to set up baked lighting.
I've tried a bunch of different combinations of materials (like using the "Standard" shader for the sprites instead of "Sprites/Diffuse", emission, ect.) and I enabled "Baked Global Illumination" in Lighting>Settings.
If baked lighting isn't possible on sprites (or isn't worth the trouble), what are the alternatives?
Edit: I made sure not to have the lights pointing the wrong direction, and I do realise that Unity2D is just like painting onto a piece of paper in Unity3D. I was able to get point lights to work, but only a few at a time. I don't need to do the entire screen at once, I need to do a large specific area at once.
some tips...
working with sprites your in 2d... when you add a light, switch to 3d mode, and rotate to make sure your light is pointed at your objects, and oriented so as not to be on the same plane, or level with them, as this will cast all the light behind them.
if your trying to light up everything on the screen(in camera) attach an area light to the camera at the cameras position, point it where the camera points, and then in the inspector on the right, you can change its variables. intensity, range, width, height etc.
Emissive Texture:
https://www.youtube.com/watch?v=oa6kW5HhRd4
For some reason, I never even thought about going into the asset store. I found this for free, and it looks like it will work: Light2D.

Making a custom skybox for Unity

I'm struggling to find any simple/up to date tutorials on how to make my own skybox for Unity. I want the skybox to be cartoony/vector based so preferably I would like to make it in Adobe Illustrator.
How do I do this? Could anyone direct me to any tutorials? Also, are there any programs that allow you to upload an image that generates a skybox for you?
Thanks!
You may create a new "Skybox/6 Sided" material, and asing it instead the default skybox material. It's the same principle, a cube with 6 images that correspond to each side "front, back, up, down, left, right".
You have to generate a cubemap to have a skybox object, young padawan.
From the Unity Manual:
http://docs.unity3d.com/Manual/class-Cubemap.html
A Cubemap is a collection of six square textures that represent the reflections on an environment. The six squares form the faces of an imaginary cube that surrounds an object; each face represents the view along the directions of the world axes (up, down, left, right, forward and back).
Cubemaps are often used to capture reflections or “surroundings” of objects; for example skyboxes and environment reflections often use cubemaps.

How to achieve Terraria/Starbound 2d lighting?

I am making a 2d game in the perspective of Terraria/Starbound. I want the lighting to look similar to this:
Ive tried to get lighting like this by adding a material on all the sprites in my game and then giving them a sprite diffuse shader. Then I made a point light wherever I needed light. There where two problems with this though: 1) Where the light was most intense, it was draining the color of a sprite and made it lighter. 2) I noticed a big FPS drop (And I only had 1 point light!).
Is there any way of achieving lighting like this without having to write my own lighting engine? Ive search the asset store and Ive searched to see if unity has any way of handing 2D lighting from this angle but I have found nothing.
If I do have to write my own lighting engine, would that be to complex for someone who is relatively new to unity and has only had ~ 8 months experience?
Assume you are using tile map.
You need to have a field of view map, which can be achieved by reading this: http://www.redblobgames.com/articles/visibility/
Using such map, you know exactly the color tinting for each tile. Now, just blend the color to the SpriteRenderer of every tile on the map.
Somebody already created a line of sight plugin:
http://forum.unity3d.com/threads/light-of-sight-2d-dynamic-lighting-open-source.295968/
Here's my hacky solution on GitHub
There's 2 cameras.
Empty tiles on the tilemap are filled in with white blocks (only one camera renders this)
A gaussian blur is applied to the camera rendering the white blocks
Then, blend the two cameras, darkening everything not covered by the white blur.
You can adjust the "light" penetration by changing the white tile's sprite's Pixels Per Unit.