Tagged Questions

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)

0
votes
1answer
315 views

How to change pixel color of Texture with Fragment Shader

I want to change the pixel color of a texture. I don't know where to start and what to add. Really need help, I only find useless snippets in the internet. My current Code: public void ...
0
votes
0answers
52 views

DirectX9 Normal/Bump Mapping Weird Texturing Artifact

As you can see the artifact here is like a triangle of the mesh getting more light. The important part of my code is below. This is the vertex declaration. VertexElement[0].Stream = 0; ...
-1
votes
1answer
100 views

Combine Two Shader Program [closed]

For my android application, I want to apply brightness and contrast shader on same image. At present I am using gpuimage plugin. In that I found two separate program for brightness and contrast as ...
1
vote
1answer
67 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: //use instrinsic functions, they do the calculation on 4 components at a time. float ...
2
votes
1answer
119 views

How can I compile a Direct3D 9 effect from a file?

I started working with shaders recently in DirectX9. I noticed that there is a D3DXCompileShaderFromFile function for IDirect3DVertexShader9 and pixel shader. Which compiles the shader and gives you ...
2
votes
2answers
75 views

Linking one uniform variable to many shaders

Let's say, that I have 3 programs, and in each of those programs there is a view matrix uniform, which should be the same in all those programs. Right now, when my camera moves, I need to re-upload ...
2
votes
1answer
557 views

2D metaball liquid effect - how to feed output of one rendering pass as input to another shader

I'm attempting to make a shader for unity3d web project. I want to implement something like in the great answer by DMGregory in this question. in order to achieve a final look something like this.. ...
0
votes
1answer
119 views

What is wrong with my specular phong shading

I'm sorry if this should be placed on stackoverflow instead however seeing as this is graphics related I was hoping you guys could help me: I'm attempting to write a phong shader and currently working ...
2
votes
1answer
124 views

Achieve anisotropic filtering

I want to set anisotropic filtering to my scene. I use SharpDX (DirectX 11) and C#. How do i set up anisotropic filtering in my shader? Currently i try that in the shader: Texture2D tex; sampler ...
1
vote
1answer
51 views

Depth Map resolution shifting

the problem is with shadow mapping as you can see, actually it works fine but in a certain condition that the Depth Map size must be equal to the size of rendering buffer, I use an infinite ...
2
votes
1answer
191 views

draw fog of war using shaders

I am making a RTS game, and I'd like some advice on how to best render fog of wars, given what I'm already doing. You can imagine this game as being a classic RTS like Age of Empires 2, where the fog ...
0
votes
0answers
51 views

XNA Shader deformation event driven

I’m working on this tutorial trying to figure out how i can modify the code in order to get the deformation along only one axis (for example Z axis) when I hit a button on my keybord. In other words, ...
0
votes
0answers
87 views

Why distance field text rendering have clear outline?

http://www.valvesoftware.com/publications/2007/SIGGRAPH2007_AlphaTestedMagnification.pdf All the process for doing distance rendering is clear, but 'how does it work' is not clear for me. It looks ...
7
votes
1answer
412 views

Tessellation vs Geometry Shader

Correct me if I'm wrong, but both the Geometry Shader and the Tessellation Shader jobs are to generate vertices in the Graphic Pipeline. What I would like to know is how they are different and when ...
1
vote
0answers
75 views

Global variables with fixed shaders [closed]

In Unity3D, can I use global shader uniform variables with fixed function shaders?
1
vote
1answer
185 views

Render 2 images that uses different shaders

Based on the giawa/nehe tutorials, how can I render 2 images with different shaders. I'm pretty new to OpenGl and shaders so I'm not completely sure whats happening in my code, but I think the shaders ...
-2
votes
1answer
72 views

List of GLSL ES built-in variables

I am writing an article on WebGL and three.js, I'm trying to search all the built-in variables available in the vertex and fragment shader. I've found many sites mentioning some, for example: ...
0
votes
1answer
291 views

Calculating Per Vertex Normal in Geometry Shader

