Use the sprite normal map to assimilate 3d mesh to use with Unity shaders - unity3d

sorry if this is a noob question, is there a way to combine Unity shaders made using the Shader Graph with sprites? I would like to use the normal map attached to the texture to assimilate a 3d mesh, so that I can use some more advanced Shader Graph nodes (e.g. Fresnel).
It seems that the 2d shader examples online work only on the dissolve effect, character outline, tint changes, ... and I cannot find anything on using the highlights/lowlights already present in the 2d art to make it behave like 3d. I also have not found any examples of more complex shader effects that work on 2d. Any input would be greatly appreciated.
To give a more specific example, could this shader be adjusted to apply to a sprite?
https://www.youtube.com/watch?v=Cl4wkGjtGgw&list=PLkADxCB_xHGkE3iguVxNOStONQoidH4sr&index=3&t=3s&ab_channel=PabloMakes

Related

How can I fix these gaps in my outline shader?

My game uses very low-poly models for most of its geometry, and my current outline shader, which inverts normals and "scales up" the material, doesn't really cut it for this. Admittedly I have very little experience with shader graph but I'm trying my best here. These outlines are part of the Render Objects renderer feature in URP.
Here is an example of the issue in question, as well as the shader graph itself.
The shader you made requires smoothed normals for all vertices. If you need to have an edge on one of your outlined objects, you will get the following result with gaps because the cube doesn't have smooth normals.
And your models being very low-poly makes it a lot more visible.
I'd suggest just using a Frensel Node and attach it to a step node to get harsh outlines which you can just connect to emmision or something since it would probably only take 4-5 Nodes

Flutter canvas. How to draw frustum or add a frustum to a basic graphic?

I know how to draw a basic graphics,
canvas.drawCircle();
canvas.drawPolygon();
...
Is there any way to draw a frustum make it to 3d? Like those:
The 3D effect in the shapes that you posted most likely get their effect from shaders, not from a frustum. There are some limited abilities to use some shaders in Flutter, you can read more about it here: https://wolfenrain.medium.com/flutter-shaders-an-initial-look-d9eb98d3fd7a

How to use Point and Spot Lights With Mesh instancing?

I've been Experimenting with GPU Instancing to draw 1,60,000 Meshes and Unity's Graphics API has some really Good Functions to achieve this.
I am currently using Graphics.DrawMeshInstanced and I get the Meshes on the Screen, However, these Instanced Meshes only react to Directional Light, and not to Point/Sport lights. Is this a Limitation that cannot be overcome or am I missing Something here?
I am currently using an Orthographic Camera with Forward Rendering , and Unity's Standard Shader for the material. If It helps I am trying to make a Simple Rimworld like game.
With Directional Light
With Point/Spot Lights

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.

Shader to bevel the edges of a cube?

This question relates to using shaders (probably in the Unity3D milieu, but Metal or OpenGL is fine), to achieve rounded edges on a mesh-minimal cube.
I wish to use only 12-triangle minimalist mesh cubes,
and then via the shader,
Achieve the edges (/corners) of each block being slightly bevelled.
In fact, can this be done with a shader?
I recently finished creating such shader. The only way it can work is by providing 4 normal vectors instead of one for each vertex (smooth, sharp and one for each edge of the triangle for the given vertex). You will also need one float3 to detect edges.
To add such data in a mesh I made a custom mesh editor, comes with Playtime Painter Asset from Unity Asset Store. Will post the shader with the next update. Also will post to public GitHub.
You can see some dark lines, it's because it starts to interpolate to a normal vector which facing away from light source, but since there are no additional triangles, the result is visible on a triangle which is facing the camera.
Update (2/12/2018)
Realised that by clipping pixels that end up having a normal facing away from the camera, it is possible to smooth the outline shape. It wasn't tested for all possible scenarios but works great for simple shapes:
As per request added a comparison cube:
Currently, Playtime Painter has a simplified version of that shader, which interpolates between 2 normal vectors and gives ok results on some edges.
Wrote an article.
In general the Relief Mapping is able to modify the object silhouette like on this picture. You'd need to prepare a heightmap that lowers at the borders and that's it. However I think that using such shader might be an overkill for such a simple effect so maybe it's better to just make it in your geometry.