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

Casting a shadow over a whole scene with GLSL in 2D?

I'm making a (non-isometric) side scrolling 2D game and I want each fragment that I draw to cast a small drop shadow when it is near another object. What sort of algorithms are used in fragment ...
jmasterx's user avatar
  • 2,099
6 votes
1 answer
707 views

Animating compression wave shader which uses image for displacement map

I've been testing a variety of shockwave or ripple effect shaders, and spent time on this cleaned up and improved version on shadertoy. I'm not entirely satisfied with that because it produces an ...
BotskoNet's user avatar
  • 919
6 votes
1 answer
222 views

In a shader, why does substituting a variable with the expression producing it cause different behaviour?

I have this correctly-working OpenGL shader producing Perlin noise: ...
hungry91's user avatar
6 votes
1 answer
5k views

gl_PointCoord always zero

I am trying to draw point sprites in OpenGL with a shader but gl_PointCoord is always zero. Here is my code Setup: ...
Jonathan's user avatar
  • 783
6 votes
1 answer
3k views

Atmospheric Scattering

I'm trying to implement atmospheric scattering based on Sean O`Neil algorithm that was published in GPU Gems 2. But I have some trouble getting the shader to work. I've downloaded sample code of O`...
user avatar
6 votes
0 answers
183 views

How many Pipelines in a Typical Rendered Scene DirectX12

I'm learning DirectX12 right now and I'm missing a few pieces of the puzzle in my own head on the overall structure of how you would setup a game. Specifically, I'm trying to get an idea of how ...
FAtBalloon's user avatar
6 votes
2 answers
1k views

Axis Aligned Bilboards in shader

Hi I need to implement following effect using vertex shaders. Basically its a shader for particle laser beam that rotates to particle along its own y axis till its "best" visible (Roughly). My idea ...
Xyz's user avatar
  • 161
6 votes
3 answers
10k views

How to place grass on custom terrain mesh

I made a custom terrain mesh and textured it, now I want to place grass on it, but I don't know how. I only find info about grass with the unity terrain. I am not even sure what exactly to look for. ...
ElDuderino's user avatar
6 votes
2 answers
2k views

Does Unity's "Transparent Bumped Specular" translate to "semi-shiny must be semi-transparent"?

Unity's documentation for the "Transparent Bumped Specular" shader/material-type is simply a concatenation of each of the descriptions for its Transparent and Specular Shaders (and also Bumped, but ...
Shivan Dragon's user avatar
6 votes
2 answers
8k views

Unity - Water Cube (to 2D game)

I wonder if you can create a cube of water within the unity! I'm starting to use the Unity, and took a sought as to whether there was already something like this ... but have not found any tutorial ...
Igor's user avatar
  • 219
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
21k views

How do I pass vertex and color positions to OpenGL shaders?

I've been trying to get this to work for the past two days, telling myself I wouldn't ask for help. I think you can see where that got me... I thought I'd try my hand at a little OpenGL, because ...
smoth190's user avatar
  • 916
5 votes
2 answers
1k views

Different number of lights => different shader

I have a shader that computes lighting for each light. ...
Olhovsky's user avatar
  • 3,519
5 votes
4 answers
10k views

Shader / Reconstructing position from DEPTH in VR through Projection Matrix

In Unity you can access the Depth-Buffer in the Pixel Shader. With that Depth-Buffer and the Nearplane, Farplane, CamToWorldMatrix and FOV you can calculate every pixel position of the objects the ...
OC_RaizW's user avatar
  • 1,450
5 votes
4 answers
5k views

Multiplatform GLSL shader validator?

Im working on a multiplatform (Pc,Mac,Linux) game that uses shaders quite extensively. Since we do not have any funding, it is pretty hard to test our game on all possible hardware configurations. ...
Pjotterke's user avatar
  • 348
5 votes
1 answer
1k views

Invert the colour of pixels where 1 bit sprites are overlapping

I have a simple scene in Unity that makes use of some simple art that uses either white or transparent colours to create a 1-bit art design. The image below shows this. I want to have a that if two ...
Josh Hales's user avatar
5 votes
1 answer
5k 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 ...
Krupip's user avatar
  • 1,763
5 votes
2 answers
11k 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
  • 245
5 votes
1 answer
7k views

Will Vulkan Kill the use of GLSL? [closed]

After reading this link I am still unclear as to the shading language support in Vulkan. As Vulkan only supports SPIR-V is it the case that GLSL is therefore being phased out? Are there any ...
Startec's user avatar
  • 177
5 votes
1 answer
2k views

What is the point of this hard-coded vector when calculating luminance in glow/bloom effects?

I have looked at two different vertex shaders that calculate luminance and both use a "magic" vector that I'm not sure the meaning of the the actual values. For instance: ...
Joey Green's user avatar
  • 2,509
5 votes
1 answer
1k views

How is this glowing with colors radiating outward 2D effect accomplished?

I'm currently totally at a loss as to how this effect is done: http://www.youtube.com/watch?v=zp8MHUNp7Cg The glowing on the ship and the changing color. I want to do this effect in XNA 4.0 any ...
Pruit's user avatar
  • 103
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
5 votes
1 answer
2k views

How can I determine the extreme color values in a texture?

I am looking for a way to determine the most extreme color values for all of the texels in a texture. So for a texture consisting only of black and white texels, the extreme values should be (0,0,0) ...
mhjlam's user avatar
  • 53
5 votes
1 answer
863 views

Where to store shaders

I have an OpenGL renderer which has a Scene member variable. The Scene object can contain N SceneObjects. I use these SceneObjects for storing the vertex position and any transforms. My question is, ...
Mark Ingram's user avatar
5 votes
1 answer
4k views

How do I pixelate a scene with SceneKit and Metal, in Swift?

I managed to get pixelation working by using the OpenGLES2 rendering API, and a CIFilter. But it was way too slow, so I want to use the Metal API and just have a very simple filter that pixelates ...
ndbroadbent's user avatar
5 votes
1 answer
2k views

Component-wise GLSL vector branching

I'm aware that it usually is a BAD idea to operate separately on GLSL vec's components separately. For example: ...
Gustavo Maciel's user avatar
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
1 answer
968 views

Calculated normals for mesh not working

I am trying to implement a 3D mesh viewer with C++ and OpenGL ES 2. I am currently struggling with the calculation of the normals for the vertices, or at least I think that is where the problem lies......
Gerharddc's user avatar
  • 392
5 votes
1 answer
3k views

Is it possible to calculate the TBN matrix in the fragment shader?

Just from model position, model normal and texture uv?
Viktor Sehr's user avatar
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
5 votes
1 answer
2k views

HLSL Circle all white

I have been trying to get my shader code (HLSL) to draw a simple circle but after a day and a half I am getting nowhere. It seems people are using $$x^2 + y^2 = r^2$$ and remap texcoords but I only ...
Michael's user avatar
  • 53
5 votes
2 answers
2k views

Which are the most futureproof languages for graphics (shader) programming? [closed]

I have written some GLSL and Cg shaders a couple years back. I am starting another graphics engine project and I want to choose my technologies carefully so that my code will be accessible years down ...
Steven Lu's user avatar
  • 740
5 votes
3 answers
1k views

Vertex Shader Fundamental Workings

I understand that water ripples (e.g. stone thrown into a pond) are often handled with vertex shaders. My first question is: are the ripples nothing more than an algorithm that is the function of ...
Mystagogue's user avatar
5 votes
1 answer
3k views

Issue with interpolation on a burn shader (lerp and smoothstep)

I'm trying to create a simple burn shader. See here for more info on the method I'm using. However, I don't get why replacing the smoothstep with a lerp results in completely different results. Am I ...
PeeC's user avatar
  • 439
5 votes
1 answer
2k views

Is the series of books "GPU Gems" still good for a modern OpenGL 3.0+ approach?

I noticed that this series of free books from Nvidia is really popular and well know in the devs world, the problem is that is simply old; you would recommend to read those 3 books to a developer that ...
user827992's user avatar
  • 1,991
5 votes
1 answer
7k views

How to get the texture coordinate of a neighbouring pixel for a blur shader?

I'm still having some trouble to get my head around fragment shaders and doing some image processing on textures. The context is a 2D sprite: a simple texture painted on a quad. All done with OpenGL ...
Nick Weaver's user avatar
5 votes
1 answer
6k views

unity 5 how to get a shadowmap

I'm writing a custom shader in unity 5 that requires a shadowmap (not just for drawing shadows but also for different computations involving scattering particles through fog). Does anybody know how to ...
Thijser's user avatar
  • 965
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
1 answer
697 views

How can I let players "scrape away" one texture to reveal another?

In this game I'm making, I want my players to be able to remove rust from an object based on collisions from another object such as a wire brush. Since it's a VR game, performance is key. I've ...
Jason's user avatar
  • 55
5 votes
1 answer
707 views

Simple square vertex lifting shader

I am trying to rebuild the fur effect in Viva Pinata. Here each square becomes a pattern of fur I imagine the process to be like this... U lift one end of the triangles. Now I need to achieve "...
Blue Bug's user avatar
  • 1,112
5 votes
2 answers
553 views

Should I use different input layout for meshes (vertices) with and without normal maps?

I'm writing an DirectX11 game. About 60% of my game models (or "of my vertices") have: Position Texture coordinate Some of them use: Position Texture coordinate Normals And few of them: Position ...
PolGraphic's user avatar
5 votes
1 answer
3k views

Shadow mapping does not work correctly using GLSL shaders

I'm a beginner in shadow mapping. I have in my scene two meshes : a cube and a floor. The scene is lighted by a single point light. Here's for the following display the light properties : ...
user1364743's user avatar
5 votes
1 answer
2k views

Spherical fractal noise generator in shader

I have a growing sphere in space, and I thought of having a procedural generated texture over it. Since it is growing, I thought a fractal would be a great choice, because more details would be ...
lvella's user avatar
  • 153
5 votes
4 answers
2k views

Enconding/Decoding bit value in Texture Alpha Channel

I am Rendering to a SurfaceFormat.Color. (R8G8B8A8) The alpha of this format has 8 bits and I want to be able to use those 8 bits as a bit field. For example, in one pass of my render, I want to save ...
tpastor's user avatar
  • 53
5 votes
1 answer
334 views

Explode image into component pixels shader

I'm currently stuck on trying to write a shader for Godot 4.x. and get it to look right. I'd like to take an image, pixelate a bit so that particles are a bit chunky, and then explode it into ...
Ghoul Fool's user avatar
5 votes
1 answer
3k views

How do I create a jet engine exhaust effect with a shader?

How would I create a jet engine exhaust effect, as shown in the image from Fzero GX below. GLSL and OpenGL examples/solutions are prefered, though other resources are also welcome. Requirements The ...
Morgan Bengtsson's user avatar
5 votes
1 answer
2k views

How to create heat haze effect in Libgdx?

I would like to create a heat haze effect for a 2D game I am making. Do You have ideas or suggestions, how to get that effect. I am using Libgdx(OpenGL 2.0). Thank You in advance!
user1506630's user avatar
5 votes
2 answers
757 views

Refractive blur in XNA?

I'm writing a 2D hack-and-slash game using XNA. I really want to implement the blur-like, refractive effect of a sword or such moving really quickly, seen in such games as Dust: An Elysian Tail and ...
user979329's user avatar
5 votes
2 answers
1k views

Why does my point light shader shows a strange behaviour, and how do I fix it?

I follow the well known tutorial about lighting and model importing using Learn opengl, i copy paste the code from the site. The author claims that the shader works but when i compile the source code, ...
Irrmich's user avatar
  • 84
5 votes
1 answer
1k views

Spritebatch Vertex shader world matrix change after each draw

I have a spritebatch where I draw some textures transformed in 3d space. The easy way was just Begin with the transformation matrix, draw, and end it right after. But that is silly, so I'm trying ...
Roger Martins's user avatar

1
3 4
5
6 7
40