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
55 views

Fragment Shader output type error

StackExchange! I've been working with opengl for a bit and I'm trying to finally load the shaders instead of having them inline. I'm having a ton of issues, though. As soon as I solve one, another ...
2
votes
1answer
44 views

The way of avoiding branching for textured and not-textured objects

I know that branching is an expensive operation on GPU (not as much as it used to be, but still). The most common situation where I use branching is when I have both textured and non-textured ...
0
votes
1answer
17 views

XNA custom effect importer

MSDN has an example of a custom hlsl effect importer and processor. Here is the importer's code: public override PSSourceCode Import(string filename, ContentImporterContext context) { string ...
2
votes
1answer
83 views

How can I create a screen-space distortion effect?

I am trying to create a screen-space distortion effect using shaders. This image demonstrating the effect I'm after is from Nvidia: Let's consider that I have access to the background texture. How ...
3
votes
2answers
62 views

How can I draw curves above a mesh surface?

I am making an animation of a deformed sphere that represents some aspects of the wave function in a hydrogen atom. I am starting with an octahedron that i push through a tessellation shader. The ...
0
votes
1answer
41 views

Drawing a Line in 3D using DirectX 11

I had a lot of problems to draw a line in a 3D and had a weird results.. The 3D Lines are projects in 2D and that's so weird. They only work with that view matrix configuration: XMVECTOR Eye = ...
0
votes
0answers
38 views

GPU skinning weird issue

I finally got my GPU skinning to work! (Mostly) I'm using MD5 format and this here tutorial However the weird part is that I'm getting EXACTLY the same issue as this unanswered post: here The ...
0
votes
0answers
39 views

Program not proprerly switching shaders [closed]

currently I'm experiencing a strange problem. I'm not really experienced with opengl, but I will walk through my program and what I want to do with it. The idea is to draw a height map with a 3D ...
8
votes
1answer
240 views

Implementing a Graph-Based Material System?

I'm trying to wrap my head around how material systems like this, this are implemented. These powerful and user-friendly, graph-like systems seem to be relatively common as a method of allowing ...
1
vote
3answers
134 views

2D HLSL World position

I'm trying to get world position from my vertex shader to my pixel shader so that I can disable the shader once a preset X coordinate has been passed (no shading once I'm over X). Getting the screen ...
0
votes
0answers
111 views

Slick2D shader crashes, but only after a while

I'm using Slick2D's ShaderProgram for shader-based drawing in my game. Some players report that after 3-10 minutes, the game inevitably crashes hard during what appears to be a setUniform4f operation ...
8
votes
1answer
357 views

How do I render my 3D game in ASCII art?

I'm trying to create an easter egg for a 3D game in Unity3D. I've the idea to pass my game momentarily in ASCII art. My first idea is to create a shaders to do that, but i'm not sure if it's the ...
0
votes
0answers
28 views

Grayscale and 2D lighting using cocos-2dx

I want to create a lighting effect on a gray-scaled world using cocos2d-x. What I've done is creating a layer which runs a shader program that receives light positions and radiuses as input and ...
1
vote
0answers
59 views

Understanding diffuse lighting in The Division

Here is a screenshot of the main character walking under a bright lamp: His hat, that was originaly dark grey, turns completely white. My question is how can such lightsource do this without making ...
1
vote
1answer
52 views

Bloom control - enlarging glare area

I am trying to improve my bloom system. So far I have bloom that looks like this: What I need is to enlarge the low-bloom areas to make it look like this: Simply increasing the bloom multiplier ...
1
vote
1answer
39 views

Opengl Quad Tessellation Control Shader

I have the generic tessellation evaluation shader for triangles but I need to make it work for quads. Is there any chance someone could explain what is happening here and point me in the right ...
0
votes
2answers
12 views

Setup VertexPositionTexture array for a texture2D at a location

I am trying to adjust the following code to render a quad on a 2D texture at a specific location and specific size. Currently this code will render a fullscreen quad, which makes sense since the ...
3
votes
1answer
318 views

