Tag Info

New answers tagged

0

Seems I found an issue - I had to change my depth stencil state to make second pass enabled, because by default second pass discarded by depth stencil state.


0

I really doubt that the depth Buffer is inaccurate, the issue is much more likely the the boxes are further than the far pane or your shader is calculating something incorrectly. Anyways XNA has built in functionality for generating a Depth Texture. RenderTarget2D shadowRenderTarget; shadowRenderTarget = new RenderTarget2D(GraphicsDevice, ...


1

The answer is spread across the following links. Due to size constraints / requirements it had to be a Buffer Texture. Overview listing of possible technologies: http://stackoverflow.com/questions/7954927/glsl-passing-a-list-of-values-to-fragment-shader OpenGL reference to Buffer Texture: https://www.opengl.org/wiki/Buffer_Texture Different question but ...


3

You're doing it wrong - very inefficiently. Instead of rendering lightsources to your "lighting framebuffer", render the lighting contribution. That would be a soft disk centered at your light source instead of a single pixel. Example disk: ... and you can render that as a sprite! (Additive blending, clamp to 1 for best results). You can now bind that ...


2

The basic difference is simple: The standard Rendering pipeline configures the GPU so it processes data as vertices, then rasterizes them into points/lines/triangles, and then processes the result as pixels which are written into a buffer using optional blending. A DirectCompute shader just takes data from a buffer and then process them in parallel to ...


0

In my game, I do this by setting UVS in vertex data and drawing a mesh for the map using texture coords from the vertex data. Basically: Create a tile map that is the same aspect ratio as the sprite sheet you are using to draw your current tile map; where each pixel represents a tile. Pass this to the shader. Create a vertex buffer that is just a mesh ...


1

Rendering is a very generic term which is basically can be defined as "creating an image", which can be, obviously, created in many ways. For example if you fill memory with color values (software rendering) it is also a "rendering". Shaders are completely other thing. They are related to how modern GPUs work. Say you want to render a triangle. You supply ...


1

Yes, you can configure your Lights to affect only certain objects, by using Layers. Assign your objects to a specific Layer (you can use an existing layer or define your custom one). Then, in Inspector pane, use Light's Culling Mask setting to set which Layers you want it to affect.


0

this is the classical use of stencil buffer. glStencilOp( GL_KEEP, GL_KEEP, GL_REPLACE ); glStencilFunc( GL_ALWAYS, 1, 0xFF ); drawQuadA(); glStencilOp( GL_KEEP, GL_KEEP, GL_KEEP ); glStencilFunc( GL_EQUAL, 1, 0xFF ); drawQuadB(); QuadA will write the stencil buffer to 1. QuadB will be drawn only where the stencil buffer is 1.


5

You can create two shaders and set the correct one from the application. Use a define to turn on/off features. GLSL both sides of the if-clause is executed Partially true. One core execute a lot of (64) with SIMD paradigms. Think about them as a vector of data and one instruction pointer (IP). In program with a branch the core can't use two IP for ...


2

You can use a Transform Feedback Buffer to output from your vertex shader, your question is not very specific though so I can't be sure if this is truly what you want to do.


4

Your graphic tool probably adds dithering (both Gimp and Photoshop does by default) which causes some pixels to be below or above the exact color value or you are using a compressed texture format which causes some pixels to have the wrong color value. There might be an option in your graphic tool or texture importer to disable dithering or compression. ...


3

Tearing is caused by the nature of step function. It outputs 0 or 1, causing pixel either to be rendered or not. If you try it with smoothstep function you will get smeared edge instead. You can fix tearing artifact by rendering a line on top of the gauge (shown in green). Render the line with the same texture attached, just without the step( code - only ...


2

In the OpenGL 3+ Core profile, the fixed function pipeline is deprecated or removed. However, all drivers by default give compatibility profiles which still have glVertex, glBegin and friends. You won't get as much performance out of these old functions (which is why they were removed), but they still work. You may use "OpenGL 3" with these old ways, but ...


1

I solved the problem by binding the atomic counter to the GL_COPY_READ_BUFFER and using glCopyBufferSubData to copy the counter to a buffer bound to the GL_COPY_WRITE_BUFFER. Then I mapped the buffer with glMapBufferRange and set Gl_MAP_READ_BIT. This seemed to sync much better and for now it is sufficient for my use. I did not test glGetBufferSubdata, but ...


0

Ok I was able to fix the issue on my own! I figured out that all color values become less as the mask blurs. So where the mask was fading out, not only were the A values fading, but the R G and B values were fading too! I'm not sure why that is, but here is the change that fixed it: sampler s0; texture textu; sampler tex_sampler = sampler_state{Texture = ...


0

My Stupid: apparently you can change the filtering mode of your textures by using: "(TextureName).filterMode = FilterMode.Point" and that will take care of this problem. Had nothing to do with the shader.


2

Set the filterMode of your textures to FilterMode.Point. This will use nearest-neighbor interpolation, which will result in blocky rendering.


1

Re-psuedo-coded: //draw pillar LightMapTexture.Clear(0,0,0,0); //Transparent everywhere spriteBatch.Begin(Immediate, Alpha); spriteBatch.Draw(Texture, new Rectangle(PillarX, PillarY, Width, Height), Color.White); //Still transparent everywhere except texture; texture may be partially transparent also customBlendState = new BlendState(); ...



Top 50 recent answers are included