# Tagged Questions

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

525 views

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

### Depth of Field Blur - Weighted sampling?

I've been studying Intel's fantastic article titled "An investigation of fast real-time GPU-based image blur algorithms" (here), where-in they state that Gaussian blur would need to be customized for ...
55 views

### Spherical Area Lights do not match reference

So I'm adding spherical area lights to my application, and comparing my results with mitsuba, I am getting some differences (left is my approach, right is mitsuba - a pathtraced reference): What I ...
73 views

As irradiance map is generated for every possible normal for all the texels in environment map (as every texel act as a light source) so that we can look up irradiance map, based on normal of fragment ...
83 views

### Draw Edges in OpenGL

I use blender game engine, and blender use openGL for graphics. How can I draw lines around all 3D objects? Would this be a job for a filter? Mainly, I want my end result to look drawn. I found this: ...
96 views

### How to draw Shadow Volumes in one draw call?

I've got a simple app that draws 3D cubes using instance rendering and I'm implementing Shadow Volume. Each cube's vertex, uv, normal and index data are statically stored in 4 vertex array buffers. On ...
92 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, ...
455 views

### Ashikhmin-Shirley model implementation: ugly result

I am trying to implement the Ashikhmin-Shirley model using these formulas: This is the GLSL 1.2 fragment shader code: uniform vec4 materialAmbient, materialDiffuse, materialSpecular; uniform ...
19 views

### LibGDX: Shader files in assets - Access is Denied

I stored the glsl files in android -> assets -> shaders directory, but when I run the app, an error is displayed: Error:Gradle: Execution failed for task ':android:mergeDebugAssets'. Error: ...
69 views

I keep getting some strange errors in my Geometry shader and when I search for the cause of the errors, it returns nothing substantial. Here is the code. Shader #version 450 core layout(triangles) ...
104 views

### Particle-system in the GPU in Unity: how to load/store data from/to a texture in the shader?

I have been implementing a simple GPU-based particle system in Unity, for my current game. The setup is indeed not very elaborated: the shader receives a set of coordinates passed trough the position ...
242 views

I hope you are all doing ok. I have an issue with my Fresnel shader that doesn't allow the Fresnel to change as my camera moves around. I'm not sure what i'm doing wrong. I'm using glsl with the ...
37 views

### How can non-CG shader code in Unity be included?

In Unity shaders, #include, #define, and other preprocessor commands seem to not be able to be used outside the CGPROGRAM section of the shader. Since these are required for compiling multiple shader ...
172 views

### Unity - reconstruct position from depth

I am using Unity and I want to reconstruct position from depth and frustum corners in pixel shader. I am doing this: In my App, I calculate view-space corners of the far frustum plane and pass them ...
22 views

### Simple square vertex lifting shader

I am trying to rebuild the fur effect in Viva Pinata. Here each square becomes a pattern of fur I imagine the process to be like this... U lift one end of the triangles. Now I need to ...
37 views

### Is there a way to identify, within a shader, the current GPU thread ID?

My question is rather simple: within a shader, is there a way (that works both in DirectX and OpenGL) to retrieve the ID of the given GPU thread being executed at the given iteration? I am using ...
27 views

### DirectX 11 - Problem with low resolution decals

I'm trying to add a decal system in my DirectX engine but i'm facing some problems with the quality of the textures projected. Every other no decal texture look fine, but these ones look really bad. ...
110 views

### Subsurface Scattering - Transmittance

I have a question related to SSS and especially transmittance. I've looked at several papers about that topic, most of them from Jorge Jimenez, which are very interesting and, I admit, a bit hard for ...
48 views

I want to filter my shadow map generated by PSSM, but the problem is that I have a inconsistent filter size. The problem is that the shadow map sources rotate to find the best fit for the camera ...
143 views

### Ways to get around the limiting default terrain shaders in Unity

I am trying to use the Toon Rim Light shader for Unity however there are a few problems when trying to use any custom shaders for a terrain in Unity. The most well known is of course, that all ...
57 views

I want to implement lighting via shadowmaps. I see process as: 1) render something to RenderTexture1(size as game) 2) create RenderTexture2 (custom size) 3) add it to Image2 (custom size) 4) apply "...
78 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 ...
250 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? ...
149 views

### OpenGL: Avoid geometry shader for cubemap framebuffer

I want to render an environment map into a cubemap framebuffer but I dislike the fact, that I have to use the geometry shader to set gl_Layer because the geometry shader would be a basic passthrough ...
616 views

### How can I combine my scrolling effect with the vertex lit shader?

I want my shader to work in both Forward and VertexLit rendering modes. I'd written a texture scrolling shader, but I also want to consider lighting which is produced by Vertex lit shader. I can't add ...
94 views

### Framebuffer Heightmap Performance Problems

I am using a framebuffer to procedurally create heightmaps with perlin noise in GLSL shaders. There are two main problems that I am experiencing with this. I have a quadtree for the terrain and in the ...
478 views

### Monogame working with Krypton

