Tag Info

New answers tagged

0

I am not super familiar with the topic but I did do a little digging for you to try and come up with some easy to understand tutorials or articles. I hope you find at least one of these useful to you. I tried to avoid links that used deferred rendering. Link One Link Two Tutorials Advanced Rendering in OpenGL Random Tutorial Website


1

I'm not exactly sure what you want to hear, but I think deferred lighting is still the best for many light sources. The way you do that is that first you gather all the geometry properties by rendering the scene without any lighting at all. You basically render the scene in 4 versions into a buffer called G-Buffer: color, normal, depth, position. You may ...


2

They are not equivalent. In the GLSL shader you use the same texture coordinate for your diffuse and normal map (gl_TexCoord[0]). In the CG shader you use separate ones (TEXCOORD0 and TEXCOORD1, which is presumably not set).


0

The trick for rapid Gaussian blurring with GLSL is to take advantage of the fact that the GPU provides linear interpolation in hardware. Therefore, you can effectively sample four 2D pixels with a single prefetch or eight 3D voxels. By deciding where to sample you can weight the output. The definitive reference is Sigg and Hadwiger's "Fast Third-Order ...


0

I'm not using a tessellation shader but I just ran a quick test trying to skip a variable past the geometry shader: // vertex shader out float foo; //[...] foo = 0.5; // ignore foo in geometry shader // fragment shader in float foo; The result was a warning and an error: WARNING: Output of vertex shader 'foo' not read by geometry shader ERROR: Input ...


0

I think you'd have to setup a seperate program object where the shader chain doesn't have a tesselation shader, but I suppose this isn't desirable most likely. Just simply letting the variables pass through the shader would be the best option I guess, I don't know about tesselation shaders specifically but if they're like the vertex shader a simple line of ...


1

I tried compiling it from the command-line as follows: cgc -profile glslf -entry FS_Main test.cg This gave the following error output: test.cg test.cg(18) : error C1066: invalid type in type constructor test.cg(18) : error C1010: expression left of ."rgb" is not a struct This immediately highlights the fact that you used texture2D on line 18 instead of ...


3

You don't need to perform backface culling manually in the geometry shader. (It's possible it could be an optimization to do so, if culling allows you to skip some expensive work in the rest of the geometry shader. But that seems unlikely to be the case.) Triangles can't have incomplete adjacency information. The vertex buffer for GL_TRIANGLE_ADJACENCY ...


2

Texture Coordinates are usually expressed in the range between [0,1]. Each (textured) vertex will have these coordinates. These coordinates are mapped to texels in the actual texture. [0,0] is the top left corner, [1,1] the bottom-right corner. When the coordinates are in a range that is multiple of 1, the texture will repeat itself. For example, for a ...


1

the limitation you're finding is somewhat related to the history of OpenGL. Prior to OpenGL 3, a fixed-function pipeline was employed. This roughly means than OpenGL would execute the exact same processing on all vertices. The only way you could modify the output was by changing the input arguments of the pipeline (vertex positions, colors, light properties, ...


2

It is possible that your issue may be due to the lack of use of the invariant qualifier in your shaders. Quote from the book OpenGL ES 2.0 Programming Guide: There is a keyword introduced in the OpenGL ES Shading Language invariant that can be applied to any varying output of a vertex shader... The issue is that shaders are compiled and the compiler ...


1

Have you verified that all variables used are initialed before using them? Using a variable that you have not yet assigned values to can cause flickering. For instance, if you have a variable that is created like this: vec4 secondaryColor; vec4 color = vec4(0.1, 0.1, 0.1, 1.0); void main() ...


1

Here is a shader that does an outline in the simplest way that I know of. It just uses the dot product of the normal and light to cutoff colors based on the normal angle. Really, I suppose the view direction should be used instead of the light position but this gives control over the direction of the edge highlighting if you want that. There are 3 color ...


2

You should generate a distance field instead of a simple mask. In each pixel in the empty area, instead of storing 0 you store the distance to the closest pixel containing terrain. So you can return a black pixel if the value is for example between 0 and 0.1. There are multiple algorithms to compute distance fields, so I let you find one that would suit ...


1

There is not THE SOLUTION when it comes to implement complex lighting. As a result I can not tell you the "usual method", but I can give you pointers in the direction. First, you want to get rid of the notion, that you have one shader and render one pass and you are done. The way multiple lights are handled is by rendering one light at a time and the ...


0

After some 12 hours spent on the problem, the solution is a combination of the two before-mentioned solutions: Vertex Shader Thanks to GuyRT's answer, I added the gl_PointSize to the Vertex Shader, which sets the size of the points. Look at his answer for more details. uniform mat4 MVP; uniform mat4 MV; attribute vec3 position; attribute ...


2

Call glEnable(GL_VERTEX_PROGRAM_POINT_SIZE); You can then write to the built in variable gl_PointSize in your vertex shader. This affects the size of the quad that will be created for the point. If you have a vertex attribute to specify the size of each point you can simply set gl_PointSize from that. The point size is specified in device pixels.


3

Yes. I would send the radius as an attribute. Which means you'll have to add it in your vertex shader, then pass it to the fragment shader as a varying. I don't know how you're storing your attributes for the particles. But I usually do this in an array of structs. That way the data is interleaved per particle. So let's say you have something like: ...



Top 50 recent answers are included