Questions tagged [shaderlab]

ShaderLab is a declarative language for writing shaders used in the Unity3D game engine.

ShaderLab is a declarative language used in all shaders for Unity3D. By itself, ShaderLab can only be used to write simplistic fixed function shaders that are compatible with older devices. However, it is often used in conjunction with and inside of CGPROGRAM snippets to write more complex surface shaders or vertex and fragment shaders.

References

79 questions
0
votes
0 answers

Convert Depth to Position

I would like to convert a DepthInformation into a position. Somehow I can't do it even after several attempts. I try to get the position of objects fragment from the DepthInformation that i get from an Depthpeeling shader. This is the code writing…
HTTRCH
  • 67
  • 4
0
votes
1 answer

Why does my Unity shading work strangely on a Mesh?

So for context, I create a mesh based on vertex and triangleindice data. Within the function I create a Polygon object, which basically holds an array of vertices who each have their individual colors attached along with its positioning (Although I…
Fl0ris
  • 38
  • 7
0
votes
1 answer

How do I include shader functions from a package in a unity shader? (built-in pipeline)

I have installed the package NoiseShaders (https://github.com/keijiro/NoiseShader.git) via the package manager in Unity. It shows up as installed in my package manager. My question is how do I use its functions in my shader? Do I include something,…
Jesper
  • 60
  • 5
0
votes
1 answer

What does "2..xxx" mean in shaderlab?

float3 f = float3(1,2,3); f *= 2..xxx; I have no idea what ..xxx does. I got the code from here
Hello Humans
  • 25
  • 1
  • 6
0
votes
1 answer

"Stencil Operation" property setup?

I know when declaring the properties for a shader there are some types of "input": float, range, color, 2D. but when I try to set up a Stencil Operation as a property. how to do this? I mean what I know that Stencil Operation is one of this list…
Firas Bz
  • 11
  • 1
0
votes
1 answer

Shader to warp or pinch specific areas of a texture in Unity3d

I've mocked up what I am trying to accomplish in the image below - trying to pinch the pixels in towards the center of an AR marker so when I overlay AR content the AR marker is less noticeable. I am looking for some examples or tutorials that I can…
nwales
  • 3,521
  • 2
  • 25
  • 47
0
votes
0 answers

Efficiently color pixels by given region as polygon in shader

In my application, I have partitioned the screen into different regions. These are given by the polygon boundaries. Once this partition has happened in the CPU, the shader should now give each pixel a value corresponding to the region it is in. At…
berndibus
  • 95
  • 10
0
votes
1 answer

Trying to modify Shader so that the colors are vertical and not horizontal

This shader (copied below) makes a material kind of like a radial gradient. I am trying to modify it to have the shader effect resemble something like a vertical/linear gradient,like this. I don't believe it is creating is a true gradient but…
cyo
  • 69
  • 1
  • 14
0
votes
1 answer

Unity: Hide material in specific area

I am making a 3D application for ios and Android. Each object in the below image has a different material than others. I want to make the part of object 3 that intersects with object 2 appears and the part that intersects with object 1…
MBS
  • 673
  • 2
  • 16
  • 48
0
votes
1 answer

How do I discard pixels based on vertex color and turn that on or off in a MonoBehaviour?

I've written a shader that uses a mesh's vertex colors and also has a function that clips all vertices that have an interpolated vertex color in the blue channel greater than 0.5 (discards all blue vertices). I'm trying to create a voice command…
espeon
  • 57
  • 1
  • 8
0
votes
1 answer

ShaderLab offset not rendering one polygon above the other

I have two shaders, UnlitRGBA and TransparentNoOverlap. They are as follows: UnlitRGBA.shaderlab // Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt) // modified by rbjacob101 Shader…
rbjacob
  • 193
  • 3
  • 14
0
votes
1 answer

How to cache common (for all pixels) variables in ShaderLab?

Suppose I have the following shader: Shader "Sprites/X" { Properties { [HideInInspector] _MainTex("Sprite Texture", 2D) = "black" {} } SubShader { Pass { CGPROGRAM // bla bla …
VanDir
  • 1,980
  • 3
  • 23
  • 41
0
votes
1 answer

Weird behaviour of shader when saving a scene

I wrote a custom Editor script for a class of mine to set colors to a material whenever any of the color values change, this gives me the option to preview the colors on the go. The script works very well but when I save the scene there is something…
Don Andre
  • 932
  • 1
  • 5
  • 24
0
votes
0 answers

How can I get texture size in shader?

I am trying to implement shader for a LineRenderer (Unity component). And i need to get value from 0 to 1 for x axis in frag shader, that means position in local texture coordinates (0 for pixel on the left side of texture and 1 for right side…
Sergiy Klimkov
  • 530
  • 7
  • 15
0
votes
1 answer

Unity transparent shadow receiving plane for AR app to receive only shadows and not light reflections

I'm working on a transparent shadow receiving shader for Augmented Reality app in Unity, that is put into a plane which will receive shadows from point light or spotlight. It works fine, but the plane receives light also as you can see in the…