People who code: we want your input. Take the Survey

Questions tagged [shaders]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
93 views

Generating the distance of an intersection through a box from the camera in Unity C#

So, I recently saw this fantastic video by Sebastian Lague about planetary generation- https://www.youtube.com/watch?v=lctXaT9pxA0&t=1100s And I decided to replicate it, however, on a flat plane, ...
1
vote
1answer
198 views

OpenGL texture2d/image sampling issue. Strange artifacts in texture

I have an issue when using textures in OpenGL, strange artifacts occur where geometry overlaps, but not always. Video Reference. I am using a GL_TEXTURE_2D with <...
0
votes
0answers
75 views

Help with unity cel shader not work when turning away from the main light?

So i'm using this really good toon shader I found, that works with multiple directional and point lights. Only problem is, it acts weirdly when turning away from the main light seen here, ( sorry for ...
0
votes
0answers
52 views

Unity: What's the difference between SRP batching & GPU Instancing?

I've been researching a lot about Draw calls and how to reduce them, i'm using GPU Instancing and it's amazing, but i did not ...
0
votes
1answer
350 views

How to make a cell shader like BOTW in Unity?

It seems most cell shader tutorials focus on individual shaders for materials, but the effect used in BOTW seems to be more like a filter, that is applied to everything. I've researched multiple ...
1
vote
1answer
181 views

Constant Buffer Alignment issues

I have issues with constant buffer member alignments. I have the following C++ struct: ...
2
votes
1answer
107 views

How to render a grid of dots being exactly 1x1 pixel wide using a shader?

