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
11
votes
1 answer

Implementing Fur with Shells technique in Unity

I am trying to implement fur in Unity with the Shells technique. The Fins technique is purposely left out because I want this to run on low end mobiles (mostly Android devices) and that requires OpenGL ES 3.0 and above while Shells technique only…
Programmer
  • 121,791
  • 22
  • 236
  • 328
5
votes
1 answer

Porting XNA Shader pass, blend and cull mode into Unity shaderlab

I had to port XNA shader into Unity's shader and want to verify that I did this correctly. The Pass1 section that uses alpha blending like SrcBlend, DestBlend and set's cull to none is the only place I want to make sure I got right. This is the XNA…
Programmer
  • 121,791
  • 22
  • 236
  • 328
3
votes
1 answer

Why I can't use tex2D inside a loop in Unity ShaderLab?

I am trying to do something like while (currentLayerDepth < currentDepth) { currentUV -= step; currentDepth = tex2D(_HeightTex,currentUV).a; currentLayerDepth += eachLayer; } It logged a error Shader error in…
OtakuFitness
  • 542
  • 7
  • 20
3
votes
1 answer

What is IN.worldRefl in surface shader Input struct?

The question is pretty straight-forward. I have no idea what IN.worldRefl stands for, I've seen some tutorials using it with cubemaps but I still have no clue. Unity's description for it is very poor: float3 worldRefl - contains world reflection…
Daniel
  • 7,357
  • 7
  • 32
  • 84
3
votes
1 answer

Dump resources from Unity game to a file

I am trying to create a function that dumps every Resources data in a Unity game to a file and was able to dump the video, audio, script names and the image on the screen from the current loaded scene. I am stuck when trying to do the-same thing…
Programmer
  • 121,791
  • 22
  • 236
  • 328
3
votes
1 answer

Custom Shader not working on Android

I ported a Plasma ball shader from Shadertoy to Unity as Image Effect which is attached to the camera. It works fine on the Editor and Windows standalone build. It does not work on Android devices. It is flashing blue and black images on…
Programmer
  • 121,791
  • 22
  • 236
  • 328
2
votes
1 answer

Sprite outline effect appears one frame later

So, I have the following problem in a Unity 2019.4.36f1 fresh project. I would like to outline group of sprites with the Built-in render pipeline. For this, the developer needs to collect the SpriteRenderers it would like to group together. Then the…
Menyus
  • 6,633
  • 4
  • 16
  • 36
2
votes
0 answers

How do I convert unity shader to URP?

So I found this shader on the internet, but apparently it doesn't work with URP, what do I add to it to make it work with URP? I don't know much about shaders. Kindly help me out. Shader "Custom/Auto Tiling" { Properties { _Color ("Main Color",…
Hamza Amr
  • 165
  • 1
  • 12
2
votes
1 answer

Create an Unity transparent shader that hides itself

My shader code is: Shader "Custom/Transparent" { Properties{ _Color("Main Color", Color) = (1,1,1,1) _MainTex("Base (RGB) Trans (A)", 2D) = "white" {} } SubShader{ Tags {"RenderType" = "Transparent" "Queue"…
2
votes
0 answers

How to use Unity3d shader to mask another two-pass shader?

I am developing a game where I want to visualize user path - showing also where track overlaps (with some darker color than normal "not overlapped" track). Long time ago I have found this answer where it was advised to use stencil to create two-pass…
oleszczyk
  • 21
  • 2
2
votes
0 answers

How can I create Shader in runtime in Unity?

I want to create Shaders in Runtime in Unity. Is there any way? I found that article Creating GLSL Shaders at Runtime in Unity3D but this is no more working because Unity doesn't accept new Material({shader_code_here}); It requires new…
Siberhecy
  • 561
  • 1
  • 5
  • 16
2
votes
2 answers

Expose float2/vector2 property from shader to Unity material inspector

In a Unity shaderlab shader you can expose shader properties to the material inspector in the editor. This can be done by placing the properties you want to expose in the Properties section like so Properties { _SomeFloat("A Float", float) =…
Remy
  • 4,843
  • 5
  • 30
  • 60
2
votes
1 answer

Shader saturate() creating gradient when it shouldn't

Writing a shader for Unity and I don't understand what is happening here. I have a sphere with a material attached. Material has a shader attached. Shader is very simple, it generates some simplex noise, then uses that as the color for the…
Josh
  • 3,385
  • 5
  • 23
  • 45
2
votes
1 answer

Unity mesh has black spots

Hello I have followed a video series on YouTube made by Sebastian league on procedural generation and I have followed his whole video series, however on my part there are black spots in the mesh, only on water regions. I'm using global mode for…
2
votes
1 answer

How to create a shader that can display a texture made out of many small images in Unity

So what I'm trying to do is load satellite images from an SQL table and wrap them around a sphere to create a globe. I know I've got loading the images covered, I'm just not sure how to make my shader display the images in the correct…
Mike OD
  • 117
  • 1
  • 12
1
2 3 4 5 6