Tag Info

New answers tagged

0

float4 color = tex2D(s0, coords); float4 land_color = tex2D(land_sample, coords); You are sampling the "world" using the SpriteBatch quad's UV's. The blue UV's are used to sample the color-texture; the yellows are used to sample the world-texture. A Draw() parameter and/or the camera matrix is inverting the Y-axis, so it is using the bottom corner as (0,0) ...


0

I have the same issue, windows 8.1x64 R9290. The shader cannot read the length of a buffer. I got round this by creating another SSBO with containing the lengths of the Light array. I don't need to do this on Nvidia or Intel chips. Another issue is that vec3 types didn't seem to work due to memory padding, so I manually pad all data as a vec4. This ...


4

Alpha mask texture approach In case your circle would always be the same size, using a second alpha mask texture would be the way to go. You would make it a grayscale mask texture and use its value as the alpha value while drawing. Using a texture had the benefit of having anti-aliasing built into the mask (ie. at the borders of your circle, the pixels can ...


2

In order to do a glow or bloom, you generally need to start with an image, threshold it and possibly colorize it, then blur it and add the blurred version to the original. I would do this by creating a few textures and FBOs for multiple passes. Something like this pseudocode: Create an FBO Attach a texture to it to draw into Draw a textured quad with your ...


2

Treating them like shadows should work fine. -Render the world from the light(s) perspective(s) and record the distance from the light. -Render the world from the camera's point of view, then sample and compare the new distance. -For each pixel, if the world-space pixel-to-light distance is greater than the light-space pixel-to-light distance, the pixel is ...


1

I did something similar, but with edge detection algorithm. I would use the following setup: 2 frame buffers with one texture each. a vertex buffer/mesh with a full screen rectangle (-1,-1 -> 1,1) with the texture cords going from 0,0 to the texture size. one shader computing the game of life The two frame buffers are used alternating, since they can ...


0

Using the stencil buffer: When writing: dsDesc.StencilEnable = true; dsDesc.StencilReadMask = D3D11_DEFAULT_STENCIL_READ_MASK; dsDesc.StencilWriteMask = D3D11_DEFAULT_STENCIL_WRITE_MASK; dsDesc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS; //Always Pass dsDesc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_INCR; //Increment dsDesc.FrontFace.StencilFailOp ...


1

It's a problem with sorting order of the objects. Why are both shaders in "Transparent" queue? You could just change the ground shader's queue to "Geometry" and fix the problem. Do you use transparency on the ground objects? If you really need the transparent queue, you could set the queue to things like "Transparent+1" to force it render later than other ...


0

I didn't get FindNextValidTechnique to work and I resorted to ValidateTechnique instead. I used the base method ID3DXEffect::GetDesc to get effect description and then counted techniques through a for loop and checked each technique: D3DXHANDLE* pValidTechnique = NULL; for (unsigned int i = 0; i < effectDesc.Techniques; i++) { D3DXHANDLE technique = ...


0

You are most certainly trying to use your shader in SpriteBatch. SpriteBatch is setting up the shader's projection matrices, which are by convention (as MadEqua answered) called u_projTrans, not u_projectionViewMatrix (see SpriteBatch source). SpriteBatch also uses some more uniforms which you must declare (and use, so they aren't optimized away). However, ...


1

The individual invocations within a work group will be executed "in parallel". The main purpose of the distinction between work group count and local size is that the different compute shader invocations within a work group can communicate through a set of shared​ variables and special functions. Invocations in different work groups (within the same ...


1

Yes, sending your mesh data to the GL every time you render it would be very wasteful. You should only be doing that if your data has changed from one frame to another (e.g. you are computing animations in the CPU). Otherwise, you shouldn't have to re-submit data if the model/mesh was not changed. Apparently, the problem with your program is that you are ...


2

From the OpenGL wiki: The input_primitive​ type must match the primitive type used with the drawing command that renders with this shader program. Given, Unity is probably using DirectX on Windows, but the same thing should hold true. Because your shader is asking for a point, it is only taking the first point from each primitive and ignoring the rest. ...


0

Inside the trigger : then activate object renderer. Outside the trigger : then deactivate object renderer.



Top 50 recent answers are included