Skip to main content

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
4 votes
2 answers
6k views

Can I clip a collection of geometry to render only inside a particular worldspace volume?

I am making a VR app in Unity. I have a giant map that I want to display on a virtual table. The map is too large to fit on the table, and I cannot change its size. (It is a third party asset, and ...
Evorlor's user avatar
  • 5,832
56 votes
7 answers
81k views

How can I draw outlines around 3D models?

How can I draw outlines around 3D models? I'm referring to something like the effects in a recent Pokemon game, which appear to have a single-pixel outline around them:
mystic portal's user avatar
6 votes
2 answers
12k views

An efficient way for generating smooth circle

I'm looking for creating smooth circle. OpenGL supports point, line, and triangle. To create other primitives like circle, we utilize the preceding shapes. In my case, I've utilized points as follows: ...
CroCo's user avatar
  • 255
5 votes
2 answers
10k views

2d metaballs with shader to give blobs of water effect?

I want to simulate blobs of water in a 2d game in Unity3d. One possible way of doing it is to use 3d metaballs moving in a 2d plane though this is very processor intensive. Do you think it would be ...
Guye Incognito's user avatar
1 vote
1 answer
13k views

UV World mapping in shader with Unity.

Please refer to this Answer. DMGregory script is working for me, although I have a problem I can't fix because I don't talk shader :) The tiling will be applied correctly on geometry aligned on XY ...
Chiodo's user avatar
  • 13
1 vote
3 answers
2k views

How do you have the clothing mesh hide the body mesh underneath?

How do you have the clothing mesh hide the body mesh underneath, to prevent odd patches of body from sticking out in tighter modular clothing? Is there some sort of shader trick that can have the ...
ina's user avatar
  • 294
56 votes
1 answer
41k views

How do Raymarch shaders work?

I have been looking at shaders found here shadertoy.com and most of the cool ones have noise and raymarch in common. I do not understand the source code at all but I really want to. How do these ...
jmasterx's user avatar
  • 2,099
0 votes
1 answer
2k views

Normal Matrix in plain English

I'm into shader language with Webgl and GLSL. I've seen some tutorial about normal matrix and I don't really understand it. I mean, I think I'm ok with the math such as: ...
nkint's user avatar
  • 961
111 votes
2 answers
41k views

How can I create a "see behind walls" effect?

Divinity: Original Sin 2 has a beautiful see-through system. When I go behind walls, a splash mask will appear, and when I move around the game, it changes. It's like a dissolve shader, and has a ...
Seyed Morteza Kamali's user avatar
18 votes
1 answer
48k views

How do I create a cel-shaded cartoon look?

I am interested in everything related to this kind of effect (modeling, game engine, animation). What sort of stuff is needed? Here are some sample images of what I mean:
Csabi's user avatar
  • 335
17 votes
4 answers
16k views

How can I acheive a smooth 2D lighting effect?

I'm making a 2D tile based game in XNA. Currently my lightning looks like this. How can I get it to look like this? Instead of each block having its own tint, it has a smooth overlay. I'm assuming ...
Cyral's user avatar
  • 1,039
16 votes
7 answers
4k views

How to make unit selection circles merge?

I would like to know how to make this effect of merged circle selection. Here are images to illustrate: Basically I'm looking for this effect: How the merge effect of the circles can be achieved ? I ...
MaT's user avatar
  • 1,055
1 vote
1 answer
15k views

How can I change the color of an object at runtime?

I wish to have the shader effect as in the game 'The stack' by ketchapp https://play.google.com/store/apps/details?id=com.ketchapp.stack&hl=en As you can see, the color of the objects as well as ...
Bhoopalan Thaati's user avatar
43 votes
1 answer
10k views

How can I reduce aliasing in my outline glow effect?

I'm trying to replicate the glowing outline effect in the Left 4 Dead game. The effect causes an objects outline to glow, even when the object is occluded. Here is a screenshot of the effect: I'm ...
flashk's user avatar
  • 533
39 votes
4 answers
9k views

What is a fragment in 3D graphics programming?

What is a fragment in a fragment shader? Wikipedia says that: In general, a fragment can be thought of as the data needed to shade the pixel, plus the data needed to test whether the fragment ...
Albus Dumbledore's user avatar
26 votes
3 answers
30k views

outline object effect

