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

learn more… | top users | synonyms

3
votes
1answer
99 views

Why isn't my cbuffer updating?

I am really frustrated because my cbufer isn't updating. This is my VS: cbuffer MatrixBuffer: register(b0) { float4x4 worldViewProj; }; struct VertexIn { float4 Pos : POSITION; float4 Color: COLOR; ...
1
vote
2answers
102 views

How can I use an HLSL pixel shader to peek at other pixels?

I think this is like a pixilation shader but I had a hard time trying to find one online, and one that I could manipulate specifically. I want to create a pixel shader for my monogame project that ...
5
votes
1answer
1k views

How do i define array in shader's constant buffer with C#?

I am using SharpDX to render 3D graphics and i cannot get to work constant buffer in my shader since it contains an array. Currently it looks like this: cbuffer cb0 : register(b0) { matrix mWorld;...
1
vote
1answer
160 views

DX9 How to Apply HLSL Shader with StretchRect

Using DirectX 9,I'm trying to run a HLSL pixel shader on video frame data while copying it from one texture buffer to another texture buffer without displaying it. StretchRect at the end is what ...
1
vote
1answer
36 views

Check if vertex is visible in shader

Im trying to figure out when a vertex is visible from the main camera. I have this function: bool in_frustum(float4x4 M, float4 p) { float4 Pclip = mul(M, float4(p.x, p.y, p.z, 1.0)); ...
7
votes
3answers
3k views

Why can't I get a bool packed and aligned into a D3D constant buffer?

Alright, I'm having a hard time getting a bool packed and aligned into a hlsl constant buffer and I'm not sure why. Here is the buffer in hlsl cbuffer MaterialBuffer : register(b1) { float3 ...
-1
votes
1answer
52 views

Volumetric Lighting/Light Shafts in DirectX

So currently I am trying to implement Light Shafts into my DirectX Engine. I read the Nvidia GPU Gems Article (http://http.developer.nvidia.com/GPUGems3/gpugems3_ch13.html) I am new to Graphics ...
7
votes
1answer
6k views

What does ddx (hlsl) actually do?

I'm a bit confused. The official documentation (http://msdn.microsoft.com/en-us/library/windows/desktop/bb509588(v=vs.85).aspx) says that ddx(input) is the partial derivative of the input with ...
2
votes
1answer
334 views

Run HLSL in C++ Basic Sample

I'm considering the idea of taking shaders written in HLSL and running them in an AviSynth plugin to process videos. This would allow accessing various shaders, and also to have GPU acceleration. I'm ...
1
vote
1answer
76 views

Multitexturing depending on given variables?

Im having trouble with rendering multiple textures. Using XNA gamestudio: working with 3D meshes and texturing. Effect.fx HLSL I do have a map/level that loads from a heightmap. - This works I have ...
1
vote
2answers
857 views

Using Appendbuffers in unity for terrain generation

Like many others I figured I would try and make the most of the monster processing power of the GPU but I'm having trouble getting the basics in place. CPU code: using UnityEngine; using System....
0
votes
1answer
43 views

Getting the material name or index from a Blender FBX model in MonoGame

I've imported Blender FBX models in to UE4 before, so I'm aware that some of the material information is saved in the model. How do I go about accessing this in MonoGame? To be clear, I don't ...
1
vote
1answer
443 views

How can I mark a pixel in the stencil buffer?

I never used the stencil buffer for anything until now, but I want to change this. I have an idea of how it should work: the gpu discards or keeps rasterized pixels before the pixel shader based on ...
0
votes
1answer
22 views

XNA HLSL Shader Color Swapping based on lightness

I'm trying to achieve a similar effect to the image below in HLSL. [Ignore the inbetween state, currently I'm only trying to achieve the final phase, which is black and red] What I tried so far is ...
0
votes
0answers
17 views

HLSL DXGI_x_UNORM vs DXGI_x_UINT

I have a texture resource with a format of DXGI_x_UNORM I can then access the data in the HLSL using .sample or .load and it works exactly as expected. However if i simply change my format from ...
0
votes
1answer
42 views

HLSL SetVertexShader Texture2DArray Sample

I want to do some texture samples in the vertex shader, but it seems this cannot be done in the same was as when using the Pixel shader. The code is basically.. Texture2DArray gTexture; VS() { ...
2
votes
2answers
136 views

HLSL texture not reading from register S1

I made a simple post processing shader, that draws scanlines. This all works perfectly. I wanted to make it a bit more interesting by applying a shadowmask instead so I wanted to pass a texture to the ...
0
votes
1answer
48 views

Iris-wipe shader not properly working

I'm working on creating an iris wipe transition, like the ones you see in old cartoons - a fully transparent circle closes on a certain point, leaving a full screen of a solid color. Additionally, the ...
1
vote
0answers
26 views

HLSL topology mismatch question

I'm trying to write a fur shader with the shells & fins technique. Currently I receive this DirectX error D3D11 ERROR: ID3D11DeviceContext::DrawIndexed: The declared input primitive type in ...
2
votes
0answers
27 views

DirectX 11 - Problem with low resolution decals

I'm trying to add a decal system in my DirectX engine but i'm facing some problems with the quality of the textures projected. Every other no decal texture look fine, but these ones look really bad. ...
1
vote
0answers
33 views

Logical operations per component in GLSL

According to the OpenGL spec in GLSL, the logical operators: &&, || etc work between booleans, not vectors of booleans. So, what is the best way to perform the logical and/or per component in ...
3
votes
1answer
124 views

How to write a custom shader in Unity 3D that lights up a specific pixel or group of pixel?

I'm making a FPS game in Unity, and I want the environment to light up as the player is shooting on his environment. The map would be entirely put in darkness at the beginning, but as the player ...
6
votes
1answer
291 views

How to do Chromatic Aberration on a transparent background?

I have a problem with a chromatic aberration shader effect... If I produce the effect on a white background I get exactly what I want: But if I do the same effect on a transparent background I get ...
0
votes
0answers
31 views

How to do an xBR or hqx filter in MonoGame?

I have been trying to implement an HD filter (xBR or HQX) in my MonoGame game project but so far got no success. I have checked out this question, but the shaders provided in the answers don't seem to ...
0
votes
2answers
151 views

How do I build a 3D array result set from a compute shader in unity?

I took this right down to the absolute most basic scenario but for some reason I can't get anything back from the GPU when this completes, could someone explain what I am doing wrong ... Here's my ...
0
votes
0answers
46 views

Purple screen when using vertex shaders

Alright, so I've tried everything I can think of. I've put in over 10 hours into this crap, but nothing seems to work (tried multiple online tutorials as well). Always purple screen. Here is the ...
1
vote
1answer
81 views

About HLSL array packing policy

This is not a question but a confirmation if I'm correct about the behavior of HLSL arrays. I'm working with a standard lighting vertex shader, HLSL plus C++, DirectX11.1 API. For storing my lights ...
1
vote
1answer
42 views

Doubts with results of per-vertex lighting shader

I'm researching simple shaders to add to my DirectX 11 project such as a per-vertex diffuse shader plus specular reflection component. I'll begin with the results: Seems specular reflection is ...
2
votes
0answers
251 views

Schlick Fresnel Shader

I hope you are all doing ok. I have an issue with my Fresnel shader that doesn't allow the Fresnel to change as my camera moves around. I'm not sure what i'm doing wrong. I'm using glsl with the ...
3
votes
1answer
86 views

Vertex normals in the geometry shader using directx

I'm in directx 11 with the geometry shader. Is is possible to calculate vertex normals? Just one like segment per vertex? In the geometry shader? I did vertex normals per face, this is what I got, ...
1
vote
2answers
237 views

Unity, shader, vertexID

I'm writing a shader and I just wanna ask if it's possible to get the ID of the vertex that is currently being manipulated. I read something about gl_vertexID, but I couldn't find out if that is ...
2
votes
2answers
71 views

Shader models, when to use “ps_4_0_level_9_x” instead of “ps_4_0”

I've made a very simple post processing shader for my 2D game. It produces scanlines by dimming every other line. For this I use the position of the pixel on the screen. When using ps_4_0_level_9_3, ...
2
votes
1answer
72 views

DX11 Losing Instance Buffer Data [closed]

I've got a function that basically creates different instance buffers into an array for me to use in my DrawIndexedInstanced call. But when I pass the vertex buffer and instance buffer through to my ...
1
vote
0answers
33 views

HLSL Buffer<> Data Type

I'm working on converting a dx11 shader from a .fx file for use in Unity3D and I'm a little puzzled by the HLSL Buffer<> type declared in the shader. More specifically, what are these and how can I ...
-1
votes
1answer
59 views

Sampling in the Compute Shader not working

I'm trying to sample a image in the compute shader. My code is [numthreads(1, N, 1)] void VertBlurCS(int3 groupThreadID : SV_GroupThreadID, int3 dispatchThreadID : ...
0
votes
0answers
68 views

Parallax Occlusion Mapping using Shared Sampler

I'm using the Unreal Engine 4. So here is some custom node code that is supposed to achieve POM: while (i<MaxSteps+2) { texatray=dot(HeightMapChannel, Tex.SampleGrad(TexSampler,UV+offset,InDDX,...
2
votes
2answers
134 views

Draw 3D ellipse in monogame/xna

I am programming a 3d solar system (simulator). To describe the path of a planet I wanted to add 3D rectangles.. and draw them. But this ; no surprise; decreased the frame rate extremly. Also it does ...
6
votes
1answer
197 views

How can I speed up this HLSL shader?

I have written a lighting shader file that is used as the fragment shader part of a deferred lighting pipeline. Unfortunately, each iteration seems to be adding 0.5ms to my frame time, so any more ...
3
votes
1answer
75 views

2D deferred lighting calculations not working

I have the following code for my HLSL pixel shader. Modified from another post here on GameDev (Link), but I have a few problems with it: // calculate UV and get texture and normal. float2 UV = Input....
0
votes
1answer
241 views

How to Set HLSL Shader Input Textures?

Very simple question. With C++/Direct9, I'm creating a texture as RenderTarget with a full screen quad, creating a scene, setting a HLSL pixel shader, copying the image and then call Present. 1) How ...
0
votes
0answers
109 views

Monogame Vertex Shader Hassle

I'm currently creating a game in Monogame 3.4. I've written a relatively simple pixel shader in HLSL which works perfectly fine under Windows DX. When I use the same shader under Linux (OpenGL), ...
0
votes
1answer
81 views

Distance per mesh in HLSL directx

I'm subdividing a sphere so when distance gets greater, the sphere is subdivided less to save memory. The sphere changes to another sphere when the distance is 10. My problem is that only one ...
1
vote
2answers
65 views

Subdivision of a triangle in HLSL

How can I subdivide a triangle more than once. I can not use recursion as directx 11 hlsl will not allow it. Are there any links to a HLSL code. This has to be done in the geometry shader as my book ...
0
votes
1answer
80 views

Automapping of the noise texture onto 3D model

I want to apply kind of noise/dust texture to objects so it would look good, and make it without having UV mapping in models. This is because I want to have a possibility to apply this to any objects, ...
47
votes
6answers
25k views
-1
votes
1answer
163 views

Encoding Float to RG/RGBA and Blending

Encoding a float value inside a RG or RGBA texture is very interesting and useful but it is also become quite useless when you use blending as the result and the values might be altered because of ...
0
votes
1answer
36 views

XNA Texture2D Copy Error

I have a static class that I use to build a 3d character and render the results to a RenderTarget2D which I then return. I'd like to store the results for later use so I need to make a copy of the ...
1
vote
1answer
97 views

HLSL pixel inside a view (cascaded shadowmapping)

I'm figuring out shadowmapping in HLSL (see also this question). I understand that I need projection matrices for each cascading shadowmap. I use this code to create the projections: Matrix ...
16
votes
7answers
5k views

Modern Shader Book? [closed]

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 ...
0
votes
1answer
51 views

Pixel Shader from Visual Studio Graphics Diagnostics

i want to check my pixel shader variables in graphics diagnostics but unfortunately when i click start debugging in pixel history (mentioned below), a new tap will open and says source is not ...