Point light in Unity (3D) only shines in one direction when I add a normal map to a material - unity3d

I've been looking around for answers and I haven't found any.
Whenever I add a .jpg as a normal map in a material, and use that material on objects, point lighting breaks and only shines in one direction
https://i.stack.imgur.com/zoeT9.jpg
(With the .jpg added as a normal map)
https://i.stack.imgur.com/fZy5w.png
(Without any normal maps added, how it should look)
What am I doing wrong?
https://i.stack.imgur.com/3IWLV.png
This is the settings for the texture I'm trying to use

Related

Accessing a secondary texture normal map in shader graph?

I'm using Unity 2020.1.3f1's URP, with the new 2D renderer system.
As of right now, I have objects that change between the built in "Sprite-Lit-Default" material, and a material with the custom built pixel outline shader detailed here: https://danielilett.com/2020-04-27-tut5-6-urp-2d-outlines/
This worked well and good, but I recently added lights, and a normal map to my sprites as a secondary texture in the import settings. The default lit texture has no problems displaying the normal map, but when I attempted to modify my shader graph to include the normal map, it doesn't import like the sprite texture does when _MainTex is set as the reference.
I've tried _NormalMap (which is the name of the secondary texture in the importer!) as well as _NormalTex, but it always ends up not importing the normal map. I even attempted changing _MainTex to a Texture2D, but given that kept sparking an error, I didn't think it was the right way to go about it. (This one to be specific.)
Error assigning 2D texture to 2DArray texture property '_MainTex': Dimensions must match
UnityEditor.EditorApplication:Internal_CallUpdateFunctions()
Am I missing something here? All the tutorials I can find online only show people dragging the normal map in through the inspector, but this material is going to be used by many different sprites, so that seems...counterintuitive.
On top of this, the default material/shader has no issues with this, so I feel like I'm either missing something, or I'm going to end up having to code my sprites to change material through code instead of the animator, just for this small, annoying quirk..
Blackboard Properties, and nodes. This just goes into the normals input.
Inspector panel showing the missing normal map slot.
And the Secondary Textures in case I somehow misnamed it, why not?
(EDIT)
So, an update on this, for anyone else who runs into this same issue.
I managed to find a section of the shadergraph documentation that seems to be the only part talking about this:
It is required to name the reference for MainTex as _MainTex to render Sprites. It is also recommended to name the references for Mask as _MaskTex and Normal as _NormalMap to match the Shader inputs used in this package.
So from what I gather from that, _MainTex is the only one that's automatic in ShaderGraph.
After a full day of looking up tutorials, I've noticed that every single one of them simply set the normal map and extra textures as the default textures so they'll show up without being assigned manually.
I think this is possible with hand-written shaders, but I've decided to just go with a simple unlit shadergraph on a hand-drawn sprite outline, displayed on a separate gameobject parented to the main object.
I'm not posting this as an answer in case someone else finds a solution to it in the future, and since this isn't...really a solution in my eyes.
I don't know if you have figured this out yet but I'll try to answer since I had the same problem. Create a new Texture2D node, convert it to a property, and have the reference as _NormalMap, connect that to the sample texture 2D node as normal, and plug that into the sprite lit master. Now go into the sprite editor, assign the normal maps as a secondary texture, and make sure the name is the same as in your shader, _NormalMap (or something else, as long as it's the same). This currently has worked for me, shader graph detects the normal map texture by reference automatically. Attached below are some images to help and the finished result on the character sprite, which uses a custom shader I picked up from a tutorial and added the normal map to.
Shader Graph Sprite EditorSprite Editor 2 Normal Map result

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.

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.

Unity3d: Texture viewable from inside object?

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.

Is it possible to combine textures in Maya into some sort of atlas?

I'm starting to use Maya to do some bone animations of a 2D character, which is composed of several different parts (legs, body, head, weapon, etc.). I have each part in a separate .PNG image file. Right now I have a polygon for each part, with its own material and texture:
I was wondering if there's a way to automatically combine the textures into an atlas, make all the polygons use the same material with the atlas, and correct their UV maps so they still point to the right part of the atlas. Right now, I can do it manually in reverse: I can make the atlas outside Maya with other tools, then use the atlas on a material and manually correct the UV maps of each polygon. But it's a very long process and if I need to change a texture, I have to do it all over again. So I was wondering if there's a way to automate it.
The reason why I'm trying to do this is to save draw calls in Unity. From what I understand, Unity can batch objects as long as they share the same material. So instead of having a draw call for each polygon in the character, I'd like to have a single draw call for the whole character. I'm pretty new to Maya, so any help would be greatly appreciated!
If you want to do the atlassing in Maya, you can do it by duplicating your mesh and using the Transfer Maps tool to bake all of the different meshes onto the duplicate as a single model. The steps would be:
1) Duplicate the mesh
2) Use UV layout to make sure that the duplicated mesh has no overlapping UVs (or only has them where appropriate, like mirrored pieces.
3) Use the Transfer Maps... tool to project the original mesh onto the new one, using the "Use topology" option to ensure that the projection is clean.
The end result should be that the new model has the same geometry and appearance as the original, but with all of it's textures combined onto a single sheet attached to a single material.
The limitation of this method is that some kinds of mesh (particularly meshes that self-intersect) may not project properly, leaving you to manually touch up the atlassed texture. As with any atlassing solution you will probably see some softening in the textures, since the atlas texture is not a pixel for pixel copy but rather a a projection, and thus a resampling.
You may find it more flexible to reprocess the character in Unity with a script or assetPostprocessor. Unity has a native texture atlassing function, documented here. Unity comes with a script for combining static meshes, but you'd need to implement your own; theres'a an example on the unity wiki that probably does what you want : http://wiki.unity3d.com/index.php?title=SkinnedMeshCombiner (Caveat: we do something similar to this at work, but I can't share it; I have not used the one in this link). FWIW Unity's native atlassing works only in rectangles, so it's not as memory efficient as something you could do for yourself.