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)

3
votes
1answer
145 views

Spritebatch Vertex shader world matrix change after each draw

I have a spritebatch where I draw some textures transformed in 3d space. The easy way was just Begin with the transformation matrix, draw, and end it right after. But that is silly, so I'm trying ...
0
votes
3answers
113 views

How necessary are shader coders? [on hold]

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
1answer
74 views

translate-scroll repeated 2d texture using opengl shader

I managed to implement an infinite 2d texture scrolling using the following shader. btw I'm using cocos2d-x 2.2.1. The vertex shader: attribute vec4 a_position; attribute vec2 a_texCoord; #ifdef ...
0
votes
1answer
107 views

Using Appendbuffers in unity for terrain generation

Like many others I figured I would try and make the most of the monster processing power of the GPU but I'm having trouble getting the basics in place. CPU code: using UnityEngine; using ...
0
votes
0answers
21 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 ...
2
votes
1answer
69 views

Using normals in DirectX 10

I've got a working OBJ loader that loads vertices, indices, texture coordinates, and normals. As of right now it doesn't process texture coordinates or normals but it stores them in arrays and creates ...
1
vote
1answer
294 views

Fog shader camera problem

I have some difficulties with my vertex-fragment fog shader in Unity. I have a good visual result but the problem is that the gradient is based on the camera's position, it moves as the camera moves. ...
1
vote
1answer
133 views

Alpha Blending: use the pixel with the smallest alpha

I'm writing a transparency shader where I need any intersecting textures to, wherever they overlap, take the texture pixel with the smallest alpha value and render only that, discarding the other ...
6
votes
1answer
120 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 ...
2
votes
1answer
62 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
37 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 ...
3
votes
1answer
84 views

Surface normal to screen angle

I've been struggling to get this working. I simply wish to take a surface normal and convert it to a screen angle. As an example, assuming we're working with the highlighted surface on the sphere ...
1
vote
2answers
94 views

Does GLSL copy function arguments by value?

My question is about passing variables to GLSL shader. I'm not sure how that works and what are the performance implications. Say I got a function that accepts a "vec4" variable. The question is - is ...
1
vote
1answer
45 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
618 views

how to modify shadow mapping in “3D Graphics with XNA Game Studio 4.0”? [closed]

So I've been following the tutorials from the book Sean James's "3D Graphics with XNA Game Studio 4.0", and have been doing fine until i reached the shadow mapping part. in this book it creates point ...
2
votes
0answers
653 views

2D water shader in SFML

I want to implement the algorithm for a 2D water surface described here and here. Before somebody finds out, beats me up and deletes this, I'm gonna say it myself. I posted this question over at ...
2
votes
0answers
164 views

How to create heat haze effect in Libgdx?

I would like to create a heat haze effect for a 2D game I am making. Do You have ideas or suggestions, how to get that effect. I am using Libgdx(OpenGL 2.0). Thank You in advance!
3
votes
0answers
134 views

Optimizing parallax effect with multiple transparent layers?

I have a parallax effect in MonoGame that consists of multiple semi-transparent layers of textures. The effect is really simple but rendering multiple transparent layers on top of each other is rather ...
1
vote
2answers
84 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
128 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 ...
3
votes
1answer
525 views

Shadow mapping does not work correctly using GLSL shaders

I'm a beginner in shadow mapping. I have in my scene two meshes : a cube and a floor. The scene is lighted by a single point light. Here's for the following display the light properties : ...
0
votes
1answer
98 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
64 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 ...
0
votes
1answer
49 views

Surface shader ignores lighting in vertexLit path

I want to use a surface shader in VertexLit(not Forward) rendering path. I caused a problem that the compiled shader completely ingnores lighting from the light sources on the scene. Here's the code: ...
2
votes
1answer
40 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 ...
5
votes
3answers
218 views

How do I send multiple matrices to a vertex shader?

I'm practising animations using bones/skinning. I am trying to send the shader one matrix per vertex. I can think of these two approaches. Method 1 I have one uniform handle for each bone matrix ...
2
votes
1answer
223 views

How to outline a 3D object with a cartoon style stroke? [duplicate]

How could I draw (stroke) the outline of a 3D object in a cartoon style with GLKit? I'm referring to something like this: However we can start with a simple line around the object and then try to ...
1
vote
1answer
298 views

Driver error when using multiple shaders

I'm using 3 different shaders: a tessellation shader to use the tessellation feature of DirectX11 :) a regular shader to show how it would look without tessellation and a text shader to display ...
0
votes
1answer
42 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
47 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 ...
2
votes
1answer
118 views

How do I use unpackHalf2x16?

