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
68 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
479 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
25 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
454 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
43 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
72 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
56 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
1answer
59 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
49 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
43 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
39 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
79 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
179 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
269 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
176 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
60 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
128 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
187 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
41 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
138 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 ...
1
vote
1answer
63 views

D3D11 shader signature validation with SV semantics

I'm trying to figure out what the rules are for linking the outputs of one shader stage to the inputs of the next. Since D3D11 does not have any error checking for linkage between shader stages, I ...
0
votes
2answers
78 views

Blood particles system,join particles

Does anyone know how the particles behave in the following picture? Let me explain,before the particles join they seem to be just simple textures of blood drops with a black border around them ...
2
votes
2answers
87 views

Palette reduction to pre-defined palette

I'm writing a bunch of GLSL effects for fun, but I can't wrap my head around this. Basically, I want to reduce a texture's palette into a pre-defined set of colors. For example, a post-processing ...
0
votes
1answer
94 views

How to fix this existing shadow shader/material with alpha textures?

I hope I could get some help here in finally resolving this problem of mine re: shadow casting with alpha textures. Here's a screenshot on what I am hoping for as a result: A friend of mine just ...
1
vote
1answer
87 views

Replace each white spot of image to radial gradient

Recently, I read an article about a sun shader (XNA Sun Shader) and decided to implement it using OpenGL ES 2.0, but I encountered a problem with the shader: I have two textures, one of them is the ...
0
votes
0answers
40 views

Using a Quad to cut out a Layer?

Looking for options on this, but I wanted to take a Quad (or other shape), apply a material to it, and have it cutout an entire layer, to reveal the layers below/behind it. Sort of like a portal ...
1
vote
2answers
81 views

Should I shade models before or after importing them into Unity?

Is it better to shade a model inside the 3D modeling software or inside Unity? As an example, if I need to use a transparent model, should it be made transparent inside the modeling application or ...
0
votes
1answer
100 views

Skybox: OpenGL texCUBE vs a textured cube

In OpenGL, the typical way that I've seen to set up a skybox using cubemapping is to create a cube in camera space, prepare a cubemap sampler with the appropriate six-sided texture, and then in the ...
2
votes
1answer
126 views

How does the GPU know how to form triangles for a given mesh?

I have just begun learning shader programing. What I learned is that the rasteriser groups three vertices to form a triangle for doing further operations. If that's true how does the rasteriser ...
1
vote
2answers
141 views

Implementing directional lighting in voxel based polygon-engine

I'm having trouble implementing directional lighting. (I'm not that familiar with 3D.) The problem is that the lighting does not "follow/flow with" the other blocks next to them. How should I fix ...
0
votes
1answer
168 views

Issues compiling .fx shader to MGFX

I've been trying to port Catalinzima's 2D lighting example over to MonoGame to try and get some basic understanding around it and adapt it for use in my engine. I've been trying to convert the two .fx ...
0
votes
1answer
88 views

What coordinates are we passing to pixel shader from vertex shader?

I have read articles about shader programing and understood the very basic knowledge of shader programing. One thing I always get confused is about the texture mapping. What I pass(output) from VS to ...
-2
votes
1answer
90 views

Texture Stretching on VBO cube

I'm using JOGL and I'm trying to render a textured VBO cube with glDrawArrays. The cube renders, but the texture is stretched and stripy as seen in the picture above. It seams that changing my ...
3
votes
1answer
213 views

How can I determine the extreme color values in a texture?

I am looking for a way to determine the most extreme color values for all of the texels in a texture. So for a texture consisting only of black and white texels, the extreme values should be (0,0,0) ...
8
votes
1answer
126 views

How can I profile the speed of my vertex and fragment shaders separately?

I'd like to know how I can check to see if either my vertex or my fragment shader is a bottleneck in my rendering pipeline. I've read about using glQueryCounter with the GL_TIMESTAMP target to get ...
0
votes
1answer
65 views

What are mental ray shaders and can I use them in my own game?

I'm using the FBX SDK to import and display FBX models in my OpenGL app. It works fine so far with a simple phong shader and displays basic models. However I have some FBX models that have custom ...
11
votes
1answer
1k views

Is a Gaussian blur a fairly accurate representation of soft shadow edges?

I'm not sure if real life soft shadows (from close,large light sources) have a Gaussian or linear falloff, or something else. I'm working on something where I can create the shadows by manipulating ...
1
vote
2answers
110 views

Bad pixels on shader when loading cached binary programs

I have been trying to cache binary shader programs in my game and load them accordingly using "glGetProgramBinaryOES" and "glProgramBinaryOES" respectively. I was successfully able to cache and load ...
7
votes
1answer
164 views

Slow uniform array in shader causing FPS drop

I'm trying to use an uniform array of matrices in my compute shader. However, it's really slow. I've narrowed it down to this lines of code: uniform mat4 someMatrixArray[64]; ... vec4 result = ...
1
vote
0answers
53 views

Compute min/max position of tile in compute shader

I'm trying to implement tiled deferred lighting with OpenGL compute shaders. For that, I need to compute the minimum and maximum position of each tile. My first approach was to use atomicCounters ...
0
votes
0answers
18 views

Shader: vertex manipulation basics [duplicate]

I know this is a very noob question, but please bear with me I'm very new to graphics programming (I come from an iOS and web app development background). When you modify the position of a vertex ...
0
votes
1answer
201 views

Projective texturing and falloff

I quite understand how projective texturing works. I implemented successfully a shader for that following nvidia doc. The major problem I'm facing is that with that implementation the projector ...
1
vote
2answers
94 views

Accessing uniform variables from a Cg shader in OpenGL

I am trying to implement a simple PC program with OpenGL, using mandatorily Cg shaders (no Unity whatsoever). I have found some tips on this page http://bobobobo.wordpress.com/2008/10/05/cg-1/ and ...
0
votes
0answers
45 views

Transform texture coordinates when using shader

Assuming I define four vertices of a quad with texture coordinates that cover a whole texture or region of a texture, I can animate these coordinates by setting a transform using SetTransform( ...
0
votes
0answers
96 views

How to add a flashlight in libgdx?

So I want to add a flashlight to the game when the game starts to get darker which I already have working. I bound a light texture to the batch and the first problem is that for some reason the ...
0
votes
2answers
291 views

Texturing a VBO cube (JOGL)

I've been having trouble texturing a cube using vertex buffer objects. EDIT: I updated/replaced my shaders to fit the right version. The program compiles and links, but it shuts down java in ...
0
votes
1answer
105 views

One draw call with one big mesh VS many draw calls with many little meshes

I have read that in order to optimize WebGL application, one should reduce an amount of draw calls. But does it mean that computing a one big mesh from all single meshes on CPU by modifying vertices ...
0
votes
0answers
127 views

MonoGame: Can't compile effect

I'm having trouble compiling a very simple pixel shader using the content pipeline in MonoGame 3.2. Whenever I compile the shader using "ps_3_0" it works but when I try to load it using the ...
2
votes
2answers
130 views

Problem draw SkyBox behind my sun - XNA

I try to create a small and simple 3D games on XNA. I recently started to add a skyBox after added a sun in my game with the sample by Microsoft here ...