A program that runs on the GPU to determine output colors for pixels. Also known as a fragment shader.
1
vote
1answer
23 views
Metaballs created through raycasting in fragment shader - billboards are still recognizable
Good day everyone,
I'm currently programming a fluid simulation through use of metaballs and I have a very specific problem/question.
The steps I use for metaball simulation:
1. Simulate particles' ...
0
votes
0answers
29 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 ...
3
votes
1answer
47 views
How to make far block graphically better?
What calcules can I do to make far objects looking better?
My game
Here's what I see if I go back with the camera in my test-rendering scene:
As you can see the result is not one of the bests: ...
1
vote
0answers
29 views
Unity - soft blur effect for dark void edges
I'm a former Flash dev working in Unity (or in 3D for that matter) for the first time.
For the game I'm working on, I've designed an interior room like so:
To represent void/space outside the bounds ...
1
vote
0answers
78 views
GLSL - skewed parallax occlusion mapping
I'm currently trying to implement Parallax Occlusion Mapping, based off a post on sunandblackcat.com
With my current implementation, I have the following:
i.stack.imgur.com/H0c2s.png
Notice how the ...
0
votes
1answer
47 views
Fragment processing depends on polygon size?
I just set up some simple vertex/fragment shaders for handling lighting instead of using the openGL calls. I have a few terrain VBOs setup that are drawing a million or so triangles for testing (bunch ...
0
votes
1answer
46 views
How to draw connecting lines in plain color? [duplicate]
Since there is no option for flat shading in OpenGL ES2, is there a workaround to disable the color interpolation when different color is being passed to each of the vertices?
Update:
I'm working ...
0
votes
1answer
50 views
OpenGLES texture coordinates in shader
Currently I'm doing an android 2D game using OpenGLES 2.0 and I noticed that my UVs never change in all of textures when rendering, like this in Java code:
public static FloatBuffer vertexUv;
...
0
votes
0answers
35 views
How to render my Texture with alpha instead of making alpha black (Custom shader)
Facebook just released some VR resources , I tried them and they work like intended, you see your Image, which is bent around your head (Helpful for prototyping and stuff...). Now I would like to edit ...
0
votes
1answer
21 views
Fragment shader coordinates: Displacing pixels and texCoord problems
I'm trying to create a shader that creates a displacement on an object, slicing horizontally the sprite.
These is an example of the atlas I'm using and the effect I'm trying to achieve:
I tried to ...
1
vote
1answer
30 views
alpha test shader 'discard' operation not working - GLES2
I wrote this shader to illustare alpha test action in GLES2 (Galaxy S6).
I think is not working at all cause I don't see any change with or without it.
Is there anything Im missing?
Any syntax error?
...
1
vote
1answer
99 views
how to make a fast fragment shader that converts intensity to saturation?
I have a simple fragment shader that looks like this:
#ifdef GL_ES
precision lowp float;
#endif
varying vec4 v_fragmentColor;
varying vec2 v_texCoord;
uniform vec4 u_desiredColor;
uniform sampler2D ...
3
votes
1answer
158 views
Procedural Hatching
I know that it is possible to make a shader that uses procedural hatching instead of pre-designed tonal art maps. But is it possible to make that procedural hatching in the fragment shader? I would ...
0
votes
2answers
37 views
Difference in Shading Using Eye Space or Model Space Coordinates
While reading on shading, I came across a section in which the artist provides 2 different kinds of fragment shading:
Coloring using model space and eye space.
The result is as illustrated in the ...
3
votes
1answer
99 views
Would it perform faster to split calculation between vertex and fragment shaders?
Assuming the total amount of computation would be the same (at least as far as my code goes), would there be any performance increase in splitting the calculation and using separate vertex and ...
0
votes
0answers
44 views
Shadows not rendering on custom shader
In the custom shader I've written I've implemented the 'standard way'. However, it doesn't seem to achieve anything at all.
I'm new to shaders, and quite frankly, the whole thing has been a bit of a ...
0
votes
1answer
121 views
game maker - how to change color palette using shader and texture
how to change the color of the application surface, using the texture??
https://en.wikipedia.org/wiki/List_of_8-bit_computer_hardware_palettes
https://en.wikipedia.org/wiki/List_of_8-...
1
vote
3answers
114 views
How do I calculate NDC coordinates in a fragment shader?
I have some weird problem going on in my openGL shader.
First,, I pass the viewspace position from the vertex shader to the fragment shader like this:
vec4 view_pos = V * M * vec4(world_position.xyz,...
1
vote
0answers
40 views
Game Maker - Shader CGA - how to swap the palette
I created a shader that get the actual color of the surface and render it to the closer of a cga palette
I have to change it to swap the palette in 4 colors but I don't know how
secondary, I have to ...
1
vote
1answer
66 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 BlendOp Max seemed like the tool for ...
1
vote
1answer
27 views
Fragment shader operations before vector transformations
I feel like I'm misunderstanding how to work with vector/fragment shaders. My vector shader is as follows:
uniform mat4 uVMatrix; // view (camera transformations)
uniform mat4 uMMatrix; // ...
1
vote
1answer
109 views
HLSL texture sampler always returns white
I'm facing in problem in HLSL with Monogame that I can't figure out. The gist is that sampling from a texture seems to always return white rather than the texture's actual color. My pixel shader code ...
3
votes
2answers
84 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.
...
0
votes
0answers
83 views
Opengl 4.3 - GLSL Bump mapping problem (Normal mapping)
I'm pretty new to advanced GLSL / OpenGL.
I was able to make a small engine, load an object, render it, etc.
I recently added the Phong-Reflection model for lighting (and it's working well).
I ...
1
vote
1answer
551 views
How do I calculate UV space from world space in the fragment shader?
In my vertex shader I have calculated the world space
o.worldSpacePosition = mul(unity_ObjectToWorld, vertIn.vertex);
How do I convert that world space into uv space coordinates in my fragment ...
1
vote
1answer
49 views
Transform luminosity (Watt) to be usable in shader
I'm studying the color and the Luminosity of Stars.
I'm trying to figure how to transform information of Luminosity i perceive at a given distance to something usable into a shader.
For instance , ...
0
votes
2answers
107 views
GLSL: Issue replacing ternary operator with mix
I was expecting these two code snippets to do the same thing:
return vec3( 1.0-b.r>=a.r ? 0.0 : 1.0-((1.0-b.r)/a.r),
1.0-b.g>=a.g ? 0.0 : 1.0-((1.0-b.g)/a.g),
1....
3
votes
1answer
84 views
Per-Texel lighting? (not per-vertex or per-pixel)
In my game, I have a 3D shader that does lighting using color ramps on models with very low resolution textures. Basically, the vertex shader calculates color values for direct light and ambient ...
3
votes
1answer
87 views
OpenglGL Render two scenes with one draw call
I need to draw a normal-vector scene and default scene.
I could achieve this my having two programs with different fragment shader to produce the following images. It will require me to draw twice.
/...
1
vote
2answers
336 views
How can I use an HLSL pixel shader to peek at other pixels?
I think this is like a pixilation shader but I had a hard time trying to find one online, and one that I could manipulate specifically.
I want to create a pixel shader for my monogame project that ...
0
votes
1answer
295 views
GLSL - Only draw arond point / flashlight effect
I'm currently trying to achieve a sort of flashlight effect in GLSL. I only want to draw textures within a certain distance of a specified point (the mouse position, for example). Here's a quick ...
0
votes
0answers
28 views
How to apply individual colours in a fragment shader?
I'm trying to write my own shader. Within the target mesh I have assigned the following attributes in a script:
mesh.vertices = points;
mesh.colors = colours; //Each element of the array hold a ...
0
votes
0answers
50 views
Fragment Shader Light Sim
In the game Clash Royale, when you have the ability to upgrade a card, the green part has a light sheen to it an this sheen animates from left to right. How can this be done with a shader? I'm quite ...
0
votes
1answer
35 views
Choosing between multiple shaders based on uniform variable
I want to choose from 2 fragment shaders based on the value of an uniform variable.
I want to know how to do that.
I have onSurfaceCreated function which does compile and link to create program1 and ...
0
votes
1answer
67 views
Luminance 'y' value of surface texture
For my opengl video player app, I am using surface texture bound to GL_TEXTURE_EXTERNAL_OES
source : https://github.com/crossle/MediaPlayerSurface/blob/master/src/me/crossle/demo/surfacetexture/...
2
votes
1answer
1k views
Schlick Fresnel Shader
I hope you are all doing ok. I have an issue with my Fresnel shader that doesn't allow the Fresnel to change as my camera moves around. I'm not sure what i'm doing wrong. I'm using glsl with the ...
0
votes
0answers
255 views
vert/frag custom shader - Shadow is not correct, showing strange artifacts
I am new to shader writing, I want to drop shadows in my own shader, but unluckily I am getting a strange behaviour. When I apply a simple surface shader (Lambert, written in unity shader lab) it ...
0
votes
2answers
352 views
How do I draw individual pixels in the distance?
Hello everyone I am working with unity3d and I am faced with a task. I have a list of 3D points and I want to draw a pixel for every point on the list that exists after my cameras frustums far-plane. ...
3
votes
1answer
89 views
Super formula on shader
I'm using Shader-toy to experiment and try to learn a bit the shader science.
As exercise I wan to replicate some of the wikipedia math plots. I've started with a Super Formula.
What I want to ...
0
votes
1answer
201 views
Fragment shader, tint color problem
I am new to shaders, and I am trying to tint a texture to mark status of a enemy.
I am implementing shaders on OpenGL ES 2.0 (Mobile)
The problem is that with this shaders, I see the enemy without ...
0
votes
1answer
38 views
FXAA Parameter Confusion
I have a question about the popular FXAA shaders that are out there written using HLSL or GLSL, and they all mainly feature these three parameters:
#define FXAA_REDUCE_MIN (1.0 / 128.0) //0.0078125
#...
-1
votes
0answers
32 views
Create overlapping transparent images [duplicate]
I want to achieve this effect in the image.
To make this I don't think a single pass to a stencil buffer would be enough because stencil buffers can't mask out the actual alpha inside of the ...
0
votes
0answers
60 views
Shader - Directional Lights Depth
Is there a way to retrieve the deph from directional lights ? I can access the _ShadowMapTexture but this is not the depth.
I found how to access the shadow map of, I think, every light type by using ...
3
votes
1answer
97 views
Libgdx - GLSL shader which uses mod doesn't seem to work properly on android
Through trial and error I've managed to come up with a scanline-ish shader I'm satisfied with. On my desktop testbed it looks like this:
Basically, every 2nd(vertical) pixel is darkened.
However, ...
3
votes
0answers
291 views
Unity - reconstruct position from depth
I am using Unity and I want to reconstruct position from depth and frustum corners in pixel shader.
I am doing this:
In my App, I calculate view-space corners of the far frustum plane and pass them ...
4
votes
1answer
140 views
Getting rid of texture bleeding
Edit: I figured out what problem I was facing, it's called Texture/Pixel bleeding, which I was not aware of yet. I posted an answer below consisting of a small description of the problem and a link to ...
1
vote
3answers
136 views
Is there a way to get what pixel is being processed within the fragment shader?
In OpenGL, a fragment shader goes through each pixel, right? So is it possible (within the shader itself) to get what pixel it is processing and color each specific pixel?
1
vote
1answer
31 views
Is it necessary to use texture filtering if I use texture coordinate system?
I have one question about using texture filtering.
It's clear when I used normalized texuture coordinates (in any API) for example from (0,0) to (1,1) it is necessary to use texture filtering because ...
14
votes
3answers
2k views
How do I write a shader that lights up when objects are near a surface?
In this Overwatch gameplay video, the character's shield lights up white in areas that are near other objects' geometry.
Note the white edges on the blue shield, near the floor, walls and pillar.
I ...
1
vote
1answer
890 views
Pixelation shader explanation?
I was looking for a pixelation shader for my postprocessing and came across this shader snippet - Works pretty well! - Not a whole lot of explanations on how it works except for "Pixelation is process ...