Questions tagged [shaderlab]
The shaderlab tag has no summary.
42 questions
0
votes
0
answers
437
views
Overlapping geometry (Z - Fighting) solution with shader in Unity
I have geometry that is overlapping with other geometry (the floor). So, I used a shader to bring my desired mesh to the top. However, a new problem arose: the shader was rendering not only on top of ...
2
votes
1
answer
2k
views
How to support Texture Tiling + Offset for custom shader
I've written a custom shader (with help) and I'm not sure why it does not have tiling & offset capabilities. What is the simplest way to add that feature to my shader?
current shader code
...
0
votes
0
answers
88
views
Discarding pixels of a 2D game object based on its properties in camera render texture
I have a C# script and a shader script that is supposed to create two game objects and discard pixels of the second game object based on whether or not the b value of the pixel as shown in a camera's ...
0
votes
0
answers
843
views
Render only part of mesh that is intersected into inother Mesh in Unity
How can i make ZTest only happen inside a object not behind it?
my shader is simple unlit with two pass one is ZTest Greater as red one and one is ...
0
votes
0
answers
192
views
Why is the back layer sometimes rendering in front?
I have a layer rendering issue, where the top layer of content will sometimes not render to screen as it appears that the bottom layer is rendering on top (even though it's behind in world space). It ...
0
votes
1
answer
569
views
OUT.worldPosition effect on shader
I am trying to follow a shader tutorial from 2016 for unity.
I reached the point where the author is distorting the text by changing OUT.wordPosition
...
0
votes
0
answers
63
views
How to make it possible to change the width of the stripes?
I am making a shader to create stripes based on this tutorial, but I cannot set the width for each stripe and make a shader that accepts light.
...
0
votes
1
answer
2k
views
How to do "Screen Space Texture" mapping on a Unity UI Image?
So I'm fairly new to the shader and I've been trying to achieve this kind of effect from Ronja Tutorials, but instead of using it for normal mesh object, I'm trying to use it for Screen Space UI Image ...
0
votes
0
answers
258
views
Stencil test doesn't work at all in Unity when I am using a custom shader
I am using Unity 2019.3 and I have a custom shader A which contains the code
Stencil{
Ref 5
Comp Equal
Pass Keep
}
And the other custom shader B ...
2
votes
1
answer
1k
views
how are semantics used when declaring a struct?
I don't understand how semantics are used in shaders. While reading Unity's shader tutorials, I come across this
...
1
vote
1
answer
3k
views
Morphing a 3D model into a sphere or cube using a vertex shader
I want to morph between 3d models.I found a simple OpenGL code to morphing In Graphics Shaders: Theory and Practice(page 456) but I couldn't Implement it correctly in unity.
...
1
vote
1
answer
3k
views
Custom shadow mapping works with perspective light view but not with orthographic
About a week ago, I decided to make my own shadow mapping technique in Unity based on my understanding of the whole thing. The entire experience was somewhat successful. I learned a lot and I get to ...
0
votes
1
answer
5k
views
How to add emission to texture in shader?
I want a texture to emit itself by 1, not more. In Standard Shader I enable Emission and set texture to Color and Color to 1. I don't need emission to go beyond the object, I only need the texture to ...
0
votes
2
answers
373
views
GPU Gems Chapter 1, update normal
Had plans to follow GPU Gems to gain knowledge in Shaders - but my journey came to an abrupt end.
...
0
votes
0
answers
327
views
Half-shaded pixel artifacts on 2d dynamic lighting shader
I'm working on a shader for dynamic lighting in a 2 unity game. I'm new to shaders but I've managed to get something close to the effect I was looking for, although not 100%.
As you can see in the ...
1
vote
2
answers
2k
views
How can I make a shader that will make a cube or any object invisible?
I'm trying to create a shader that will make the object invisible and then with a script a fade in/out effect between invisible and visible.
What I tried:
...
76
votes
1
answer
25k
views
How can I make a "wet surface"/"shallow puddle" shader in Unity?
In my game I need to create dynamic water puddles but I cannot find a tutorial that shows how I can make such an effect (an example of which is shown below). How can I do it?
0
votes
1
answer
3k
views
How can I fix my shadow caster problem?
I'm trying to make invisible object with shadow by using it's shadow castting pass it additionaly shades back side of object itself. I mean object shades his back side and draws shadow on the ...
9
votes
1
answer
3k
views
Moving texture according to position in shader
Divinity Original Sin have beautiful particle effect , When I move around game I see galaxy through particle that move according to my position.how can I make like it?
you can see this effect here:
...
13
votes
3
answers
10k
views
How can I make natural rain drops on screen?
I'm trying to make rain effect drop with metaballs and trail on screen.I find a clue in shadertoy but I didn't understand how implemented:
https://www.shadertoy.com/view/ltffzl
unfortunately it have ...
0
votes
1
answer
3k
views
how can I make delay in shader?
my effect is loop but I need have delay between each flash effect.i don't want use c# code because i believe there is easy way to implement delay in shader.
...
3
votes
1
answer
5k
views
How can I roll up a plane with a vertex shader?
I have plane that I want to roll up using a vertex shader, like this:
I found a math demo that shows the kind of curve I want my mesh to follow. I tried implementing this in my shader code, but the ...
2
votes
0
answers
1k
views
How to create inline glow shader for 2d polygon in CG using Unity Shader Lab?
So here is what I am trying to do. Given irregular polygon (on the left) I would like to be able to create a shader that would resemble Photoshop inline glow effect with opaque fill (on the right).
...
0
votes
0
answers
174
views
How can I Increase pixel In rendering my shader?
This is my flow map shader , it works correctly but I have problem In Rendering.
how can I Increase pixels per unit In my shader?
...
0
votes
1
answer
2k
views
Accessing vertex Input in surf directly without vert's out parameter In Tessellation Shader
I can get the vertex Input in vertex shader as follows:
o.worldPos = v.vertex.xyz;
But how do I get the worldPos directly without filling the out parameter in ...
1
vote
0
answers
117
views
how can I add animated shadow on my flag?
this is my flag:
I need to adding shadow effect on my animated flag like below image but I don't know how can I do this:
here is my shader:
...
2
votes
1
answer
230
views
How to draw texture with unlit effect on surface base texture
I am writing a shader to my Unity game and I want to have effect this type of effect:
Base texture, for example, skin of character is a texture that will use shadows, lighting.
Second texture, unlit, ...
6
votes
1
answer
2k
views
How can I make custom character face editor In my game In an optimal way?
In many games there Is section as customize character that you can make your own character.I always love to know how can I make something like It.
Even old game have this feature? but how ?
For ...
9
votes
1
answer
1k
views
Why does duplicating my object cause its vertex animation shader to distort it?
I used a vertex shader (based on this example) to animate a flag waving. When I have a single flag in my scene, it works correctly.
When I duplicate the flag, all of the copies become wildly ...
0
votes
1
answer
3k
views
Why my stencil mask doesn't work?
I've a very sipmle Unity scene.
It has two objects in it, which is Sprites, and they both use sipmle black boxes as a textures.
Here's two shaders, one should act as a mask, and second as a object, ...
1
vote
0
answers
1k
views
Adding an extra Pass to the Unity Standard Shader
I'm experimenting with adding some procedural textures to the unity standard shader. I'd like to add an extra pass (with vert and frag functions), but am unsure about where in the sequence this should ...
4
votes
0
answers
3k
views
Overlap transparent particles without blending? (Unity)
I'm trying to create a continuous output of light from an object (like the exhaust of a space ship), and I thought I'd use particles to achieve this. But I'm running into a problem with alpha blending....
2
votes
0
answers
476
views
Shaderlab and Cg API reference [closed]
I am looking for definitive information on Shaderlab's API and the Cg language. The documentation I have found so far has been by way of example programs rather than a definition of APIs. Also, ...
3
votes
1
answer
2k
views
Selective Image Effects with Stencils
I am trying to create an image effect where only a part of the image has the effect applied to.
One way I can think of to do this is to define the portion of the image using the stencil buffer.
...
4
votes
1
answer
4k
views
How are Stencil Buffer Operations Applied in ShaderLab
In Unity's Shader lab, I've read that the Stencil buffer is implemented with a mask, and an object reacting to the mask.
The mask may be defined like the following:
...
0
votes
0
answers
136
views
Unity equivalent of glDepthMask or alternative
I'm trying to achieve the following setup:
2 cubes. In the image attached they are the green and pink cube. They are both rendered culling their front faces, so that they are visible if a camera ...
1
vote
1
answer
839
views
Problems with BlendOp Max
I'm trying to write a shader that doesn't blend additively etc etc. I'd like to take whichever of the source or destination colours is brighter and use that and ...
4
votes
2
answers
1k
views
How do I get a Light's Range value in Shader?
I'm trying to write a simple frag/vert shader that, depending on whether it is in the range of a light, will paint the appropriate colour from either the 'lit' texture or from the 'unlit' texture.
...
2
votes
1
answer
2k
views
How to apply a shader to only one side of an object in Unity3D
So I have this rather simple surface shader that essentially cuts a hole in the object based on another texture.
...
1
vote
1
answer
7k
views
Unity / How do I change the color of an object based on its depth?
The objective here is to change the color of the nearest object.
(the nearer the object, the more "colorful" the object gets rendered; and the farther away, the more "grey" the ...
0
votes
1
answer
260
views
Unity Geometry Shader Compiles forever
I am writing a shader to achieve a laser show effect example.
For now I am just focusing on the lines. One line ist represented as one triangle.
When I save my shadercode, unity gets inactive and I ...
7
votes
1
answer
24k
views
Why can't I sample a texture in a vertex shader?
I'm old in Game Development but very new in shader writing. I just want a shader that transform from 1 texture to another. So I did start learning shader writing and wrote my desired shader. But ...