I am currently writing the positions of my geometry to the RGB channels of gl_FragColor and I would like to write 1.0 to the alpha channel if the fragment is part of geometry, and 0.0 if its empty.
Is there a simple way to tell if a fragment is geometry or not? Maybe through gl_FragCoord.z?
thanks
...
Hi,
I'm rolling a deferred shader pipe, and due to the need to keep the G-buffers in a unified format a need to compress attributes is needed. I've sadly been unable to find some good information on how this actually is done.
I have a G-buffer format that uses 16 bits per component in a fixed point format. Sadly as I target shader mode...
I'm writing a GPGPU Fluid simulation, which runs using C++/OpenGL/Cg. At the moment, the library requires that the user specify a path to the shaders, which is will then read it from.
I'm finding it extremely annoying to have to specify that in my own projects and testing, so I want to make the shader contents linked in with the rest.
...
hi,
I'm experiencing with shaders a bit and I keep getting this weird compilation error that's driving me crazy!
the following pixel shader code snippet:
DirectionVector = normalize(f3LightPosition[i] - PixelPos);
LightVec = PixelNormal - DirectionVector;
// Get the light strenght factor
...
I need a datastructure of the same size as the normal depth buffer and I need to be able to read from and write to it in a shader. Is this possible, and what does this datastructure look like?
...
I know that Silverlight doesn't directly support the WPF bitmap effects, but I also know that Silverlight 3 supports HLSL shaders. Would it be relatively simple to write a bevel effect, ilke the one in WPF, and if so, can somebody recommend a good resource to learn how to do it?
...
I wondering if there is a way to optimize this vertex shader.
This vertex shader projects (in the light direction) a vertex to the far plane if it is in the shadow.
The aim of this shader is to create a shadow volume object that enclose the shadow of the object itself.
void main(void) {
vec3 lightDir = (gl_ModelViewMatrix * gl_Vertex ...
According to the pixel bender specs a shader can have one or more outputs. The pixel bender toolkit, whose "export to flash" option tends to be preety strict about the flash specific do's and dont's, would even compile such a shader without complaints.
However actionscript's shader related classes seem to be geared toward single output ...
Hi,
I want to be able to calculate the direction of a line to eye coordinates and store this value for every pixel on the line using a vertex and fragment shader. My idea was to calculate the direction gradient using atan2(Gy/Gx) after a modelview tranformation for each pair of vertices then quantize this value as a color intensity to pa...
I have a standard 800x600 window in my XNA project. My goal is to color each individual pixel based on a rectangle array which holds boolean values. Currently I am using a 1x1 Texture and drawing each sprite in my array.
I am very new to XNA and come from a GDI background, so I am doing what I would have done in GDI, but it doesn't sc...
Hi,
I have two textures generated using a fragment shader. I want to be able to count the number of texels in each texture that are above some colour intensity. My question is how can this be done? My initial thought is to count these texels using the fragment shader before generating the texture. However, this would require some sort of...
Hi,
Is there a way to achieve this (OpenGL 2.1)? If I draw lines like this
glShadeModel(GL_FLAT);
glBegin(GL_LINES);
glColor3f(1.0, 1.0, 0.0);
glVertex3fv(bottomLeft);
glVertex3fv(topRight);
glColor3f(1.0, 0.0, 0.0);
glVertex3fv(topRight);
glVertex3fv(topLeft);
.
.
(draw a square)
.
.
glEnd();
I get the desired...
If I have an OpenGL texture, and I need to perform HSL modifications on it before rendering the texture, from what I've heard I need a shader. Problem is, I know nothing about shaders. Does anyone know where I would need to look?
I want to write a function where I can pass in a texture and three values, a hue shift in degrees, and sat...
I'm trying to wrap my head around shaders in GLSL, and I've found some useful resources and tutorials, but I keep running into a wall for something that ought to be fundamental and trivial: how does my fragment shader retrieve the color of the current fragment?
You set the final color by saying gl_FragColor = whatever, but apparently th...
I'm trying to port some image interpolation algorithms into HLSL code, for now i got:
float2 texSize;
float scale;
int method;
sampler TextureSampler : register(s0);
float4 PixelShader(float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
{
float2 newTexSize = texSize * scale;
float4 tex2;
if(texCoord[0] * texSize[0] > ...
I was following this tutorial using Apple's OpenGL Shader Builder (tool similar to Nvidia's fx composer, but simpler).
I could easily apply the filters, but I don't understand if they worked correct (and if so how can I improve the output). For example the blur filter: OpenGL itself does some image processing on the textures, so if they...
Hello all,
I have 2 HLSL ps2.0 shaders. Simplified, they are:
Shader 1
Reads texture
Outputs colour value based on this texture
Shader 2
Problem: Need to read in the colour from Shader 1
Outputs the final colour which is a function of the input colour
(They need to be different shaders as I've reached the maximum vertex-shader ...
What would you call the effect applied to the backgrounds in the Giygas fight of Earthbound, and the battle backgrounds in Mother 3? This is what I'm talking about.
http://www.youtube.com/watch?v=tcaErqaoWek
http://www.youtube.com/watch?v=ubVnmeTRqhg
Now anyone know how I could go about this without using animated images, or using ope...
Is there a way to create a plasma effect in SFML that doesn't slow my framerate to a crawl?
...
In WPF, I want to use a pixel shader to modify a composite image i.e. a new image overlaid on top of a previously shaded image. The new image comes in as a largely transparent image except where there is data (think mathematical functions - sine wave, etc). Anyway this process needs to repeat pretty rapidly - compose the currently shad...