I want to render some surfaces in GLSL with normal maps, and some without

I have normal mapping working in my game, but I want to only use normal mapping for some surfaces, and not others. Right now, as far as I can tell, my shader is applying an incorrect normal of (0, 0, ...
1
vote
2answers
40 views

Dynamic Flow Control in HLSL with Array References

I'm trying to do lighting calculations for an array of point lights in HLSL. I simply want to pass light direction vectors from the vertex shader to the pixel shader. Here is sample code: static ...
1
vote
2answers
140 views

How can I implement a futuristic “barrier field” that reacts to hits?

I want to implement a "shield" that reacts to projectile hits. Currently, my colliders are mapped to the animated sprite's outline on all frames. I'm looking for something like the image below. For ...
0
votes
0answers
28 views

Placement Shader [duplicate]

Do you know what this shader is called, if you can give a link that's even better :) . I am talking about the green outlines on the objects that are selected. That's the shader that I would like to ...
0
votes
0answers
34 views

Very subtle HLSL syntax change causes compliation error

The following HLSL works and compiles: texture2D renderTarget; float h; // declared here sampler GetRenderTarget = sampler_state { texture = <renderTarget>; }; float3 GetHsvFromRgb(float3 ...
8
votes
2answers
323 views

How do I perform an xBR or hqx filter in XNA?

I'd like to render my game scaled up with one of the hqx filters (hq2x, hq3x or hq4x) or an xBR filter in a shader. How can I do this in XNA 4.0 and SM3? Side note: this question has been heavily ...
1
vote
0answers
99 views

How to read neighbor pixels in GLSL?

I'm using SFML 2.1, it's much more straightforward for me so I can jump directly to learning the shading language. I'm trying to do something similar to conway's game of life. I already learned that ...
0
votes
2answers
115 views

Combine flat and smooth shading with a single model geometry

I need to be able to switch between smooth and flat shading interactively. Is there a way to do this efficiently with a single geometry? For example, smooth shading does not require duplicate ...
0
votes
0answers
25 views

Sprite framework binding multiple textures

In an attempt to batch render as many quads (sprites) as possible, I'm instance rendering a single unit-sized quad and passing in a buffer of per-instance data that includes width/height, texture ...
0
votes
2answers
62 views

How can I run a shader over the entire screen without interfering with other running programs?

I'd like to avoid hooking into DirectX, and just run a shader over the entire screen. Is this something I can do in Windows without draining an unreasonable amount of resources? I can use whatever ...
1
vote
1answer
110 views

Basic terrain shader without using external texture

I have this: (Right now I have the height map in a x*x size 2D array and a 1D vector too.) What I am trying to achieve is something like this: Without using any textures, only plain colors. So ...
1
vote
1answer
54 views

How to fix model matrices colliding in vertex shader?

I am new to OpenGL programming and I'm writing some basic code to display a few objects onto a screen. I have a pyramid shape that I'm displaying, as well as a box shape that I am displaying. The ...
0
votes
0answers
46 views

OpenGL ES 2.0 - Applying rotation to only specific quads within a batch

This problem seems fairly simple on the face of it: How, when drawing a batch of quads using a triangle strip, can I apply a rotation to only one or some of the quads. I've been looking at this ...
2
votes
1answer
111 views

Shader - Transmittance or Absorption

I am trying to create a transmittance or absorption shader (glsl, hlsl, cg, etc...) in realtime but I don't find any good tutorial or white paper about this subject. I only find offline rendering ...
1
vote
1answer
99 views

Is it possible to calculate the TBN matrix in the fragment shader?

Just from model position, model normal and texture uv?
1
vote
0answers
111 views

OpenGL Bump Map — Texture artifacts ?

I am learning OpenGL (and learning the math behind it) and I'm making a simple OBJ viewer, nothing fancy. I have diffuse, specular and ambient light/texture working fine and now I am implementing the ...
2
votes
2answers
57 views

In XNA 4, how can I access SpriteBatch's transformMatrix in my shader?

I would like to use a custom effect with a regular XNA SpriteBatch. I have a 2D camera which computes a transform matrix, so I need my shader to take this into account. I have put a world matrix ...
0
votes
0answers
55 views

Shadow mapping comparing depth in GLSL

I've been trying to figure out how to compare against my shadow map, which has a shader that just does the following: gl_FragColor.r = gl_FragCoord.z; And my vertex shader for the render pass does ...
2
votes
1answer
111 views

How to share values between different shader programs?

I am using Unity but this might concerns all type of shaders. I would like to know if this is possible to share values between different shader pass.Let's imagine that I am computing something in the ...
0
votes
0answers
46 views

Having trouble getting shader to work with sprite batch in XNA #4

I found a neat "CRT screen" effect shader on the web, but I've never used shaders before and I can't seem to get it working properly. If I do the second sprite batch in my code here normally without ...
3
votes
2answers
172 views

Shader - Calculate depth relative to Object

I am trying to calculate depth relative to the object.Here is a good solution to retrieve depth relative to camera : Depth as distance to camera plane in GLSL varying float distToCamera; void main() ...
0
votes
0answers
25 views

How to upload lights when doing one pass per light

Suppose I have a reasonable amount of light sources that I upload at once in my forward rendering and accumulate them in shader. Now that I am willing to move to deferred, and so one pass per light, ...
0
votes
1answer
81 views

GLSL: Vertex attribute to int

I'm trying to write a shader which renders a multitextured geometry wihout rerendering the geometry with each texture. In my test I'm not using textures, I just convert the texture index to a color ...
0
votes
0answers
89 views

Shader - Objects Depth or Thickness

I am using Unity and would like to render the thickness of an object.My first thought was to use the ZBuffer and the depth but it is always depend to the camera, it seems legit.But I would like to ...
0
votes
0answers
35 views

HLSL Shader Relative Positioning

I've got a shader that does the texturing, lighting, etc. for my game engine (written on top of MonoGame, in case that's relevant) for my block-terrain-based game (everything is rendered as triangles ...
2
votes
1answer
137 views

XNA/MonoGame/SharpDX: Pixel shader with sprite sheet

I've searched around for two days now on the internet but cannot find a solution. I've also read up on Pixel Shaders on MSDN with no luck. I'm trying to apply a simple pixel shader to a sprite batch ...
3
votes
0answers
88 views

Transparent diffuse fails to render from all viewing angles

I'm rendering this chunk as a Unity mesh and I have just one material (with alpha) which is applied over all the mesh. Everything in the chunk is automatically generated at runtime, so it's not ...
4
votes
0answers
88 views

Ogre PSSM Grass Receiving Shadows

So I made the switch to Ogre3D (v1.7) and using PagedGeometry. What I'm trying to do is make a simple scene with a terrain, some trees and grasses. In a nutshell, I would like to achieve this kind of ...
4
votes
2answers
359 views

How to implement color changing fragment shader?

I have a background of a given size and filled with a given color. I want to change it with an animation effect, starting from the center and spread out until it extends the whole background. The new ...
2
votes
1answer
58 views

Distort a quad with a World Matrix

Is it possible to distort a quad multiplying its vertices by a specific world matrix? See the picture to understand what kind of distortion I need: Please note, that the quad is in 3d space and I ...
0
votes
0answers
52 views

Is it possible to loop over an array of samplerCube/samplerCubeShadow using OpenGL/GLSL?

I try to manage a scene with several point lights. For the moment my program works perfectly with just one point light. So I have in my fragment shader the following uniform declaration: uniform ...
1
vote
1answer
79 views

Tons of textures using vbo

I recently learned how to create shaders and was looking to make a simple top down game, starting with a tilemap. The problem I encountered, Whilke I can store a vbo of all the blocks in a "chunk" of ...
1
vote
1answer
213 views

How do I add a border to rectangles using a shader?

I want to draw some rectangles with a border. Currently I render the fill with glDrawArrays(Triangles, ...) and the border with glDrawArrays(LineLoop, ...). Is there a neater way? I'm targeting ...