I would like to render a grid with many dots, all equally spaced and being exactly 1 pixel wide. What I was able to achieve so far is this : What I would like is (simulated using image editing ...
1
vote
1answer
386 views

How to write depth texture and read values from it

I am new in Unity and specializing in another field. But now I have to rapidly study it for a new project. I will be very thankful if anyone explain me how to read values of the depth buffer. I wrote ...
1
vote
3answers
3k views

Convert from Shader to ShaderGraph

I am working on procedural generation in Unity, and am now a bit stuck. I am using Perlin noise to generate a heightmap, including lacunarity, persistence, octaves and frequencies. Today I have been ...
0
votes
1answer
56 views

Controlling noise density

I'm trying to fake terrain blending by using an opacity mask on my road mesh to reveal the grass underneath. I'm currently multiplying some Perlin noise by a Rectangle node displaying my texture at 80%...
0
votes
0answers
104 views

Unity Grid Shader line Color

First of all I'm sorry if my question is a odd thing to ask, but i'm new to Shader things and don't know how to handle this stuffs. I have a shader that draws grid on a ground plane and it works just ...
0
votes
1answer
88 views

Apply Secondary Normal Map to Standard Shader by Script

I have a material with an existing normal map. I added a secondary normal map to represent damage via script. I assign to the appropriate texture property ...
0
votes
1answer
276 views

#pragma target 3.0 or 3.5? What is gained. What is lost for compatibility with older systems

I've just designed an image-based layering system shader. Multiple textures with Alphas overlay to create a fully dressed character, using 1 material. pragma target 3.0 is where I had started (...
0
votes
1answer
44 views

glsl wrong light direction

I'm practicing the Phong lighting model with glsl, and here's my shaders: vertex shader: ...
0
votes
1answer
783 views

Making a crosshatching effect in Unity Shader Graphs

I'm learning Shader Graph and am trying to experiment with toon shading effects. One thing I'd love to do is make a traditional art styled crosshatching effect either inside shadows or at the edge of ...
0
votes
0answers
439 views

Mobile Unity Shader - how to work with on/off boolean

How do you set a boolean for a shader? How do you write a conditional or assign a boolean in a shader? So, it seems that shaders do not take booleans... so I tried assigning the float to 0 or 1 <...
0
votes
1answer
51 views

Ocean visible through the island's lake in Unity3D?

I'm working on a puzzle game featuring islands: there is a plane with a water shader, and objects colliding with that plane. Now I'd like to make lakes on the islands, with different (higher) water ...
0
votes
1answer
115 views

Generated Mesh Does Not Have Shadows/Shading

Description I'm trying to create a water shader, and at this point in development I'm using a Photoshop-generated cloud texture as a map for vertex displacement. The displacement itself works just ...
0
votes
1answer
59 views

Unity: How can I control a Shadergraph effect on multiple enemies with the same prefab?

So I made a simple White Flash -> Dissolve effect with shader graph 2D, it's my 1st time using shaders. I'm controlling the effect using a float inside the shader, with: ...
0
votes
0answers
444 views

In Unity, how can I render borders of provinces from a colored province map in a grand strategy game?

I am kind of a beginner of Unity and I am trying do work on a grand strategy game. I already have a province map, colored by unique rgba for each province, looks like something below: I know that the ...
1
vote
0answers
29 views

Drawing a deferred decal when the camera clips its bounding geometry

I have a building grid effect that I decal onto my terrain using a cube that moves to follow the cursor. You can see if the camera gets too close to the cube, it gets clipped by the camera's near ...
0
votes
1answer
293 views

Unity toggleable shader property misbehaves when set by code?

I've added a toggle to my shader: [Toggle(ENABLE_COLOR_BLEND)] _EnableColorBlend ("Enable Color Blend", Int) = 0 In the Subshader: ...
0
votes
0answers
697 views

Need to generate seamless gradient noise texture for water Shader [duplicate]

I need to generate something like this for my water Shader, because on fly calculations are to expensive for mobile (https://docs.unity3d.com/Packages/com.unity.shadergraph@6.9/manual/Gradient-Noise-...
0
votes
0answers
34 views

Per-object screen space uv issue

I am currently trying to sample a texture in screen space. This works well : ...
3
votes
0answers
51 views

Help in understanding atmospheric scattering shading

I have a made a planet and wanted to make an atmosphere around it. So I was referring to this site: Click to visit site I don't understand this: As with the lookup table proposed in Nishita et al. ...
0
votes
1answer
971 views

How to use multiple UV maps with ShaderLab (Unity)

I want to layer one texture over top of another on the same mesh, but map the textures to different UV maps. The example for Detail Maps in the Surface Shader Examples looks almost identical to what ...
0
votes
1answer
204 views

Trying to use an overlapping shader for 2D sprites but sprite wont show its shape

So Im trying to use this shader I had from a while ago to implement shadows in a 2D top down game. In order to show clouds on top of the game. At the moment, Sprites dont overlap which is good, but ...
1
vote
1answer
158 views

Differences between Unity/UE shaders and Opengl Shaders

At first, I thought that they are the same, shaders in game editor write by programmers(or use some graph flow tools nowadays) just get compiled into opengl shaders. But now I'm writing my own render ...
4
votes
1answer
4k views

How can I achieve simulated fluid surface deformation in a bottle?

I'd like to mimic this effect seen in Half Life: Alyx: I can't figure out what is going on here, people say "it is just a shader effect it isn't simulating anything", but I don't think that is true ...
1
vote
0answers
165 views

Unity Shader-Graph randomly tiled sprite

Lets say I have a shader with a clean white tile. Then I use it on a wall and tile it a few times. I also have a sprite with numbers. Now, is it possible and if yes how. To put a random sprite ...
0
votes
0answers
40 views

How to create fog effect over specific tiles in dungeon game

I'm working on a game in unity and I have areas the player cannot enter blocked off by game objects that are animated sprites that are supposed to look like fog. They don't look that great and I'd ...
0
votes
0answers
535 views

How to rotate a skybox cubemap using Unity Shadergraph

@Seyed Morteza Kamali solved his own problem of rotating a mesh cubemap with shadergraph here: How can I rotate cubemap in shadergraph? However, I have a starry night cubemap inside my Skybox shader ...
0
votes
0answers
115 views

Setting up a shader for RTS construction grid visibility (around cursor)

I've set up a shader, thanks to the good help of @DMGregory over at : Draw animating grid with terrain deformation and variable colors here's what I got so far : here's what it's supposed to look ...
1
vote
1answer
344 views

URP cant get Pixel Perfect Camera to work

I am currently using URP to add bloom to my particlesystems. The problem im facing is that I cant pixelate the game. I have tried to implement several methods to post pixelate (via shaders and render ...
0
votes
2answers
649 views

How can I rotate cubemap in shadergraph?

I know how to rotate cube map with legacy surface shader Shader Rotation Matrix: ...
0
votes
1answer
109 views

How to position/transform vertices for 2D UI in shaders?

I am building a 3D engine and have a rendering abstraction that focuses on writing shaders. Most my 3D shaders have gl_Position output like: ...
0
votes
1answer
25 views

Unity shader to pick 1 of 2 base colors for individual instances (picture)

I am building this scene in 3D using Unity 2019.3.13's Universal Render Pipeline. I have a block prefab that I want to instance, but I want to choose which are yellow and which are blue (you can see ...
0
votes
1answer
136 views

OpenGL color attachments don't work

Trying to implement GBuffer. Only gAlbedoSpec color attachment (GL_COLOR_ATTACHMENT2) works properly. When i try to use another texture (gPosition or gNormal) in ...
1
vote
0answers
104 views

How do we export blender material with shaders and blender texture to unity?

I've blender model, it has noise texture and glossy shaders, when I import it to unity, they are not the same. I tried both cycle and Eevee render and was looking for different ways to export the fbx ...
0
votes
1answer
221 views

DirectX11 how to use textures and samplers in slots in shaders

I have a system to render many objects, but I don’t know how to render more tan one object with same shader, let me explain: I have a sphere and a cylinder, but both objects can be rendered by ...
4
votes
1answer
1k views

Infinite world floor grid shader

I am trying to render an infinite world floor grid, similar to this question. My project is using SceneKit with Metal Shading Language but the concepts are no doubt similar between GLSL/HLSL. Here is ...
1
vote
0answers
153 views

In HLSL script, why does random function produce negative values?

I'm currently learning shader scripting with Unity HLSL language and this awesome resource: https://thebookofshaders.com I created my random method and a zeroOrOne method which just return 0 or 1 ...
1
vote
0answers
73 views

Custom shader with stencil breaks Unity built-in masking

my custom shader works like a charm for what I wanted it, but if it is referenced in the scene, Unity built-in masking stops working (both the Sprite Mask component and the rect-based Mask stop ...
0
votes
0answers
35 views

Punching holes through a texture and making them regenerate back again in an efficient way

I'm working on a prototype where the user can use the mouse to punch holes through a texture, making this texture see-through in that area for a certain amount of time. After that time, the hole will "...
0
votes
0answers
27 views

Forward rendering and separation of shaders logic

I'm currently playing with writing a rendering engine and implementing a forward rendering pipeline. I have few doubts on how things should be implemented regarding the render passes as-well as the ...
1
vote
0answers
43 views

Can't get world position from reverse Z buffer

I'm using this solution to render using a reversed Z buffer. This looks fine and completely fixes all my z-fighting, but it breaks what I use in shader to derive the world position from the depth for ...
0
votes
0answers
134 views

Fragment shader for lighting in isometric perspective

What I'm trying to do is to achieve basic lighting in 2D from an isometric perspective. Here I have 2 textures that are used as tiles for the ground: Color: Normal map: I have a fragment ...
0
votes
0answers
67 views

In Godot 3.2.1 stable beta, in the 2D sprite shaders, how do I import a new PNG to test out those shaders?

I am using Godot 3.2.1. on Steam on Linux Mint. How do I take a pixel art image I've made and import it for using in Godot? I couldn't find it under Project.
0
votes
0answers
92 views

How can I apply a fullscreen shader on a specific layer?

How do I apply a full screen shader on one layer of objects using LWRP/URP and shader graph? I want to pixelate only my particlesystems, but nothing else. I want the effect of pixelcamera, but only on ...
0
votes
0answers
221 views

Discarding GLSL fragment values not working with stencil buffer

I am trying to make a system where I can outline sprites, but I can only get it to work correctly when I use a regular-shaped texture. Here is what an outlined regular texture looks like: However, ...

1 2 3
4
5
36