A proprietary shading language developed by Microsoft for use with the Microsoft Direct3D API.
0
votes
1answer
23 views
Directx 11 How to set Texture2D in constant buffer
I have a texture2D packed within my constant buffer. how do i set the texture using ID3D11DeviceContext::UpdateSubresource or another method?
1
vote
1answer
48 views
Accessing cbuffer values in other functions
I have a shader that is not loading correctly and causing my Vertex Shader object to be a nullptr and Visual Studio is throwing an exception. The specific issue that is occurring is at the following ...
1
vote
1answer
25 views
Passing Matrix to shader
I am learning HLSL and having trouble understanding how to pass matrices into the shaders to be able to perform the necessary operations within the shader to have the position values sent to the ...
3
votes
2answers
56 views
Skip processing individual triangles or vertices of the mesh
In my game I have a billiard table, and a floor below the table. In typical situation the table covers 80% of the screen, so only small amount of the floor is visible. And I render the table first, so ...
1
vote
1answer
41 views
I don't think my shaders are working, looking for help
Using sharpdx(directx 11) developing on UWP.
This is a link to a previous question of not being able to compile the shader files(written in hlsl) How to compile shader files in UWP Later I have found ...
0
votes
3answers
66 views
How to compile shader files in UWP
I wish to use this method
byte[] vertexShaderByteCode = ShaderBytecode.CompileFromFile(".......Transf_VS.hlsl", "VS", "vs_5_0");
this.vertexShader = new D3D11.VertexShader(
...
0
votes
2answers
34 views
Why is my Direct3D 9 floating point texture clamping values 0–1?
I'm using Direct3D 9 to draw some primitives into a texture. The format used at texture creation is D3DFMT_A16B16G16R16F, and the primitives are drawn using additive blending. The additive blending ...
0
votes
2answers
32 views
HLSL mipmapping not working
I want to implement a mipmap filter in my 3D game, so that textures which are located far away are using a lower resolution than the original.
For the shader I'm using hlsl version 4_0_level_9_1 or ...
1
vote
1answer
67 views
Texture coordinates projection
I have some classic texture coordinates and as a normal behaviour they follow the mesh's transformations.
I am trying to use the same texture coordinates behaviour but without being affected by the ...
0
votes
1answer
38 views
Texture color change not working on custom effect [Monogame] [C#]
I'm new to custom effects (ex. pixel shaders) in monogame, but I've researched a bit and made some test effects.
I've noticed that the color variable "Color.[color]" doesn't change the color of the ...
0
votes
2answers
90 views
Determine the z coordinate of a deformed plane based on uv (xy) coordinates
I am using a formula to turn the following texture
into what looks like two 3 dimensional planes
The formula I am using for the texture deformation is
float2 texUV = float2(uv.x / abs(uv.y), (1.0 / ...
1
vote
0answers
72 views
Easiest way of adding screen space reflections?
I wish to add a cheap and easy method of screen space reflections to my game but am struggling to find examples that are easy for a beginner to understand. I'm still very new to HLSL. Any help would ...
1
vote
1answer
58 views
Softshadows create graphical errors
I have been implementing soft shadows into my game engine and it all looks ok in the beginning, but when I rotate the camera I get this...
https://puu.sh/rQ7yG/8cd692aaab.png
When I move around I also ...
0
votes
1answer
75 views
Eye Parallax Refraction Shader
I am trying to implement the Parallax Refraction effect explained by Jorge Jimenez on this presentation: http://www.iryoku.com/downloads/Next-Generation-Character-Rendering-v6.pptx and I am facing ...
0
votes
0answers
37 views
Faster way to do multi texture blending(HLSL, triplanar texturing and overhang mapping)
Right now I'm doing a lot of lerping to blend my textures based on height(under water, mid ground and height ground), normal.y >= 0.0 for the under side of the terrain, fractal blend map for a marble ...
0
votes
1answer
66 views
Specular Lighting Error
At the moment I am implementing Specular Lighting for my engine in DirectX on top of Diffuse Lighting. I am using a physically based technique and as you can see from the image below something is ...
0
votes
2answers
93 views
Having problems sending multiple lights to my shader
I have a lightstruct in C++ which holds the color and direction of the light.
const int NUM_LIGHTS = 1;
struct lightStruct {
XMFLOAT4 Color;
XMFLOAT4 Direction;
};
And this is how I ...
0
votes
2answers
80 views
Debugging .FX files in Visual Studio not working
So I have been learning how to use DirectX 11 for a while now and I have chosen to use the .FX framework rather than seperate .vs & .ps files. (I know it's deprecated but I found it a little ...
0
votes
1answer
43 views
Cbuffer Packing
So I recently had this error: Cbuffer Padding Error
Which has led me to ask this question. Can somebody explain packing/padding in a Buffer for DirectX? I cannot get my head around it, rather than ...
0
votes
1answer
65 views
Cbuffer Padding Error
In my cbuffer in DirectX, I send 2 variables over to my HLSL shader called Light & Roughness. If I remove the Roughness variable my program compiles fine but as soon as I introduce Roughness I get ...
0
votes
1answer
78 views
HLSL Function Problem
Right now I am trying to implement Specular lighting in my DirectX Engine.
Whenever I create the DirectSpecularBRDF function in my .HLSL file, my program crashes. Can anybody help me? The problem is ...
0
votes
1answer
28 views
Problem with Basic Diffuse Lighting
So recently I have been learning how to implement Diffuse Lighting in DirectX and I have done so with the following code:
float4 PS(VS_OUTPUT input) : SV_TARGET
{
input.normal = normalize(input....
0
votes
0answers
45 views
Using typed buffers with the compute shader (HLSL, C++)
I've been using Introduction to 3D Programming by Frank Luna to introduce myself to graphics programming. In the compute shader chapter exercises, we're asked to make a program to input 64 vectors and ...
3
votes
2answers
39 views
How to force XNA to render model very far away as a light dot?
Making a space strategy game focusing on commanding a large fleet, with 1000+ ships per side.(I'm new in XNA 3D...below is a test screenshot. The ships will be scaled down another 2-5 times) When a ...
6
votes
1answer
208 views
What are screen space derivatives and when would I use them?
I see the ddx and ddy glsl functions and the hlsl equivalents come up in shader code every now and then. I'm currently using them to do bump mapping without a tangent or bitangent but I basically copy-...
1
vote
2answers
79 views
Problem with Diffuse Lighting
So I am currently implementing Diffuse & Ambient Lighting based off this tutorial:
https://www.braynzarsoft.net/viewtutorial/q16390-simple-lighting
I think I have implemented everything correctly,...
2
votes
2answers
76 views
Why does VertexPositionColor seem incompatible with Monogame?
This question is a continuation of What causes this InvalidOperationException when drawing primitives?.
I've been dealing with HLSL shaders in Monogame over the past few days. It has been extremely ...
0
votes
2answers
49 views
What causes this InvalidOperationException when drawing primitives?
I'm working on implementing a 2D masking effect in my current game. To do so, I have two textures, one for the source image and one for the mask. The source image is just a regular texture, so that's ...
1
vote
1answer
71 views
HLSL texture sampler always returns white
I'm facing in problem in HLSL with Monogame that I can't figure out. The gist is that sampling from a texture seems to always return white rather than the texture's actual color. My pixel shader code ...
-1
votes
2answers
72 views
How do .HLSL files work together compared to .FX?
So I have been slowly reading and working through Frank Luna's D3D11 book which uses the .FX file format which uses effects, techniques and passes which I understand now. However I have read online ...
1
vote
1answer
47 views
How do multiple shaders in a DirectX Engine work?
So as I have been learning DirectX 11, I have been looking at a few tutorials online and in the sample code provided there are more than the usual pixel and vertex shaders (along with the geometry ...
0
votes
1answer
35 views
Monogame HLSL GBuffer Depth Mysteriously Colored Red
I was working through an older tutorial listed here, and got it to work for the most part. The RenderTarget for Depth is colored red for some reason, and I've been scratching my head trying to figure ...
0
votes
0answers
40 views
DX12 Domain Shader texture mapping using WRAP despite setting CLAMP on AMD hardware
My application works fine on my NVidia GTX 960, but my AMD Radeon R9 380 is incorrectly setting the address mode to WRAP, despite setting it as CLAMP in my application. This totally caught me off ...
0
votes
1answer
161 views
Need an example of a HLSL Compute Shader
I'm finding Compute shaders very confusing. I was wondering, if I were to provide an example, and maybe one more later, if someone could demonstrate how to convert it into a Compute shader for D3D11?
...
1
vote
1answer
74 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));
...
-1
votes
1answer
116 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 ...
0
votes
1answer
73 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 ...
0
votes
1answer
30 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
1answer
123 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
186 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 ...
1
vote
0answers
41 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 ...
1
vote
2answers
257 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 ...
2
votes
0answers
35 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
68 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 ...
0
votes
0answers
43 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
0answers
48 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
189 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 ...
2
votes
1answer
716 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 ...
1
vote
1answer
55 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
2answers
170 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, ...