I am able to calculate normals per face in my Geometry Shader but i want to calculate per vertex normal for smooth shading. My Geometry shader is #version 430 core layout ( triangles ) in; layout ( ...
3
votes
1answer
211 views

What is the maximum number of shaders I can have in OpenGL 4?

What is the maximum limit of shaders I can have on the GPU? With 1000 different objects, I might have 1000 * 5 shaders (vertex, tcs, tes, geo, frag) on the GPU at a time. Though only one will be ...
0
votes
2answers
122 views

Can't read .cso files but I can read their .hlsl versions?

Well I've been trying to read a .cso file to use as a shader for a DirectX program I'm currently making. Problem is no matter how I implemented a way to read the file it never worked. And after ...
0
votes
0answers
25 views

opengl output to texture with 4 levels of depth

i'm building a game where transparency is important. I can live with being restricted to four levels of depth and my current plan is to do two passes: 1. render everything to a texture using ...
0
votes
1answer
215 views

Optimizations using GLSL shaders

I have written a simple OpenGL application using GLSL shaders. Actually, my program just displays a simple cube with a phong lighting effect like below : Here's a peace of the client code : ...
4
votes
2answers
125 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: ...
10
votes
3answers
2k views

How many active shaders at one frame in the game (should I typically use)? 5? Or more like 100?

I have a question: how many shaders are usually active at the same time in one scene in modern games? I mean: I know that multiple shaders are being used (switching between them in each frame). And ...
3
votes
2answers
1k views

Unity - Part of the sprite is covered in shadow

I have a sprite with Transparent/Cutout/Diffuse shader. Recieving shadows is turned on in SpriteRenderer. The light is a pointlight and I am using deffered rendering path. However when I am above or ...
0
votes
0answers
57 views

Diffuse Mapping in a Game

I want to figure out the diffuse maps of some rusted objects that I plan to render in my game arena. I have taken the images of some sample objects and have also scanned them for a model of the ...
2
votes
1answer
83 views

XNA 4.0 - Strange edges with multilight shader

I am generating a light, a depth and a normalmap to calculate the lightning at each pixel with multiple lights. On both rendertargets, i set the preferredMultiSampleCount parameter to 16 samples ...
1
vote
1answer
135 views

Gamma Space and Linear Space with Shader

I am using Unity and I can choose between two color space mode in the settings: Gamma or Linear Space. I am trying to build a Custom Lighting Surface shader but I am facing some problems with those ...
1
vote
0answers
109 views

Theoretically, If GPUs were equipped with faster memory access, how would that impact game development? [closed]

According to NVIDIA memory access time will no longer cost a noticeable overhead. Regardless if it's true or not, I would like to know: How it would affect games in practice? How will it translate ...
1
vote
1answer
361 views

gl_VertexID values when calling glDrawElements

I am struggling a bit to understand the values that gl_VertexID primitive contains when the vertex shader is executed. I have the standard modern rendering pipeline, in which after setting up ...
-1
votes
1answer
109 views

Unity's pack 4 floats

Linked to: GLSL pack floats into an RGBA texture I found EncodeFloatRGBA/DecodeFloatRGBA shader functions in Unity https://gist.github.com/hecomi/9580605 Now I try to figure out how they work. So I ...
0
votes
2answers
644 views

GLSL: can i use matrix transformation functions in vertex shader?

I have a working OpenGL code where i render a terrain with some trees. I am doing all the matrix mathematics on the client side. Because of which the frame rate of my app is very low, around 25-30 ...
1
vote
1answer
188 views

Most efficient way of brighten and darken sprites with OpenGL > 2.0

So I have been shading (brighten/darken +adding color) my sprites by using glTexEnvf with GL_MODULATE and GL_ADD and a vertex color. I only had to rebind the batch every time I needed to change from ...
0
votes
1answer
133 views

Generating shaders from fragments / HLSL Dynamic Linking in older shader models

