8,231 questions
0
votes
0
answers
28
views
Honeycomb pattern GLSL
I want to make a honeycomb,
now with this code
but I have a problem that when the thickness of the honeycomb line is reduced, they are almost invisible.
line=1
At the same time, everything is fine at ...
Best practices
0
votes
0
replies
24
views
How to display a lot of line_strips efficiently with ModernGL
I need to display many (a lot) 3d trajectories with modernGL.
For now, I chain the trajectories and I create two arrays only (one for all the vertices and one for their colors) that I pass as params ...
0
votes
0
answers
158
views
Very strange errors in OpenGL regarding shaders [closed]
The draw function is returning an error 2182. I am failing to figure why.
Here is my main file:
#include <GL/glew.h>
#include <OpenGL/OpenGL.h>
#include <include/GLFW/glfw3.h>
#...
-1
votes
1
answer
29
views
Applying texture continuously on the side of an object with shader
In threejs, i'm working on a showerbase project using shader. One of my material got visible mineral veins on it and I noticed when it wrap around the border, the veins are not aligned.
I made a ...
0
votes
0
answers
57
views
wrong transformes for model loaded with assimp in opengl
Im trying to apply the model's transforms by walking the node heirarchy, but the poses are wrong (im not trying to animate it, just load it in a pose by using the transforms given in the gtlf file)
...
1
vote
0
answers
101
views
Unable to render sprites in batches / instances using SDL3 GPU API and Odin. SSBO is not available to shader
I am new to graphics in general, so I am trying to learn from others.
After drawing a triangle, a quad and then a sprite on top, I have been trying to get a batch of them on screen using instancing.
...
3
votes
1
answer
142
views
Ursina Engine Shaders MacOS
I have freshly installed ursina in a virtual environment. I am trying to set up a basic scene with some lighting:
from ursina import *
class Pivot(Entity):
def update(self):
self....
3
votes
1
answer
159
views
Square not rendered in OpenGL
I'm trying to program a simple game in java using lwjgl and OpenGL but I'm not able to render a square to the window. Can someone help?
The render function in render class is called evert frame and ...
1
vote
1
answer
67
views
LibGDX Shader comes out stretched, if the Viewport world size is not square
First of all, I'm using this library for post-processing in LibGDX: https://github.com/manuelbua/libgdx-contribs
I added a new custom Effect to it by extending Filter and PostProcessorEffect.
It's a ...
1
vote
2
answers
138
views
GLSL shader not showing anything in scene in THREE.js - why?
I'm trying to make my own shader for a THREE.js project I'm working on, and I wanted to make a GLSL shader as part of it for one of the meshes in my scene. However, despite writing very basic code for ...
-1
votes
2
answers
133
views
Instead of a texture atlas, dump all images in one buffer
In a texture atlas the individual images are arranged geometrically. The texture atlas itself is an image that can be viewed in any image viewer.
I was wondering if it was possible, to simply dump all ...
1
vote
1
answer
47
views
Does GLSL spec permit cases when PS-input mismatched with VS-output?
On my NVIDIA GPU these 2 shaders work fine:
// VS
#version 450
layout(location = 0) in vec4 inPosition;
layout(location = 0) out struct {
vec2 dummy;
uvec4 variableInStruct;
} testStruct;
void ...
2
votes
0
answers
73
views
How to use canvas.drawVertices with custom fragment shaders simultaneously in Flutter Canvas?
I have a requirement to draw a knitting needle effect image.
I implemented a rope texture shading effect using fragment shader code, but there are over 20,000 ropes. I'm using canvas.drawRect(),to ...
1
vote
0
answers
121
views
Why does this Slang code compile to a SPIR-V that skips 3 floats every 4 floats in matrices?
I am trying to learn the Slang shading language for use in a Vulkan framework and I was writing a very basic white only shader.
module white;
struct VertexIn {
float3 position : Position;
};
...
0
votes
0
answers
72
views
Flutter shaders: aurora points blending
I have an application that displays the northern lights on a map.
I receive a lot of points that need to be rendered (2000+ points).
Here’s what the final result should look like:
Since this puts a ...
1
vote
0
answers
121
views
Custom Raylib Shader Problem, Unable To See My Textures
I have written a custom shader for both vs and fs. The shader is supposed to draw two textures one in the front face of the cube and the other is in the back face of the cube. What I'm struggling with ...
3
votes
0
answers
120
views
SPIR-V extension suddenly needed to use discard, why?
While loading spir-v shaders in my application I suddenly started getting the following validation error:
[ERROR: Validation]
vkCreateShaderModule(): SPIR-V Capability DemoteToHelperInvocation was ...
0
votes
1
answer
100
views
glsl shader - cant get transparency
I'm currently trying to build a shader for a FogOfWar with pyglet and a glsl shader. I've now tried several things and looked at courses, but I just can't get it done.
Can someone here tell me what ...
0
votes
1
answer
78
views
Is it possible to do instanced rendering with different textures without non-uniform indexing?
For a long time I thought gl_InstanceID was dynamically uniform, but it isn't. And so if you instance render a bunch of instances and you don't have support for non-uniform sampled image indexing, ...
1
vote
1
answer
85
views
Unexpected "does not contain #version" error adding basic shader to Ursina/Panda3D
My game project is built in Ursina, which is just Panda3D under the hood with some convenience functions.
I've tried adding a basic glsl vertex and fragment shader to a test file I have, and every ...
3
votes
1
answer
134
views
Is there a way to get the index of a draw call?
I know there's gl_VertexIndex and gl_VertexID, but let's just say I have an index buffer that looks like:
[3, 0, 4, 1, 2, 3]
The first vertex processed in the vertex shader with an indexed draw ...
1
vote
1
answer
109
views
Blur or antialias edges of rendered polygon in WGSL shader without intermediate rasterization
I'm rendering a 3D-polygon on top of a given background (a pre-rendered image). The polygon is arbitrary: I just have its vertices (as a triangle strip or indexed triangles) passed via buffer. It ...
2
votes
0
answers
47
views
GL.DrawBuffers with DrawBuffersEnum.None crashes OpenGL
I use one shader that writes to 5 different textures bound to the FBO. Sometimes I want to ignore output values, i.e. at location = 0. I set it with this:
GL.DrawBuffers(5, new[] {
DrawBuffersEnum....
5
votes
1
answer
118
views
OpenGL fails to draw textured triangle?
In this program the 3 triangles aren't drawn, even when I replace the texture by vec4(0.0f, 0.5f, 0.0f, 1.0f);, trying to draw the third triangle in green:
#define GLFW_INCLUDE_NONE
#include <GLFW/...
0
votes
2
answers
83
views
Is it possible to take references to avoid copies in shader languages?
I have used GLSL and Slang, and in my GLSL code I have very verbose code because I repeat the same code over and over:
obj_scaling = vec3(object_info_arrays[nonuniformEXT(...
0
votes
0
answers
75
views
GLSL Program crashing when attempting to include a textured background [duplicate]
I have been displaying animations:
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include <cmath>
#include &...
0
votes
1
answer
124
views
PIXIJS v8: "Uniform type undefined is not supported" when passing float array uniform to a custom shader
I’m on PixiJS v8.1 (WebGL2) + TypeScript, trying to pass five RGB colors as a flat float[] into my fragment shader—but I keep getting:
Error: Uniform type undefined is not supported. Supported uniform ...
1
vote
0
answers
51
views
Artifacts in PCSS realization
I'm trying to write my own 3d renderer. I'm stuck in the shadow stage. I can't figure out what I'm doing wrong with the PCSS implementation. At the edges of tall objects, the shadow becomes sharp.
I ...
0
votes
0
answers
62
views
Noise pattern has subtle difference between glsl and hlsl
I'm using a noise algorithm from here, the code is
highp vec3 mod289(highp vec3 x) {
return x - floor(x * (1.0 / 289.0)) * 289.0;
}
highp vec4 mod289(highp vec4 x) {
...
2
votes
1
answer
84
views
webgl canvas with shader not filling screen
how do I fill the full canvas with the full webgl shader layer? The canvas is filling the full window width and height, but the webgl shader layer is stuck to the top right quadrant of the screen at ...
3
votes
1
answer
169
views
SMAA weight blend texture is unclear
I try to use SMAA on vulkan, but the output image is not complete anti-aliasing.
like this:
I see edgesTex is perfect, but blendTex is not so clear comparing with weight image which is from smaaDemo
...
0
votes
0
answers
135
views
Scalar layout with Vulkan compute
I use an array of a struct in a GLSL compute shader with scalar layout like this:
#version 450
struct Gaussian {
vec3 position;
vec4 rotation;
vec3 scale;
vec3 color;
float alpha;
...
1
vote
1
answer
134
views
Volumetric Fog HLSL DirectX 11 [closed]
Good evening! I want to implement volumetric fog in HLSL on DirectX 11. But I can't find a mathematical summary anywhere. Can someone provide the code in hlsl in what order and what variables I need ...
0
votes
1
answer
273
views
Creating a halftone effect with Three.js
I'm trying to create a reverse halftone effect using Three.js, specifically with Threlte. This is my reference image:
There are a couple of layers of dots, with some rather large areas of ...
1
vote
1
answer
176
views
Open Layers WebGLTile GLSL "Hello World" Example
I'm using OpenLayers for a React project and everything is going very well. I'd like to extend the WebGLTileLayer class to eventually be able to apply GLSL to web tiles (for raster smoothing, ocean ...
2
votes
0
answers
184
views
raylib - input attribute to vertex shader
I have simple vertex shader
#version 330 core
in vec4 vertexPosition;
in vec4 vertexColor;
out vec4 v_color;
uniform mat4 mvp;
void main()
{
v_color = vertexColor;
gl_Position = mvp * ...
1
vote
1
answer
109
views
Can't get GL_NV_gpu_shader5 to work in QT 5 when hasExtension is true
I have the following code, QT doesn't explain how to use extensions like this, like at all (just a default page when you go to QtOpenGLExtension page), so I assume I'm supposed to inherit from it.
//...
0
votes
0
answers
41
views
GLSL shader function to perform as cv2.warpPerspective
I am projecting the image into the x-y plane in my python script like this:
M = cv2.getPerspectiveTransform( picked_marker_corners, world_marker_pts )
warped = cv2.warpPerspective( image, M, ( ...
0
votes
1
answer
80
views
alignment of structures in ssbo OpenGL does not work
I'm trying to transfer the structure to ssbo, but nothing comes of it, only the first member of the structure is read.
layout(std430, binding = 0) buffer Lights {
DirectionalLight[] ...
0
votes
0
answers
60
views
For loop with 1 repetition removes shader artifacts
I think I'm going to lose it.
Here is a snippet of code:
vec4 get_color(vec3 pos, vec3 ray) {
for (int i = 0; i < 1; i++) {
vec3 final_pos, normal;
float n_steps; // floating ...
1
vote
1
answer
123
views
How to support InstanceMesh / BatchedMesh in custom ShaderMaterial?
I have no idea how to extend my shader. It is quite simple. I have geometries with custom focus attribute with value between 0-1 and based on that I render plane colour. But for BatchedMesh this ...
0
votes
1
answer
65
views
Push Constant not a constant integer expression for setting uniform buffer array size
I'm trying to create a fragment shader for a Vulcan application that takes an array of texture2Ds. I have this working however i need to set the size of the array at application run time rather than ...
-1
votes
1
answer
242
views
GLSL ERROR: Linking vertex stage: Missing entry point: Each stage requires one entry point
I am working on debugging this error
ERROR: Linking vertex stage: Missing entry point: Each stage requires one entry point
Though I am not seeing in my code anywhere that I am missing an entry point. ...
2
votes
2
answers
104
views
Alpha Gradient over mesh geometry in shader code
I have this scene and for the half transparent box geometry I want to create a shader that gradually reduced the alpha value of gl_FragColor going over the long axis (in this case the z axis in three ...
1
vote
1
answer
216
views
TinyGLTF-loaded GLTF file fails to render?
I'm trying to load a GLTF file using TinyGLTF:
#include <tiny_gltf.h>
#include <GL/glew.h>
#include <GL/gl.h>
#include <GLFW/glfw3.h>
#include <vector>
#include <...
0
votes
0
answers
42
views
How to apply fragment transformation after vertex transformation
Hey I'm using GLSL Shader inside Godot, I "glued" these 2 shaders. One "pixelate" the TEXTURE on its local UV space and one displace thevertex in a sinusoid shape with TIMe (much ...
0
votes
1
answer
74
views
Why is my projection matrix being optimized by glsl?
If I have the following shader sources:
// vertex shader
#version 460 core
layout (location = 0) in vec2 inPos;
layout (location = 1) in vec2 inNorm;
uniform mat3 proj;
layout(binding = 0, std430) ...
0
votes
0
answers
49
views
Shade a mesh uniformly by using the lighting at the center of the mesh
I am trying to accomplish what is discussed in this video (timestamp is at the part of interest)
Essentially, I have a mesh (a billboarded quadmesh with a texture) that may be fully lit, fully shaded ...
2
votes
0
answers
108
views
When converting HLSL to GLSL with shaderc and SPIRV-Cross, how can I keep in/out variable names consistent?
Here's my C++ code that converts HLSL to GLSL:
const shaderc::Compiler scompiler;
shaderc::CompileOptions soptions;
soptions.SetSourceLanguage(shaderc_source_language_hlsl);
soptions....
2
votes
0
answers
57
views
Is the size of each element of this array 16 bytes or 4 bytes?
I know that in GLSL by default struct use std140 layout, and that means, let's say you have an array of int bound to a buffer, the std140 will pad out that int to 16 bytes, so each element is 16 bytes....