Unity3D: How to make a glowing gradient sphere? - unity3d

So I need a glowing sphere with a halo of light, which casts light on a near objects. Also, as you see on the image, sphere must have a gradient.
I'm using 2 spheres and point of light at the moment. And I really don't like the results:
There is no gradient at all
I need to use second Point Light to cast light to near objects
So... is there any ideas?

I think you have two needs,
(1) the "actual" light which casts a light on nearby objects.
(So, I mean that is literally a UnityEngine.Light http://docs.unity3d.com/ScriptReference/Light.html )
(2) Separately, you need (basically) a "glowing orb" that looks like the white and yellow thing in your image.
These two things are completely separate.
You should indeed do them separately.
Now regarding "2" how to make a glow, that's called a "bloom". There is a lot to look in to but this will probably do it for you:
http://answers.unity3d.com/questions/914945/what-replaces-the-glow-effect-in-unity-5.html
Note that getting a good glow is not that easy.
Here's a really great asset, that's actually free for goodness sake,
https://www.assetstore.unity3d.com/en/#!/content/28044
you should surely get that to experiment with at first. There are other well-known assets as well, like https://www.assetstore.unity3d.com/en/#!/content/8238
Be sure to google for many QA on the glow topic.

Related

Unity Line Mesh Inward Shader

I am pretty new to shaders in unity and am stuck on a problem.
I am using ShaderGraph and unity 2021. I understood the ShaderGraph examples from the unity page and "implemented" an OutlineShader thinking I could simply "inverse" the direction (not multiply by some value to get a bigger object then coloring that object and laying the original object ontop). Yet I am nowhere near what I want.
Basically what I am trying to achive is a stepped color gradient to the inside of the object. As an image it should look something like this:
Starting from color0 (green) going inward to color1 (yellow) until i reach the center with colorN (white) and repeat the same for the other side. The shader is then used on a material that is applied to a MeshLineRenderer (LineRendererPro from asset store with minor modifications for custom behavior) which kind of looks like this:
In the end the line should be colored according to the specified colors and the direction the line is going.
Explanation of a simple "Inline" Shader (similar to an outline) would help alot. I think I would be able to adapt that concept and implement multiple colors with (maybe) percentages of width. I don't want to use a fixed image/texture since i want to change the widths and colors.
Any input is welcome and thank you in advance.

Am I able to make certain parts of a texture glow with post process bloom?

So I have these mushroom models, and some of the faces are blue as opposed to purple.
I was hoping to make the top part of the mushroom glow, but not the stem of the mushroom. Currently i just use a point light in Unity but it doesn't look very good.
Any help would be awesome! Thank you
Glowing Mushrooms
U can try making the textures emissive by adding an emission map, that way they will glow when using post processing bloom.
The bloom post-processing effect relies on a material or light's intensity values. So, you'd need a separate material for the stem and another for the head. For the head of the mushroom, you then need to set the material's emission colour as well as the albedo. This will allow you to make it glow slightly and then the bloom will then spread out that glow for you.
As per Bean5's post, you can assign an emissions map if you don't want to use two separate materials. That way, if you have one mesh then only parts of your model will glow.

Unity 2D: How to make tiles merge with equal textured neighbors?

Let me show you what I mean:
Suppose we have a puzzle game with colored square tiles/blocks falling, and they stack like this:
My question is, instead of each tile/block sprite stay visually separated from others, what technique can be used to make each tile aware of their neighbors when they stop falling, and change its sprite (and neighbors) to become visually "glued" with them, like this:
I cant seem to come up with a simple and efficient solution for this, any ideas?
Here are two options that come to mind:
Easier approach - Use a tilemap, each item should have variants for every color and connection in every direction
Harder approach - Build your meshes in realtime and calculate the actual sizes yourself. I think this option could be more robust, but it's much more complex to do (especially if you haven't done something of the sort in the past)

Unity Terrain Stitching Gaps

So, I'm attempting to create a simple dynamic endless terrain using simplex noise.
So far I've got the noise working just fine - however I am having issues with the terrain having discontinuities at the edges. At first I thought this was due to the fact that I was not calling SetNeighbors on the Terrain objects, but adding this did not seem to yield any improvement.
terrain.GetComponent<Terrain>().SetNeighbors(left, top, right, bottom);
This problem seems to be caused by the slight differences in height between each terrain position - but making these set the same will effect the terrain quality (will reduce how jagged the terrain can be in certain cases) and generally seems inelegant. I've been going through the unity docs trying to find how to address this, but have yet to find anything.
Is there something I'm missing? Or is my only option to fiddle the heights on one of the sides to match the other?
Thanks for reading, appreciated as always.
Terrain image for reference
A couple things-
First, make sure you're setting SetNeighbors() on ALL the terrain objects, not just one.
Secondly, if the terrain don't match up exactly, it either means that the terrains aren't calculating their data quite correctly, or there's some floating point error going on. However, I have a suspicion that it's the first one, given that manually changing the points affects the quality. Make sure you know that terrains have n^2 + 1 points, and also make sure that the point to query from your simplex function with is calculated in world space.
If you can't figure it out, post your code and I'll take a look.
Also, your terrain might look better if you used octaved (a.k.a factal) noise on your Simplex noise function, depending on what you're looking for.
Cheers!

How can I make part of a mesh transparent?

Is it possible to make some % of my mesh transparent?
For example, imagine I have a mesh that is a house. At first the mesh is transparent. As a person clicks on the house, it becomes opaque along the Y-axis so it looks like it's being built up.
Any ideas how to approach this problem?
"a house. At first the mesh is transparent. As a person clicks on the house, it becomes opaque along the Y-axis so it looks like it's being built up"
Literally in answer to your question, in general:
I would approach this by making a shader which was sensitive to the global Y value of the point in question. It would use that value, over time, to decide on alpha at a given point.
alternately
Imagine a second texture of the house, call it GUIDE, which is: imagine a monochrome house: at the ground it is black and it slowly becomes pure white at the tops. Additionally you could color it any way you want, for example, the window frames and quoining could be black and so on. Now, the shader would use the GUIDE texture as a key, to know at what time, that area, should become transparent.
That would actually look quite incredible and offer amazing control. You could fade in different parts in whatever order you wish.
It would be beyond the scope of an answer here to actually engineer this. But I believe the key here is, unfortunately for what you describe that is really all done in the shader, I'd say.
Note that if you just want "a clean hole", look in to approaches using a depth mask shader And indeed https://www.youtube.com/watch?v=s3RKGAj9Uzk
for 2D consider this, http://answers.unity3d.com/questions/449034/see-through-hole-via-shaders-on-a-2d-plane.html
in other cases you may literally want to cut a sharp hole in the mesh which is a "whole" different technology. https://gamedev.stackexchange.com/questions/72978/shader-that-cuts-hole-through-all-geometry
if you want this effect http://answers.unity3d.com/questions/622089/how-can-i-render-a-semi-transparent-texture-with-a.html (see mario image) that's totally different again - it's nothing more than a gray image with a hole!