How can I achieve an outline effect similar to the ones found in League of Legends or Diablo III? Is it done using a shader? How? I would prefer answers that are not tied up to any particular engine ...
João Portela's user avatar
23 votes
2 answers
16k views

Do I lose/gain performance for discarding pixels even if I don't use depth testing?

When I first searched for discard instruction, I've found experts saying using discard will result in performance drain. They said discarding pixels will break GPU's ability to use zBuffer properly ...
Ali1S232's user avatar
  • 8,677
4 votes
1 answer
3k views

Alpha Blending: use the pixel with the smallest alpha

I'm writing a transparency shader where I need any intersecting textures to, wherever they overlap, take the texture pixel with the smallest alpha value and render only that, discarding the other ...
Essential's user avatar
  • 173
3 votes
1 answer
2k views

How can I map a texture around a sphere without a seam?

I am attempting to wrap a texture around a sphere without any warping using Unity's Shader Graph. I have been following this StackExchange answer, and have semi-successfully converted their shader ...
Harper Rhett's user avatar
2 votes
1 answer
3k views

2D metaball liquid effect - how to feed output of one rendering pass as input to another shader

I'm attempting to make a shader for unity3d web project. I want to implement something like in the great answer by DMGregory in this question. in order to achieve a final look something like this.. ...
Guye Incognito's user avatar
2 votes
2 answers
3k views

Texturing different block types on an optimized voxel mesh

I have a cubic world (like Minecraft) where I'm generating chunks. In those chunks, only visible vertices and faces are generated. Currently, it means that if I have a 2x2x1 chunk, it will generate 8 ...
Kamigaku's user avatar
  • 167
0 votes
1 answer
2k 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: ...
Tudvari's user avatar
  • 771
0 votes
1 answer
3k 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 ...
JSparks's user avatar
  • 199
30 votes
12 answers
33k views

What are some good resources for learning HLSL? [closed]

The last time I tried learning HLSL, I made a few shaders and mostly understood what I was doing, but I still felt like I was stumbling in the dark. Most of what I learned I got from various blog ...
27 votes
3 answers
18k views

For voxel rendering, what is more efficient: pre-made VBO or a geometry shader?

Given a fairly static voxel array, what is more efficient: using the CPU to pre-generate a VBO to render the voxel faces (ignoring more advanced forms of rendering like marching cubes for now) or ...
Bjorn Wesen's user avatar
18 votes
1 answer
6k views

GLSL, all in one or many shader programs?

I am doing some 3D demos using OpenGL and I noticed that GLSL is somewhat "limited" (or is it just me?). Anyway I have many different types of materials. Some materials have ambient and diffuse color, ...
stjepano's user avatar
  • 293
18 votes
1 answer
8k views

Game Engine Design – Ubershader - Shader management design [closed]

I want to implement a flexible Ubershader system, with deferred shading. My current idea is to create shaders out of modules, which deal with certain features, such as FlatTexture, BumpTexture, ...
Michael Staud's user avatar
18 votes
1 answer
4k views

How can I fade player character when he goes inside or outside of the area?

I want to fade the player when he goes out of the area. For example, suppose a person enters a building. When a person is outside of the building, he shouldn't be seen, but when he enters he ...
Seyed Morteza Kamali's user avatar
16 votes
1 answer
3k views

The practical cost of swapping effects

I use XNA for my projects and on those forums I sometimes see references to the fact that swapping an effect for a mesh has a relatively high cost, which surprises me as I thought to swap an effect ...
sebf's user avatar
  • 2,664
13 votes
3 answers
9k 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 ...
Seyed Morteza Kamali's user avatar
12 votes
2 answers
16k views

How can I create an efficient bloom shader with GLSL?

I have searched the net for resources related to rendering a bloom effect using GLSL, but haven't found anything. Although the tutorial at Philip Rideout's website is a good one, it performs very ...
snape's user avatar
  • 709
12 votes
2 answers
6k views

Rorschach ink blot (aka Psychology test pictures) shader

(source: bonnefil.com) I want this magnificent pattern to be in my game. So far I have figured out... Draw one side, then render it twice left and right. How do I render this pattern on one side? ...
Blue Bug's user avatar
  • 1,112
10 votes
1 answer
4k views

Engine Rendering pipeline : Making shaders generic

I am trying to make a 2D game engine using OpenGL ES 2.0 (iOS for now). I've written Application layer in Objective C and a separate self contained RendererGLES20 in C++. No GL specific call is made ...
fakhir's user avatar
  • 409