I'm trying to use (un)packHalf2x16, without success so far. I'm drawing with: glVertexAttribIPointer(0, 2, GL_UNSIGNED_INT, 0, 0); glEnableVertexAttribArray(0); glBindBuffer(GL_ARRAY_BUFFER, vbo); ...
2
votes
1answer
220 views

Directx 11: emulating palette swapping with shader 5.0 and c++

i'm trying to swapping the colors using a texture as index and a second one as palette. Here is the full listing of the code: #include <windows.h> #include <windowsx.h> #include ...
1
vote
1answer
63 views

Blinn, Normal maps & Fresnel?

So something came up today when I was going over my Blinn shader. As I've been taught, the half-angle vector is calculated in the fragment shader, and is equal to normalize(lightDir + viewDir). This ...
0
votes
1answer
63 views

How do I pass an object location into a vertex shader?

I am using Blender Game Engine. I want to create a large flat plane, and deform it locally near a moving object. So far (despite being a beginner at shaders) I've written a vertex shader for the ...
5
votes
3answers
762 views

Does Unity's “Transparent Bumped Specular” translate to “semi-shiny must be semi-transparent”?

Unity's documentation for the "Transparent Bumped Specular" shader/material-type is simply a concatenation of each of the descriptions for its Transparent and Specular Shaders (and also Bumped, but ...
1
vote
1answer
57 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 ...
0
votes
1answer
41 views

Merging several textures into one using RGB channels

Would it be possible to place a texture into each RGB channel? Example: Red = wood.png Blue = tiles.png Green = metal.png The advantages I could see are saving space, memory and draw calls and the ...
2
votes
1answer
78 views

Is it ok to mix shader types?

The title might not be precise. Let's say I have one material consisting of vertex and pixel shader, another one consisting of vertex, geometry and pixel shader, and yet another one consisting of ...
0
votes
1answer
273 views

Using Shader causes triangle to disappear

The following is my rendering code. Private Sub GameRender() GL.Clear(ClearBufferMask.ColorBufferBit + ClearBufferMask.DepthBufferBit) GL.ClearColor(Color.SkyBlue) ...
-1
votes
0answers
37 views

Applying custom effect from nVidia Shader Library [closed]

I'm quite new to XNA 4.0. I'm trying to apply an effect I downloaded from nVidia Shader Library, it's called post corona. I'm facing two problems, and I can't find any "compatible" examples or help ...
0
votes
2answers
112 views

Rendering terrain only with GPU

This is not about generating plane geometry and then applying a shader on it. Instead, I want a big single flat plane, then apply a shader on it. The vertex shader has a uniform vec3 ...
0
votes
0answers
53 views

Finding the correct transformation in vertex shader for easy sprite drawing

Before we begin the question: Here are the necessary meta information: I want to use JOGL / OpenGL to create a library that is only, and I repeat only, able to draw and manipulate 2D sprites on a 2D ...
10
votes
2answers
286 views

Refractive glass shader

I have an infinite hexagonal floor, generated by tessellating a point grid in a tessellation shader pair: Note that this is a flat wireframe - the "shadows" are a lighting trick: Now, I'd like ...
0
votes
1answer
44 views

How to change colors of texture in lwjgl? [duplicate]

I have the following texture: The black pixels are characters, the background is transparent. How do I change the black pixels of the characters to another color? I use this texture as a bitmap for ...
1
vote
0answers
46 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 ...
1
vote
0answers
61 views

Normal mapping does not work correctly using GLSL and OpenGL

Hello I wrote a simple OpenGl program using GLSL to render a simple uv mapped plane using the normal mapping technics. Here's the display with a simple phong shading (without normal mapping) : Now ...
8
votes
3answers
861 views

Is multitexturing really just “using more than one texture”?

This might seem stupid, but it bugs me. From what I understand, multitexturing is just using more than 1 texture per shader (usually to blend them somehow). So instead of creating 1 texture, I create ...
0
votes
2answers
223 views

Which code is faster to convert -1 to 0 and 1 to 1?

I'm writing a shader for rendering the sides of triangles with different colors. I have a value mediump float back = dot(V, N) which is positive if the normal faces away from the camera and negative ...
0
votes
2answers
161 views

How to mix pixel colors in Shader?

I have a pixel that have a colour RGB. This color is calculated by the shader and can be anything. How can I override this color by a colour I choose. If my pixel is white it's simple, I can do this: ...
2
votes
2answers
85 views

How can I calculate spotlight lighting in Vertex/Fragment shader in Unity?

I've written a vertex/fragment shader for my game. It uses 3 textures and represents a floating water on the wall (so I have 1 texture for water, 1 for geometry and the last one is mask) so it looks ...