hlsl

Real HLSL IDE/debugger

Are there any IDE's for developing HLSL code? The three key features I want are: 1) syntax highlighting 2) auto-complete 3) interaction debugging Visual Studio doesn't do any of these things, and it doesn't seem that RenderMonkey or FX Composer do either. Is there some IDE that I'm not aware of, or does one of these three IDE's actual...

At what point do MaxTextureRepeat limitations come into play?

When executing a pixel shader under Direct3D, do the limits on texture coordinates imposed by MaxTextureRepeat only become an issue during calls to texture lookup functions such as Tex2D(), or do they come into play anytime the texture coordinates are accessed within the shader? I wish to know whether it's possible to avoid the MaxTextu...

Is there any GLSL's ftransform() translation in HLSL?

Hello there! When using GLSL vertex shaders, a way to let the shader work as a fixed-function pipeline is to call the: ftransform(); function. Is there a similar function for HLSL's vertex shaders? Thank you ...

Is there an HLSL plugin available for Visual Studio 2005?

Something that at least would add code syntax coloring? HLSL 3 preferably. ...

Regarding Image Based Lighting in GPU Gems 1

Does anybody know what the nearT value corresponds to in the pixel shader? Bjorke doesnt explain it anywhere in the article. Also, there is a line; float c = dot(IN.LightingPos,IN.LightingPos) - 1.0; that I am not quite sure what the purpose of this would be. Is this actually a typo in the article? ...

WPF or Silverlight 3 Pixel Shader for Stippling Effect

Can anyone recommend an algorithm for a HLSL Pixel Shader (for WPF or Silverlight 3) to do a stippling effect? Here are some examples: http://www.nolinovak.com/, http://sprouls.com/ ...

Multiple Rendertargets in DX9

I've set m_lpD3DDevice->SetRenderTarget(0,Buffer1); m_lpD3DDevice->SetRenderTarget(1,Buffer2); m_lpD3DDevice->SetRenderTarget(2,Buffer2); and if I render the pixelshader only affects the first render target. It's output structure is struct PS_OUTPUT { float4 Color0 : COLOR0; float4 Color1 : COLOR1; float4 Color2...

Is it possible to use a shader to find the "difference" between two textures? (XNA/HLSL)

I have made a simple webcam based application that detects the "edges of motion" so draws a texture that shows where the pixels of the current frame are significantly different to the previous frame. This is my code: // LastTexture is a Texture2D of the previous frame. // CurrentTexture is a Texture2D of the current frame. // Differenc...

Deferred Shading DirectX demos?

I've been reading a lot about deferred shading and want to try and get into it. Problem is I can't find a sample which demonstrates how deferred shading can support so many lights simultaneously - I found one demo which was very simple with a single light in Code Sampler and an nVidia HDR sample butnothing beyond that. Would anyone know...

'D3DRS_SEPARATEDESTALPHAENABLE' : undeclared identifier - even though it's mentioned in the DirectX comments?

In d3d9types.h in the _D3DRENDERSTATETYPE struct the last 3 types are: D3DRS_SRCBLENDALPHA = 207, /* SRC blend factor for the alpha channel when D3DRS_SEPARATEDESTALPHAENABLE is TRUE */ D3DRS_DESTBLENDALPHA = 208, /* DST blend factor for the alpha channel when D3DRS_SEPARATEDESTALPHAENABLE is TRUE */ D3DRS_BLEN...

Real time dynamic shadows to compliment deffered shading?

I currently have a deffered rendering system setup and can render point lights and directional lights. My question is what are my options for different forms of shadowing which can make shadows based on point lights and directional lights which can maybe make use of a deffered shading setup? ...

HLSL Compiler error?

float4x4 matInvViewProj; float4 GetPointPosition(float2 Tex0) { float4 PosImageSpace; PosImageSpace.xy = float2(Tex0*2-1); PosImageSpace.z = tex2D(DepthTextureSampler,Tex0).r; return mul(PosImageSpace,matInvViewProj); } That's a part of my pixelshader. Why is there a compiler error? I'm compiling it in ps_3_0. Without ...

Matrix multiplication - view/projection, world/projection, etc

In HLSL there's a lot of matrix multiplication and while I understand how and where to use them I'm not sure about how they are derived or what their actual goals are. So I was wondering if there was a resource online that explains this, I'm particularly curious about what is the purpose behind multiplying a world matrix by a view matri...

What are all the different HLSL sampler types for?

I'm working with DX9/SM3 at the moment, and the MSDN documentation on HLSL samplers seems to be sorely lacking in explaining how to use the different sampler types. What's worse is they try to cover DX9 and DX10 in a single article, so they jumble together all the keywords: sampler Name = SamplerType { Texture = <texture_variable>; [...

Problem with HLSL looping/sampling

I have a piece of HLSL code which looks like this: float4 GetIndirection(float2 TexCoord) { float4 indirection = tex2D(IndirectionSampler, TexCoord); for (half mip = indirection.b * 255; mip > 1 && indirection.a < 128; mip--) { indirection = tex2Dlod(IndirectionSampler, float4(TexCoord, 0, mip)); } return in...

Reading output from geometry shader on CPU

Hi, I'm trying to read the output from a geometry shader which is using stream-output to output to a buffer. The output buffer used by the geometry shader is described like this: D3D10_BUFFER_DESC vbdesc = { numPoints * sizeof( MESH_VERTEX ), D3D10_USAGE_DEFAULT, D3D10_BIND_VERTEX_BUFFER | D3D10_BIND_STREAM_OUTPUT, ...

Comparsion between Pixel Bender(in Flash) and Pixel Shaders(in Silverlight)

Can someone explain the different between Pixel Bender in Flash and Pixel Shader(HLSL) in Silverlight in terms of programming flexibility and run-time performance? ...

HLSL Pixel Shader - Change Image Color For Specific Hue

I'd like to write a pixel shader that takes an input image, and converts all of the colors of one Hue range (i.e. HSV) into another Hue Range. My motivation is simple: I want to color a bunch of different textures differently, but i don't want to color the entire texture, just the portion with a hue in a specific range. That way, I can...

Given normal map in world space what is a suitable algorithm to find edges?

If I have the vertex normals of a normal scene showing up as colours in a texture in world space is there a way to calculate edges efficiently or is it mathematically impossible? I know it's possible to calculate edges if you have the normals in view space but I'm not sure if it is possible to do so if you have the normals in world space...

Normalizing from [0.5 - 1] to [0 - 1]

Hi all, I'm kind of stuck here, I guess it's a bit of a brain teaser. If I have numbers in the range between 0.5 to 1 how can I normalize it to be between 0 to 1? Thanks for any help, maybe I'm just a bit slow since I've been working for the past 24 hours straight O_O ...