Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [shaders]

a computer program that runs on graphics hardware and provides a high degree of control over how scenes are rendered

0
votes
1answer
26 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
1answer
23 views

Creating materials in modeling program vs in Unity: when to do either?

This is something I should know the answer to by now, so I'm asking to clear up the gaps in my knowledge: As I (re)learn about shaders, specifically in relation to Unity, I see all sorts of ways to ...
0
votes
0answers
23 views

Performance of static const variable in shader

I am using static const variables based on uniform variables. For example: ...
0
votes
1answer
26 views

Why do I get an unexpexted token error while compiling this shader?

While following this tutorial, I get the following error syntax error unexpected token vertex I am still learning shaders so I can't really understand the reason for this error. How can I make ...
0
votes
0answers
19 views

Unity apply materials to parts of a mesh

How can I apply materials to a part of a mesh in Unity ? As an example I would like to place grass on the first half of a plane and rocks on the second. And if possible, how can I manage transitions ...
0
votes
0answers
32 views

Problem with hard edges alpha channel in sprite Shader

I was looking for a shader which can apply a texture on the sprite and tile it based on its world position. I found example of shader from here. It works well, except the alpha channel breaks down ...
0
votes
1answer
44 views

Texture Atlas and HLSL Shader for sprite tiling

I am trying to create a shader that allows to tile a specific region of a texture. This seem to be a common need however I can't seem to find any information about how to get this effect done. The ...
0
votes
0answers
21 views

Raytracing infinite hair strand in modulo space (curly version)

I'm working on a hack for hair rendering, I basically trace modulo voxel to get infinite grid intersection. It's basically a division from the entry point to the hair center using the delta of the ...
0
votes
1answer
51 views

How can I make Matrix Rain?

I want to make 3d Matrix rain like this shader that you can rotate camera.I tried to convert this shader but It have many calculations that it's expensive inside game engine.then I tried to make this ...
0
votes
1answer
41 views

DirectX 11 Compute Shader error DXGI_ERROR_DEVICE_HUNG

I am trying to use a compute shader for ray picking technology. My shader accepts: vertex buffer of all models index buffer of all models a buffer of transformation matrices of all models Offset ...
0
votes
0answers
40 views

Don't Render always on top Unity world space canvas UI

I have a World Space Canvas where I have a text object which is always rendering on top. I checked that it has UI/Default Shader attach. Is there any way available ...
1
vote
0answers
35 views

Artefacts in SSAO Shader

I am having trouble with my Screen Space Ambient Occlusion shader. The objects in the game have the correct occlusion applied to them, however the occlusion flips depending on the angle of the camera:...
1
vote
1answer
145 views

How do I make my glsl RGB displacement map look like this

I want to use a RGB texture as described in this video here. Here is my texture so far. The author says the first line has no R channel and ranges from B = 0 to B = 255. While each other line has R ...
0
votes
0answers
53 views

How to get Pixel Coordinates of certain colors in a Texture?

I have a relatively big Texture, and I try to find a certain color pixels pattern: eg. White, Black, White, Green . They are lying next to each other, If I use Texture2d.Getpixels() on every pixel ...
0
votes
2answers
41 views

Extracting individual components of a vector in the Source Shader Editor

I'm using the Source Shader editor and would like to mask a vector output to one or two values, yet there is no existing mask node, as far as I can see. What HLSL code should I use to output what I ...
0
votes
0answers
52 views

Is the GPU's texture memory cache cleared when reading from multiple textures?

I have been reading lately about the memory layout of graphics cards and the issue with dependent texture reads. I am worried about the efficiency of the way I use framebuffer textures. Initially I ...
0
votes
0answers
50 views

How to create a shader for this hue change effect?

In this cut scene from Shovel Knight, the individual pixel art tableaux don't merely fade in and out. Rather, they fade in and out as well as undergo various hue changes. Here's an example: The ...
0
votes
1answer
52 views

Multiple Colour Gradient Lerp

I want to return a colour for a position t, given an arbitrary number of colour stops - a stop is comprised of a position, and a colour. Like selecting a colour from a multiple-colour gradient, ...
1
vote
1answer
27 views

What does vertex:disp and tessellate:tessEdge mean? [Shader] [Unity]

I came across the following declaration on unity tutorial #pragma surface surf BlinnPhong addshadow fullforwardshadows vertex:disp tessellate:tessEdge nolightmap ...
0
votes
0answers
11 views

Exporting Terrain Heightmap from Unity is black

For a current project I need to export my terrain's heightmap to pass the height information to my shader. When I use the "Export Raw..." feature under terrain settings, I get a black image. What am ...
0
votes
0answers
19 views

Unity3D: Mask on Animated Shader

Regarding the answer in this question: Animated textures for models; How to write a shader? I'm trying to use it together with a masking shader, but it doesn't come out with the result that i ...
0
votes
0answers
32 views

How can I convert 3D mesh to SDF?

Previously, I found an useful article that explained how to convert 3d mesh to SDF easily. I want our artists to be able to easily convert from polygonal data to SDFs with little-to-no effort. ...
1
vote
1answer
118 views

Rendering clouds similar to Sky: Light Awaits?

I'm interested in adding clouds to my game, with a style similar to those in Sky: Light Awaits You can see them in motion in these videos: (Starts at 26:00) https://www.youtube.com/watch?v=...
0
votes
2answers
88 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
0answers
26 views

UI Animation with shader move weakly

I want to animate UGUI vertex with shader like this: ...
0
votes
0answers
59 views

Unity Shaderlab: Pixel Perfect Distortion Shader that uses screen position?

So I am trying to make a distortion effect vertex-fragment shader! I am pretty new to shaders in general, and I am having some trouble with it. The effect is: from a distortion texture, I get a ...
0
votes
1answer
118 views