In shader model 5 is a feature called dynamic linking which separates hlsl fragments by using interfaces and their methods implemented in classes. I don't have any experience with this technique, my ...
0
votes
1answer
59 views

bug in webgl phong shader: lighting rotates with object

I'm working on a simple phong shader in webgl, and I think I'm getting close but something is still wrong. Dead give away: if I have a billboard and have it roll (so it spins like a wheel), the part ...
1
vote
1answer
140 views

XNA Diffuse Shader Issue. Edge lighting problem. Image Attached

As you can see in this image the diffuse shading is working correctly in some places but in other places such as the the bottom of the sphere you can see the squares/triangles of the mesh. Any ...
0
votes
3answers
168 views

How necessary are shader coders? [closed]

I know that gameplay mechanics programmers, either directly working with source or with scripting are needed, however there are so many shaders written already that I would imagine you could find ...
0
votes
0answers
96 views

Bilinear filter in repeating texture, HLSL

I have a repeating texture that I'm using as a scroll surface. The idea is that as I pan the surface I adjust the texture coordinates, filling in what gets wrapped on the right as it disappears from ...
6
votes
1answer
282 views

OpenGL 2.0 - Texture animation with 'pixelated' effect

I'm looking for a way to reproduce the effect I've tried to sketch in the image below with OpenGL ES 2.0. The idea is to let a drop of color fall over a cube which get filled with a kind of ...
3
votes
2answers
171 views

Possible to create transparency shader which doesn't stack alpha values

The image above best demonstrates what I'm trying to achieve. It's a transparent shader for objects, but wherever the objects with this shader intersect they don't add together but simply merge with ...
1
vote
0answers
82 views

SpotLight in ForwardBase pass using forward rendering

Is there anyway I can force Unity to allow me using a custom shader to render spotlights in a ForwardBase pass (using Forward Rendering Path)? For what I could see since now: Unity use and ...
1
vote
2answers
123 views

How to use blender files in your own engine?

It is not trivial to use your own shader on blender, so I've created a good-looking webgl shader. Now, what do I need to use the things I made in blender on it? An obvious first idea would be to parse ...
2
votes
2answers
1k views

Shader that “cuts” hole through all geometry

How can I create a shader that "cuts" through all geometry, only rendering the clearing background in Unity? An example: That's a prism in a huge white box-shaped room. The surface of the prism is ...
1
vote
1answer
222 views

In Unity, how can I read the color from _LightColor0 in a shader?

I have a scene with a point light and alpha textured (RGBA) triangle strips. I want to apply the point light color with a shader. Shader "Custom/Test02" { Properties { _MainTex("Texture ...
1
vote
1answer
433 views

glsl shader to allow color change of skydome ogre3d

I'm still very new to all this but learning a lot. I'm putting together an application using Ogre3d as the rendering engine. So far I've got it running, with a simple scene, a day/night cycle system ...
1
vote
1answer
159 views

OpenGL and atlas

I'm trying to draw element from a texture atlas with OpenGL ES 2. Currently, I'm drawing my elements using something like that in the shader: uniform mat4 uCamera; uniform mat4 uModel; attribute ...
2
votes
1answer
76 views

Disable depth testing for only some faces

I have some meshes and I need to be able to draw some part of them without depth test. Is it possible to turn off depth testing from within shader, wo that some parts will be rendered no matter what ...
0
votes
2answers
231 views

OpenGL UseProgram() fails

I have a rather strange exception on my application using OpenTK on Linux (ArchLinux with Mono 3.2.8) with GL.UseProgram(). I wrote a class to combine multiple files to one program: public sealed ...
2
votes
1answer
55 views

How To Set Constants Using ID3DShaderReflection

I got to the point where I am tired of hardcoding shaders and decided that it was now time to look into using ID3D11ShaderReflection to get data from the shader and set my shader's constant buffer ...
1
vote
1answer
70 views

How to create more vertexes from within a shader in OpenGL?

when rendering voxels in octrees, the only information necessary is the current octree-level, -position and colour/texture. But one has to send eight vertices to the rendering pipeline in order to ...