a computer program that runs on graphics hardware and provides a high degree of control over how scenes are rendered

learn more… | top users | synonyms (1)

16
votes
1answer
2k views

Phong lighting - there is something very strange with specular lighting

I implemented Phong lighting. Everything seems to work - torus and spheres are lighted as expected, etc. But I notices something strange regarding specular lighting of directional light. Here are two ...
0
votes
1answer
60 views

Fixing strange artifacts in an HQX shader

I'm having an issue implementing an HQX filter that I found in the LibRetro GitHub repository. LUT texture was obtained here Shader file was obtained here (I converted it to compile in MonoGame with ...
0
votes
1answer
41 views

What do shaders encompass?

I'm researching shaders as I'm thinking about doing them for my final year project at Uni. I've looked at a lot of examples online and I think I get it. It's something that you apply to an object or ...
1
vote
1answer
54 views

Specular intensity of non-metals(plastics) in metalness pbs workflow

The specular color in metalness/roughness workflow is usually defined as following: float3 specColor = lerp(0.03f, albedoColor, metallic); The Cook-Torrance BRDF is given with the following ...
0
votes
1answer
46 views

OpenGL: Objects wont draw at certain angles while using lighting(shaders)

I was following this tutorial (http://www.lighthouse3d.com/tutorials/glsl-12-tutorial/point-light-per-pixel/) but when the camera is at a certain angle, if I had alpha test and blend enabled the cube ...
1
vote
1answer
503 views

Monogame shader not working

I'm trying to use this this tutorial in monogame, but the effect does not work, only renders a black screen. Everyhing by itself renders just fine, I looked at the render targets if they get drawn to, ...
1
vote
2answers
68 views

SDL_LoadBMP into glTexImage2D results in scewed colors

I read up on this but i can not find the error. Some suggest switching the format from RBA to RGBA but the surface data says it is 3 byte data. Here are snippets and results of my source. Loading ...
0
votes
2answers
75 views

No output to screen using Multiple Render Targets and multisampling

I'm having a little trouble with XNA, but I doubt it's specific to the framework. I draw a few 3d models to 1 rendertarget with multisampling turned on, and it works fine. If I draw the same scene to ...
1
vote
0answers
208 views

Water drops on camera

How can I create water drops on camera something like we see in Ripitude GP, I tried using Unity's default GlassStainedBumpDistort shader though its performance heavy on mobile plus it do not let ...
0
votes
2answers
78 views

Shader value remap - Blend Falloff

I would like to know if there's a way to remap a value that goes from 0 to 1 constantly like this. Into those values (those are examples). This might be some function transformation but I can't ...
0
votes
1answer
79 views

How to determine vertex index using Shader Model 3 or lower?

I need something like SV_VertexId (added in Shader Model 4) in HLSL shader to determine which vertex is currently handled. Unfortunatelly, I can compile only vs_3_0 or lower. The objective is to ...
1
vote
1answer
118 views

White dots artifacts when applying borders to hex tiled geometry

I have a hexagon tiled geometry I created in Blender Which I then load in WebGL, using THREE.js library. Below is the loading code, I've cut the code of creating scene, lights, etc. I create ...
0
votes
0answers
96 views

What is a good way of handling shaders?

I'm currently reading this book and are at the chapter about the rendering subsystem of a game engine. Now, the book suggests that a material is a structure that provides information on how to shade ...
0
votes
1answer
31 views

OpenGL Mapped Memory Shader Source

Is there any way to get a pointer to a newly created shader object's source? I'd like to load a shader directly from file in to my shader object instead of loading to an intermediary variable and then ...
3
votes
2answers
255 views

How to achieve a dynamic soft see-through hole effect in a wall with shaders?

I'm looking for a way to create a dynamic soft see-through hole effect for room walls. I know a few ways how to do it (for example multitexturing with second layer being the hole mask in screenspace), ...
0
votes
1answer
51 views

D3D12 ConstantBuffer - Shader receives wrong values

im having trouble with one constantbuffer: struct CameraConstData { urd::Matrix projection; // 64 ( 16 floats) urd::Matrix view; // 64 ( 16 floats) urd::Vec3 viewPosition; // 12 ( 3 ...
2
votes
0answers
70 views

Using depth values for fake ambient occlusion

I'm using the normalized distance to the camera to get depth information in the fragment shader. When using this value as fragment color, it looks at lot like ambient occlusion (of course only in the ...
0
votes
1answer
41 views

Modify Element of Struct Array

I have this struct array in GLSL. struct Test { vec2 value1; vec3 value2; float value3; } uniform Test u_test[5]; How can I modify the elements of this array one at a time? I know that ...
1
vote
0answers
103 views

Rotating, moving and scaling a mask in a shader

I want to rotate, move or scale a mask in a shader. But I have no clue to how perform these actions. My code: @Override public void create() { batch = new SpriteBatch(); background = new ...
0
votes
0answers
28 views

OpenGL - Program stops responding after linking a compiled shader

I have an OpenGL compute shader that compiles with no errors and I attach the shader to the program. When I try to link the program the program stops responding all together. I have never had a ...
3
votes
1answer
88 views

Do shader compilers typically know not to look up unused texture channels?

I have a texture that's from the color attachment of an FBO in OpenGL ES 2.0, so I have limited control over the number of channels in the image. Suppose I only need the color from the R channel of ...
0
votes
1answer
121 views

Draw cube in glsl shader

I am working on a voxel engine. Currently my cubes are rendered as vbos. I thought, it may be better to load only the cooridinates of voxels to the shader and make it draw a cube itself. Can someone ...
2
votes
2answers
227 views

Why has my refractive water shader become reflective

So I was making a water shader in unity and well it looked fine in the scene view but as soon as I went into the game view the refraction texture basically flipped up 180 degrees and made it look like ...
-1
votes
1answer
334 views

UNITY3D - Orthographic Camera not render SHADER (2D GAME) [closed]

I have a problem with camera render, see the video please :) (note.: sorry for the music) http://youtu.be/BB8rXIzIWVU In Camera "Perspective", i can see the effect of shader: In Camera ...
1
vote
1answer
72 views

Unity - drawing halos behind everything else

I would like it so that the halos created by the draw halo parameter in spotlights are drawn behind all other meshes etc, currently it does this very weird thing where halos are sliced in half by ...
3
votes
1answer
143 views

Underwater Shader Animation Help

I found an underwater (distort) effect and I got it to work but somehow I cannot make it animate given the offset here: Fragment Shader code: uniform sampler2D fbo_texture; uniform float offset; ...
4
votes
2answers
667 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 ...
3
votes
1answer
90 views

Strange depth map projection

I'm trying to implement depth-only SSAO and for that, I render a depth map into a texture and pass it to my SSAO shader which then uses it. The problem is that when I try to output the depth map ...
1
vote
1answer
104 views

Are shaders always faster?

Will using shaders or some other way of talking directly to the GPU always be faster than drawing to the screen in whatever language a game is being (mainly) written in? I guess that code with lots of ...
0
votes
1answer
91 views

Is there anyway I can make a plane visible from both sides?

In Unity i have a model of a tree with leaves made of a plane and a texture, when I upload it to unity the texture is only visible on one side so how can I change it to be visible from both sides ...
0
votes
0answers
37 views

What is dynamic branching in shader? And How to check which runs on android phone?

Is it simple "for" or "while" in loop with variable? Is it standard term? I have errors on some android devices with "for"-terms. [0020.31] Log: Compiling Shader 0x8200000000_0x3000000000000000, ...
1
vote
0answers
63 views

Set Render Target usage

I am using Unity and I have some difficulties about understanding the way Set Render Target works and how it can behave with the shaders. Is it possible to render a shader pass in multiple render ...
5
votes
1answer
99 views

How can shader code duplication be reduced in Unity?

In our current Unity project we have a few shaders that are basically just supersets of another shader. For example, we have a shader that performs lighting calculates with diffuse, normal, specular, ...
2
votes
0answers
202 views

How do I make volumetric grass?

I've been extremely interested in volumetric technology, especially for grass. Online resources are extremely scarce on this topic. What is the difference from creating a lot of mesh billboards? ...
2
votes
1answer
159 views

Unity5 - A Shader to blur far plane edges?

I need some help. In my Unity5 game I'm using two cameras, First camera renders the actual terrain and game objects (wich has a far plane of a 1000 units) and the Second camera renders a 3d skybox of ...
3
votes
0answers
89 views

Raymarching tangents

I've recently started to experiment with raymarching over on shadertoy.com. It seems common to find the normal for a distance field like so: vec3 scene_normal(vec3 p) { vec3 e = vec3(0.001, 0.0, ...
0
votes
1answer
240 views

Render Queue Sorting, HOW?

Recently I'm trying to implement a render queue sorting system, i.e., ordering my renderable objects in an array in such a way that the overhead of OpenGL state changes are minumum. After some ...
0
votes
1answer
109 views

Processing through multiple shaders (LWJGL/Java/OpenGL)

Very simple question: Is it possible to process a vbo through different shaders? If so, how? What I want is sth like this: reflectionShader.bind(); //starts shader reflectionShader.load(some_values); ...
1
vote
1answer
87 views

libGDX upload z-axis of sprite to graphics card

Background: I want to obtain each fragments position via vertex interpolation to then calculate the light vector for phong shading (L = [Fragment pos] - [light source pos]). Problem: At the moment I ...
0
votes
0answers
103 views

Unity - Meta pass and Precomputed Realtime GI

I am writing a shader in Unity and I would like to use some special values for the precomputed realtime GI. I am using a vertex fragment shader as it seems that it offers much more controls than a ...
3
votes
1answer
273 views

Monogame fails to load Effect

I'm currently porting an old XNA game over to MonoGame and everything (including custom shaders) build fine. However when i try to load the xnb file using content.Load<Effect>("BaseDraw"); I ...
0
votes
0answers
53 views

Pass uniforms to Filter's shader

I wanna implement this shader (https://www.shadertoy.com/view/MslGWN#) in PhaserJS state. So i transformed the shader to WebGL style. I overload Phaser.Filter's update function to pass iChannel ...
1
vote
0answers
20 views

Is there a way to control the ordering and grouping of ShaderLab Blend command?

I'm writing a shader in Unity that responds to 3 lights: 1 directional and 2 point lights. The point lights are processed in the ForwardAdd pass (once per light). I need the ForwardAdd pass to blend ...
0
votes
1answer
93 views

Pass-through pixel shader not displaying properly

I'm new to shaders, HLSL and XNA in general. I'm trying to write a pass-through pixel shader but I'm experiencing some odd behaviour. I created a simple texture, shown below: Here's what I see when ...
0
votes
0answers
46 views

OpenGL, glDrawElementsInstanced behaving differently on NVIDIA GPU than AMD

I have an AMD GPU on my desktop, AMD HD 5770. I am working on a project on my desktop for over a year. In the scene, I have instanced grass and instanced trees. Everything is working fine on desktop, ...
0
votes
1answer
60 views

Mapping “Color” parameter from SpriteBatch.DrawString() function to a custom shader

I've recently found a nice way to render text in XNA with custom font AND custom shader. Here is the game code**: using System; using System.Collections.Generic; using System.Linq; using ...
0
votes
2answers
120 views

How do I start and stop a GLSL shader?

Is there a way to start and stop a shader?. I want to use this shader to sweep once over my texture and then stop. Does anybody know how to do that? void mainImage( out vec4 fragColor, in vec2 ...
0
votes
0answers
30 views

Device.SetRenderTarget Prevents Shader From Executing

Using DirectX 9 and C++. I'm trying to finalize this code to run a HLSL shader on in-memory data. In theory it should be working. In practice the shader doesn't run. ...
0
votes
1answer
180 views

How to Set HLSL Shader Input Textures?

Very simple question. With C++/Direct9, I'm creating a texture as RenderTarget with a full screen quad, creating a scene, setting a HLSL pixel shader, copying the image and then call Present. 1) How ...
1
vote
0answers
601 views

Creating lightning effect with glow effect

I am trying to recreate Drilian's lightning bolt in unity and I have faced a problem in the "Adding Some Glow" part. I am missing glow effect (and/ or "rounded beams"). Here is what I am doing: I ...