HLSL float bitfield

In HLSL I want to store a bitfield for each color in a texture. Specifically spanning 3 floats (RGB, not alpha). Since each float has to be between 0 and 1 I can only use the significand/mantissa of ...
0
votes
0answers
20 views

How to QUICKLY make material from images in Unity?

Ok for these years Ive made materials from exported texture images by 1. importing the images 2. make a material 3. Manually drag each image into its slot in the material There must be a faster ...
0
votes
0answers
53 views

2D Lighting Shader Multiple Lights

For a 2D platformer, I have a 2D lighting shader with two passes, the first one draws a shadow from the closest light to the sprite and the rest of the lights will reduce the visibility of the shadow ...
0
votes
0answers
30 views

Using a light mask overlay without lighting the sky

I'm using an overlay to create a lighting effect in a 2D game. The overlay is a grey-scale mesh and I multiply each pixel of the mesh with the pixel already written to the framebuffer. This works ...
2
votes
1answer
127 views

How to implement a pixelated screen transition shader?

I am interested in creating a screen transition seen in a lot of retro games. The transition is just a kind of pixelated distortion that increases or decreases in granularity over time. The effect is ...
0
votes
0answers
48 views

Weird behaviour of glsl with fragment, vertex and geometry shaders

I am a beginner in developing games. I started some time ago with OpenGL and the glsl language. These days I am having so many problems and for me it is too difficult to solve, because the shaders are ...
1
vote
2answers
264 views

2D Blizzard/Snowstorm Effect

How can I implement a blizzard/snowstorm effect in a 2D platformer? I have a particle system for snow particles, but I need some kind of windblown texture similar to this as well: How do I create this ...
0
votes
1answer
87 views

How can I write a dots effect shader when the character is behind an object?

I watched an interesting effect while I was playing Super Mario Odyssey: when Mario or another character was behind an obstacle (walls, etc), a tiny gray silhouette mesh appears. I tried to build ...
0
votes
1answer
33 views

Using multiple textures in Monogame HLSL Effect shader?

My Monogame HLSL shaders only successfully sample one texture (besides the screen). Any additional textures I try to sample end up with the same texture data as the screen. I've found people with ...
1
vote
0answers
17 views

Transparency problem / Expanding material fixes it magically?

i stumbled upon a problem, can't figure out what's the reason and how to solve it. I have glass-windows which use just the standard (specular setup) shader. in the first place when the model is added ...
0
votes
1answer
35 views

GLSL Shader compiles, but source is empty

I'm trying to compile a GLSL shader, to which I use the following code. Initialization ...
2
votes
3answers
266 views

Are there technical reasons to use short variable names in shader code?

I have been reading and writing both GLSL and CG for the past few years, and have noticed a trend. In programming, we are generally advised to be as meaningful and concise as possible with variable ...
0
votes
1answer
47 views

GLSL - Efficient Point inside Box Check

I'm attempting to improve the performance of a shader that changes the colour of a region of the world that is inside a "zone". I am using a deferred lighting system, so the colour and world-space ...
0
votes
1answer
35 views

Unity - Adding a sphere volume to this shader

I'm trying to create a spherical effect around my player that when they walk into range of hidden object, it gradually renders the object. I found a shader that would work pretty well for this. When ...
6
votes
1answer
277 views

How can I implement a revealing light beam?

In SEARCHLIGHT, you control a ray of light that illuminates incoming enemies that are otherwise invisible in the night sky. Here is an illustration: How would I go about doing this, preferably in ...
0
votes
0answers
28 views

How can I add recieve shadow to my transparent shader

I need a shader with these features recieve shadows transparency (changing alpha for fading) Cutoff (alphatest cutoff) this is my shader: ...
0
votes
1answer
100 views

Moving/spilling water inside a cup of glass

I made a glass of water but there are somethings i didnt know how to do well, what i did is i put a mesh on the top of the glass to represent the surface of the water but it doesnt really work well ...
0
votes
1answer
130 views

Make a glass cup look like it's full of water

I've been struggling to figure out a way to make a glass cup full of water, and since the cup is made of glass a plane on the top of the glasse won't really do it, so how can i go around making the ...
0
votes
1answer
67 views

Unity Manual Instance Example Shader contains errors

The Unity Manual has a page on GPU instancing. One of the examples, titled "Adding instancing to vertex and fragment Shaders", causes the following errors to printed to the console when saved in a ...
1
vote
1answer
74 views

OpenGL Deferred Shading Pixelation

I'm working on a 3-pass deferred lighting system for a voxel game, however I am having problems with pixelated lighting and ambient occlusion. The first stage renders the color, position and normal ...
1
vote
1answer
41 views

How to implement multicolored flashing sprite effect like in Contra and the Messenger?

I want to implement an effect similar to what you see in this clip of Contra. When the boss takes damage, he flashes wildly with different colors. A similar effect can be seen in this clip from the ...
1
vote
0answers
47 views

How can I blend meshes together where they intersect?

In a lot of my scenes I have things like this: and this: All the places I've circled are places where a prefab overlaps with another one or with the terrain. Is there any way to make those lines ...
0
votes
0answers
15 views

Use Shader Graph break all materials?

I want use ShaderGraph in my game for first time. I installed pipeline and when I turn it on all materials turn pink "broken"!! What can I do to solve this ?
0
votes
0answers
71 views

How to play a material's shader in an image? (Unity 5.2.0f3)

I would like to obtain the same effect as in Seasons After Fall in Unity 5.2.0f3 for a 2D project: https://i.stack.imgur.com/WCIhs.gif Here the trailer, https://www.youtube.com/watch?v=cmAWybFKNh8 ...