5 votes
3 answers
7k views

How can I make a shader effect that looks like a lightly shaded pencil drawing?

I want to make a shader effect using OpenGL ES 2.0 that looks like this image: I'm not sure if this image was painted or is the result of some filter, but I want to create a shader that produces ...
Voda Ion's user avatar
  • 177
5 votes
1 answer
7k views

Antialiasing shader grid lines

I would like to have in-game grid lines similar to ones found in Unity editor. There is simple solution(first listing) based on shaders found on unity forums(on right image). However, that solution ...
wondra's user avatar
  • 4,930
5 votes
4 answers
6k views

How to render grid properly, especially over distance?

I'm drawing a grid, pretty much like one can see in the Unity editor itself or any 3D-editor, many 3D-related applications and some games. But it doesn't look pretty in my case. I put a few random ...
Maxim Kamalov's user avatar
5 votes
2 answers
3k views

Seamless 2D wrap-around effect

I am trying to show multiple images on a grid system which are randomly generated and the grid is moving from right to left. What my client wants is when a part of a picture goes off the left edge of ...
Saad Anees's user avatar
4 votes
1 answer
754 views

What technique should I use in a shader to give this reflective effect?

I'm working on a top-down 2D strategy game written in Java with LibGDX (though really for the purposes of this question I'll be using GLSL). I want to give metallic materials in the game a shiny ...
Ross Taylor-Turner's user avatar
4 votes
1 answer
1k views

GLSL 2D Silhouette

I'm trying to render a silhouette of any entity behind foreground objects to indicate their position to the player. Here's an example of what I want to achieve, from Hyper Light Drifter: From what I'...
driima's user avatar
  • 995
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 ...
Seyed Morteza Kamali's user avatar
3 votes
1 answer
707 views

Cutout fragment shader pixels arent square

It has been solved, link to the final shader: Shader The problem (as portrayed by the image below) is that the pixels seem to be, for lack of a better word, cut off. I wish to either display a pixel, ...
Dennis's user avatar
  • 411
3 votes
1 answer
2k views

Multiple pixel shader passes

I currently have a pixel shader that calculates the texture and I have another that calculates the light. I want another shader that does both. What I would ideally like to do is instead of creating a ...
Caesar's user avatar
  • 461
2 votes
1 answer
10k views

Why does this transparent shader cause objects' z-sorting to be backwards?

I am making a Klondike Solitaire game, with the intent of later expanding it to encompass other solitaire games and allow deck customization. As part of this, the playing card meshes I am creating ...
Toomai's user avatar
  • 206
2 votes
1 answer
2k views

2d game view camera zoom, rotation & offset using 'Filter' / 'Shader' processing?

I wish to add the ability to zoom-in, zoom-out, rotate and move the view in a top-down view over a collection of points and lines in a large 2d map. I split the map into a grid so I only need to ...
AturSams's user avatar
  • 10.5k
2 votes
1 answer
7k views

Terrain shader from heightmap opengl GLSL

I generated a terrain from a heightmap and now I'd like to apply shader on it which can contain different textures, based on height but I can't adapt any online code to my project. This is the ...
ScazzoMatto's user avatar
1 vote
1 answer
1k views

How can I color in only specific regions of my scene?

I am interested in having large portions of my game be grayscale, but I'd like certain parts of the scene to have full color. Something like this: Is this something that is possible with shaders or ...
Raven Dreamer's user avatar
1 vote
1 answer
2k 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=...
Alpha Mistral's user avatar
1 vote
1 answer
877 views

Problem when animating MD5 model (GPU Skinning)

I'm trying to implement a GPU skinning version of the md5mesh.js by @tojiro (demo with CPU skinning) in WebGL (live demo of the project here, use WASD to move the camera around). The main concept is ...
mikidelux's user avatar
  • 304
1 vote
1 answer
1k views

Unity: cg fragment shader processing array of points

I need to write a fragment shader which would somehow be aware of N points that are in the scene and darken pixels based on their world coord distance to the points. I'm looking for a method that ...
mt_'s user avatar
  • 576
0 votes
1 answer
1k views

How to apply Image effect only on specific part of objects?

I need a way to censore part of characters' bodies like Cyberpunk 2077.this is mean I want to apply Image effect only to specific parts of bodies that you can see in the below Image:
Seyed Morteza Kamali's user avatar