Questions tagged [fragment-shader]
A program that runs on the GPU to determine output colors for pixels. Also known as a fragment shader.
326 questions
0
votes
1
answer
112
views
What is the proper way to write a pixel shader that only outputs depth?
I have an effect that I want to only write to depth.
commandList->OMSetRenderTargets(0, nullptr, FALSE, &m_mainDepthStencilDescriptorHandle.getCpuHandle());
...
1
vote
0
answers
91
views
Creating 3d Cloud within the box using Metal shader
I tried to create a cloud filled in the box geometry, I tried using raymarching with noise texture as well direct noise function and fbm - fbm motions is good. but cloud is not get proper result like ...
2
votes
1
answer
205
views
Hide Horizon Line with Small Terrain?
I'm drawing a sky plane with an atmosphere fragment shader in front of my terrain. It looks pretty much fine at sea level, but if you move above the sea level, the illusion is quickly broken, as you ...
0
votes
1
answer
210
views
GLSL ported shader not working in HLSL
I have been working on an Infinity Grid shader for my engine.
It was already implemented to Vulkan’s GLSL, so it worked great with OpenGL’s (4.6) GLSL.
Here's a reference.
This basic shader with ...
1
vote
1
answer
542
views
Unity shader to give thickness to flat plane
I have this hexagonal grate floor:
Which is a flat plane with the following shader:
The hex lattice created using the method by Andrew Hung. Albedo and metallic/smoothness shader are just simple ...
5
votes
2
answers
733
views
How would I mask the player node out of a canvas shader?
I'm making a 3D game, and I want to create a post processing effect using a canvasitem and a colorrect, that effects everything on screen apart from the player. I already have the shader itself made, ...
0
votes
1
answer
515
views
How to apply sampler2Darray textures to different locations of a single mesh?
In openGL, I have a 3D terrain composed of a grid of 255x255 vertices. The vertex of the lower left corner is at coordinates (-127;-127) and the one of the upper right corner is at coordinates (127;...
1
vote
0
answers
454
views
Expected a smoothly fading opacity in this Raylib shader, but instead it is chunky
In my main file, I create a regular icosahedron and assign the below shaders to it using the Raylib framework in C++17. I intended for the vertex shader to assign a 1.0 alpha value to points at Z=-5....
0
votes
1
answer
83
views
How do I distort a 2D texture based on the movement of a point that starts at the center?
So there's this point that starts in the center. If the user drags it up towards the top of the texture, the top squishes and the bottom stretches. If the user drags it down, the top stretches on the ...
1
vote
0
answers
377
views
Is there an alternative method do do per-texel lighting in 3D without stream compaction?
Note: I'm not asking for an x% faster method. Work efficiency is an objective measure, it doesn't change because of hardware.
I've got a voxel world I'm trying to render, think Minecraft, same texture ...
0
votes
1
answer
381
views
Is it possible to draw billboards from point data held in a compute buffer?
I'm currently trying to show a galaxy and have developed a compute shader that places/moves "stars".
Another vertex/fragment shader reads the buffer and currently places a point at each ...
13
votes
1
answer
4k
views
How to do color post processing in WebGL, when you can not read the color of the current pixel?
In a WebGL 2 GLSL fragment shader, one can not access the pre-existing color value of the current pixel, i.e. the color that is already there in the framebuffer before the pixel that is currently ...
0
votes
0
answers
184
views
Draw a plane in fragment shader using determinant?
I'd like to use the determinant of a matrix to draw a plane in the fragment shader. But I don't understand how to come up with the matrix.
Let's say that I have 3 points that lie on the plane: A, B, ...
1
vote
2
answers
895
views
Custom directional shadow map from sun
Due to some material features, I need to create my own directional shadow map.
Everything seems to work ok, until the moment where I compare depths.
First I add a camera component to the directional ...
1
vote
0
answers
900
views
1Bit Bayer Ordered Dithering Shader
I’m having a problem trying to fix my 1bit ordered dithering shader.
This shader is going to be perfect to be used but there is some detail that I would like to fix.
First of all, this shader is not ...
1
vote
0
answers
716
views
Cursor trail with fragment shader
I wish to draw a simple mouse trail using fragment shaders, similar in appearance to drawing the following in processing (omitting the step of clearing the canvas). I cannot wrap my head around the ...
0
votes
0
answers
323
views
OpenGL I want my image to change color based on stencil
I have an image and a rectangle on the screen, using the using this stencil functions I managed to render or not render a certain part of my image.
...
0
votes
1
answer
711
views
Shade a box different colors for two ends with one material in Three.js
First, I knew the following basic knowledges,
GLSL Language, Learn WebGL2 - GLSL
* GLSL Shaders
OpenGL - Coordinate Systems, [OpenGL - Advanced GLSL]
3D Game Shaders For Beginners - GLSL
...
1
vote
0
answers
361
views
Why is this GL_TRIANGLE fan texturing incorrectly?
I am constructing some terrain for a 3D game (in C) as a 2D grid of tiles, the corners of which have height into the 3rd dimension. In the middle of each tile is another vertex, the height of which is ...
-1
votes
1
answer
350
views
Shaders overriding other shaders
Recently, I've been making a 3D game and I have been having trouble with making multiple shaders. I've researched this for a bit, and told that I had to use ...
-1
votes
1
answer
232
views
Post Processing without using FBOs?
Recently, I've been making a 3D game (hint my questions), and I recently have modified a pixelization shader from a unity shader graph tutorial. The thing is, I want to render the shader on the WHOLE ...
1
vote
0
answers
1k
views
OpenGL Compute Shader vs Fragment Shader device support
I have a game with massively parallelizable logic, which I intend to write calculate on the GPU (Java/LibGDX).
I am planning to implement a logic for it through a fragment shader, instead of a compute ...
1
vote
2
answers
1k
views
How to colour blend between two materials? [closed]
I've been trying to get a material (with an image texture) to animate towards a colour mix with transparency, but either I'm attempting something the wrong way, or unable to find the right keyword to ...
1
vote
1
answer
557
views
Why does my stencil buffer allow pixels through?
I'm rendering a scene using OpenGL. The scene consists of a grassy environment and a small lake (visible as two surfaces). To achieve water surface transparency, I'm using a stencil buffer to render ...
1
vote
1
answer
4k
views
mapping texture uvs to sphere for skybox
I've been trying to learn shader coding, specifically procedural skyboxes. I've been using this guide here which is a shader graph tutorial and try to write out the steps in code. However, I'm stuck ...