I am trying to make a simple 2D game engine using Monogame and the Krypton 2.0 lighting engine. So far I have succeeded in rendering a light but I am unable to generate any shadows from any hull's. ...
569 views

### XNA 4.0 Pixel Shader 3.0 Exact Texture Lookup/Sample Issue

I am stuck on trying to solve this problem. I originally had some shaders written that worked for XNA 3.1, but after converting to XNA 4.0 they would no longer compile due to instruction counts, flow ...
342 views

### iPhone GLSL shader dynamic branching issue

I am trying to pass an array of vec3 as uniform and then iterate through them on each pixel. The size of array varies on situations so I can't make the loop with constant number of iterations. ...
313 views

### Full screen shader causes performance hit

I basically want to have a shader run that can do something like toon shading, or grayscale the whole screen, or radial lighting. To do this, I create a new bitmap each time the display resizes that ...
322 views

I have this usermap from kinect's depth data (size is 320x280) and i want to display it on my game. The problem, of course it's ugly (first image) and i want to have beautiful effect like in the ...
389 views

### Normal maps in 3dsMax - OgreMax - how to view associated tangent vectors?

Reading this post I found out that 3dsMax might not use the same tangents when rendering normal mapped objects. In my case, I was using Ogre and OgreMax to analyze results and they were very ...
18 views

### Multi Sampling in Rendering Pipeline?

I am trying to understand : How does multi-sampling rasterization effects pixel shader output? In a nutshell (i am skipping some steps to stay on point of question): Vertex data is fetched. Vertex ...
35 views

### How do I mask a height based fog?

I've been trying to implement a 3D (with the Y axis being utilized) fog of war system similar to what XCOM uses. There is only one hint that really seems to nail it, but I can't read the actual ...
24 views

### Models keep turning white - Unity 5.3.5p1

I'm using Unit 5.3.5p1 but for some reason my models randomly turn white after I build an exe to run outside the editor. The textures work perfectly fine within the editor, but as soon as I build and ...
20 views

### Keeping a mesh entirely at the GPU and changing its vertices there with a ComputeShader (Unity5)

In a Unity game I have an object whose mesh is made of around 10k vertices and I have to make changes to these vertices (position, color, etc) almost every frame. Considering that such object is ...
17 views

### Simple coherent noise function to use in a GLSL shader

I'm looking for a simple (but especially fast) coherent noise function to use it in a shader written in GLSL. I don't need it to be excessively smooth or good looking, I just need that it has the ...
17 views

### OpenGL ES 2.0 not drawing images with shadows

I'm using OpenGL ES 2 to program a simple game 2D for Android mobile phones. I'm coding the rendering portion of the software, using the GLES20 default library. All my sprites are rendered from a ...
25 views

### In Unity shaders, how is IN.worldRefl calculated?

I want to know how the world reflection vector in shaders is calculated so that I can manipulate it, but there is no documentation on what it does or how Unity calculates it. How is the reflection ...
25 views

### HLSL topology mismatch question

I'm trying to write a fur shader with the shells & fins technique. Currently I receive this DirectX error D3D11 ERROR: ID3D11DeviceContext::DrawIndexed: The declared input primitive type in ...
46 views

### Unity Shader blending colors and color values above 1

I have source images where each pixel is one of exactly 4 colors: red = (1,0,0) green = (0,1,0) blue = (0,0,1) black = (0,0,0) I'm trying to modify Unity's default sprite shader to use those ...
128 views

### How can I create a wind visual effect like Ori?

I'm working on a mobile game in Cocos2D. The game mechanic is very similar to Ori and the Blind Forest's parachute (Kuro's feather) mechanic. I want to be able to render a visual effect for wind ...
44 views

### Pixel Perfect Texture Sampling

Right now I am using the following two shaders to render a sprite from a texture used as a sprite atlas onto a canvas that has canvas_size pixels in screen coordinates. I use a static quad as input ...
13 views

### Unity: Built-In Shader Transformation Explanation Resource

I'm working on some of my first shaders and taking a look at the variables included by cginc I see this list of transformation matrices: I've watched some beginner talks and I understand what the ...
243 views

### Is it possible to use true Blinn-Phong lighting on Unity Android/IOS?

I've noticed that the Unity's Legacy Shaders/Specular shader does not work on mobiles due to the lighting model being incompatible. I then tried using the Mobile/Bumped Specular shader, but this ...
18 views

### A question about Decal projection

From my understanding, there are several different ways to implement decals, from screen space, to copying geometry, but I can never find an explination of it's math. So what exactly is the math ...
47 views

### How to have a gradient blur in objects on Unity?

This is related to a previous question I've asked here: How to blur entire scene but a specific spot in Unity? At the time I managed to solve my problem with a "hard" cutoff on the blurred and non-...
62 views

### Failed to pass uniform in Metal shader modifier

I'm trying to write a simple shader able to pass the color to be used for drawing in the fragment shader, through a uniform. I load the shader modifier and pass the uniform: let fragmentShaderPath =...