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
0answers
36 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 ...
0
votes
0answers
44 views

Is this shader too complicated for mobile? Renders solid black on mobile [closed]

I've written this for use in Unity with ShaderForge and have attempted to use it on Mobile, however it is rendering solid black. http://pastebin.com/5kitbRAg It is quite complicated, as it's a splat ...
2
votes
1answer
85 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
18 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
147 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
23 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
44 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
55 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
26 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
110 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 ...
2
votes
0answers
47 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 ...
3
votes
0answers
58 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 ...
3
votes
2answers
157 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
46 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
24 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
72 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
135 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 ...
0
votes
1answer
66 views

Simple shader for sprite interface [closed]

I have been looking for any examples for a long time, I cant get anything to work (from the examples). I have tried using vertex/pixel shaders, effects files, but they never have any effect on the ...
1
vote
0answers
49 views

Unity Free Inverse Depth Mask?

How would it be possible to create an inverse depth mask? In this case, I refer to a depth mask as a shader attached to a mesh that 'pokes a hole' through the current camera layer to let you see the ...
0
votes
1answer
116 views

3D position of an arbitrary UV coordinate

I have a UV map for a 3D mesh that encodes "links" between pairs of UV coordinates. I have previously defined this links (or pairs), one to one. The links are enconded using the function rgb_color(u1, ...
0
votes
1answer
61 views

Applying transformations in Geometry Shader

So, I am trying to program in opengl (3.3) a kind of robot. The idea is that I have some simple blocks that represent his body (4 rectangles for his arms, one for the torso and the last one ...
0
votes
1answer
55 views

Set color by uniform per sprite using libGDX SpriteBatch

I am using a SpriteBatch to render large amounts of sprites very fast. Now I want to modify the sprites with shaders to tint them in a color. Problem 1: Altering an uniform by getting the shader and ...
3
votes
1answer
89 views

Desaturate texture using mask in OpenGL 2

I have a very large texture i am using as background and i want to apply a filter to a small part of it, the "small part" is defined by the alpha layer of another texture i have (which is still ...
7
votes
2answers
901 views

How many OpenGL programs should I use to render multiple objects?

My scene has multiple objects in it. (Let's say 3 cubes, 1 cylinder, 8 spheres.) I assume I should create a vertex shader for each. How many programs should I have? Alternatives: One program per ...
1
vote
1answer
70 views

Lookup table in shader opengl es

What I need is apparently very simple, a lookup table in a fragment shader. It seems that the natural way would be an array float lut[], but in some implementations of OpenGL ES I am getting an error ...
1
vote
1answer
50 views

Using depth texture for depth testing

I was wondering if it is possible to render my scene onto a depth texture then using that texture for depth testing in another pass. I have an idea to that in shaders, but is that possible ...
17
votes
3answers
1k views

Why is H (blinn) used instead of R (phong) in specular shading?

I can't find a good reason for this anywhere. The reflection vector used in phong has a simple basis in physics. But the half vector used in blinn seemingly has no rational basis, and does not ...
0
votes
0answers
67 views

Gaussian blur not working correctly

So pretty much I tried to add a gaussian blur to something I am making and it is acting oddly. The setup is like: [All framebuffers are cleared to rgba(0,0,0,0), normal blend enabled] Draw some solid ...
1
vote
0answers
133 views

How to implement efficient Fog of War?

I've asked a question how to implement Fog Of War(FOW) with shaders. Well I've got this working. I use the vertex color to identify the alpha of a single vertex. I guess the most of you know what the ...
0
votes
1answer
63 views

Proper way to encapsulate a Shader into different modules

I am planning to build a Shader system which can be accessed through different components/modules in C++. Each component has its own functionality like transform-relevated stuff (handle the MVP ...
2
votes
2answers
289 views

How to implement Fog Of War with an shader?

Okay, I'm creating a RTS game and want to implement an AgeOfEmpires-like Fog Of War(FOW). That means a tile(or pixel) can be: 0% transparent (unexplored) 50% transparent black (explored but not in ...
0
votes
0answers
21 views

XNA `tex2Dlod` always returns transparent black

I want to sample a texture in a vertex shader, so at first I just tried using float2 texcoords = ...; color = tex2D(texture, texcoords); But apparently I cannot use tex2D in a vertex shader, and ...
0
votes
2answers
189 views

Material tiling and offset in unity

Ambiguity: What exactly is the difference between Tiling the material and Offset of material? Need to do: I need the material to be repeated n times on the object where I need to set the value of n ...
0
votes
0answers
28 views

OpenGL textures trigger error 1281 if SFML is not called

I am using SOIL to apply textures to VBOs, without textures i could change the background and display black (default color) vbos easily, but now with textures, openGL is giving an error 1281, the ...
1
vote
1answer
58 views

Problems with texture orientation in space

I am currently drawing texture in 3D space and have some problems with it's orientation. I'd like me textures always to be oriented with front face to user. My desirable result looks like ...
1
vote
0answers
48 views

Multi Pass Blend

I am seeking the simplest working example of a two pass HLSL pixel shader. It can do anything really, but the main idea is to perform "ping ponging" to take the output of the first pass and then send ...
1
vote
0answers
44 views

HLSL: An array of textures and sampler states

The shader must switch between multiple textures depending on the Alpha value of the original texture for each pixel. Now this would word fine if I didn't have to worry about SamplerStates. I have ...
-1
votes
1answer
42 views

Is lighting different from Immediate mode rendering to VBOs?

I recently got a textured cube to render as a VBO, and I've noticed some strange things as I have been trying to incorporate lighting. Firstly, there is no difference if I comment out any lines ...
2
votes
1answer
40 views

Rendering a mesh in image viewport

I have a mesh made of nearly half to a one million vertices. I also have some 6-DoF camera poses around this mesh. At these poses I'd like to find out which of the 3D points of this mesh get projected ...
0
votes
1answer
36 views

How to texture a VBO?

I'm not sure which way is the best way to do this for my purposes. My purposes being having a textured (with an image) cube. Also, I've been following a blend of tutorials, so I'm not sure which ...
0
votes
1answer
63 views

HLSL Pixel Shader Sematics

I have a HLSl pixel shader that I'm using to create a deferred buffer, I have simplified the code to show you: struct PS_INPUT { float4 PosWVP : SV_POSITION; float4 ...
2
votes
2answers
152 views

Water silhouette shader using GLSL

I have this problem to solve using Cocos2d-x 3.x: In my game there is water represented by rectangle texture, modified by the code on the go. I also have a character moving around, rotating etc. I ...
0
votes
0answers
20 views

Shader | Special Effect - Unit selection [duplicate]

I would like to know how the shaders used to show which unit is selected are made. Here is an image to illustrate. How the merge effect of the blue circles can be achieved ? I didn't found any ...
12
votes
5answers
247 views

How to make unit selection circles merge?

I would like to know how to make this effect of merged circle selection. Here are images to illustrate: Basically I'm looking for this effect: How the merge effect of the circles can be ...
0
votes
0answers
130 views

How to pass a custom array of data to a shader

I want to know how to pass an array of data (it will be an encoded map, actually) to the fragment shader so I can query it as an array. AFAIK this is sadly not implemented in unity, so I'm looking ...
1
vote
1answer
51 views

Unity, shader, vertexID

I'm writing a shader and I just wanna ask if it's possible to get the ID of the vertex that is currently being manipulated. I read something about gl_vertexID, but I couldn't find out if that is ...
0
votes
0answers
100 views

OpenGL shading doesn't work with different projection and view matrices?

I found an online (public-domain) code to do marching cubes, and I am trying to adapt this code to work in my own project. The code uses GLUT and "older-style" OpenGL, whereas I am using GLM and ...
0
votes
1answer
144 views

GGX energy conservation

I´m trying to implement a microfacet BDRF with GGX density function in my renderer. I have read almost all the papers out there in the last week, and I have a bunch of equations that should work fine, ...
0
votes
0answers
39 views

Barycentric vertex coordinates in GLES 2.0

I have a certain set of polygons, which are stored in a vertex buffer and an index buffer. The polygons are textureless and normalless. The polygons are dynamic, their buffers get constantly emptied ...
1
vote
2answers
133 views

GLSL to Cg: why is the effect different?

With reference to this question, where I was trying to make the shader compile, I am now trying to make an effect appear. The effect can be shown here, through a GLSL shader: But when I use the ...