A proprietary shading language developed by Microsoft for use with the Microsoft Direct3D API.

learn more… | top users | synonyms

16
votes
2answers
3k views

Best way to mask 2D sprites in XNA?

I currently am trying to mask some sprites. Rather than explaining it in words, I've made up some example pictures: The area to mask (in white) Now, the red sprite that needs to be cropped. The ...
21
votes
2answers
5k views

How do I create a wide-angle / fisheye lens with HLSL?

What are the concepts that need to be implemented in order to achieve the effect of a wide angle lens of varying extremities? Pseudocode and specific explanation referring to the various stages of ...
18
votes
12answers
6k views

What are some good resources for learning HLSL?

The last time I tried learning HLSL, I made a few shaders and mostly understood what I was doing, but I still felt like I was stumbling in the dark. Most of what I learned I got from various blog ...
18
votes
3answers
2k views

How can I create a lighting effect like this?

This is the most beautiful 2d lighting I have ever seen, and I'd like to perform lighting like this too. How do I do it? I don't care about the physics or how the particles are simulated - I only ...
14
votes
6answers
3k views

Modern Shader Book?

I'm interested in learning about Shaders: What are they, when/for what would I use them, and how to use them. (Specifically I'm interested in Water and Bloom effects, but I know close to 0 about ...
4
votes
1answer
646 views

Pass large array to pixel shader

I am trying to write a Pixelshader for a curve effect in Direct2d. A curve effect maps each color channel value to a different value by using a look up table. For this effect I would need to pass 3 ...
3
votes
1answer
3k views

SV_POSITION in pixel shader

What are the uses for SV_POSITION in the pixel shader? Previously this was the POSITION semantic and it wasn't readable in the pixel shader, but now that it is, what can it be used for? In an SM2 ...
6
votes
2answers
824 views

Rendering collections of light sources

I have a small test environment where small point lights are scattered. Players should able to collect them. The collectible lights are rendered using a simple billboard technique where two triangles ...
4
votes
1answer
232 views

How can I handle the combination of multiple shader effects?

To be able to work efficiently with effects, is there a good way to combine multiple reusable "base" effects to achieve a more complex final result? For example, say I have an effect that handles ...
4
votes
1answer
515 views

How do I achieve supersampling / anti-aliasing in pixel shaders?

I am trying to write a couple pixel shaders to apply to images similar to Photoshop effects. For example this effect: But I noticed there is aliasing in my resulting image (the above image is a ...
1
vote
1answer
842 views

2D Mask antialiasing in xna hlsl

I have two texture2d , one of these is a mask texture and have 2kind color and i use that for mask (filter) second texture2D something like float4 tex = tex2D(sprite, texCoord); float4 bitMask ...
3
votes
3answers
241 views

Does passing uniform constants from technique into shader cause branches?

I am trying to find a way to organize my evergrowing number of shader techniques/functions (I am coding in sm_3.0). One way is to do this: float4 PS_Crossroads(PS_INPUT input, uniform bool ...
3
votes
1answer
511 views

Increasing resolution of a texture?

I'm doing some experiments on my own to improve my general skills with HLSL and so forth. In other words, I'm not doing any serious game development, but only looking to expand my knowledge within the ...
2
votes
2answers
128 views

How to implement Fog Of War with an shader?

Okay, I'm creating a RTS game and want to implement an AgeOfEmpires-like Fog Of War(FOW). That means a tile(or pixel) can be: 0% transparent (unexplored) 50% transparent black (explored but not in ...
1
vote
1answer
275 views

Color grading, shaders and 3d textures

I'm trying to implement color correction with the 3d lookup table. The lookup table is actually just a 2d texture 256x16 and consists of 16 squares which one is 16x16. When it comes to rendering, I ...
1
vote
1answer
1k views

Volumetric Fog Shader - Camera Issue

I am trying to build an infinite fog shader. This fog is applied on a 3D plane. For the moment I have a Z-Depth Fog. And I encounter some issues. As you can see in the screenshot, there are two views. ...
1
vote
1answer
143 views

How to mix effects together?

Lets say I have got terrain effect, contains multitexturing, light. Now water effect. It must be different, but must be also affected by light. Other one, player effect, must also be affected by ...
0
votes
1answer
105 views

Glow with forward rendering without two passes/MRT?

I am trying to implement controllable bloom. By controllable I mean bloom that can be requested even for non-bright pixels by adding the bloom value into a model's texture channel. To do this I need ...