FXC: Error X3501: 'main': entrypoint not found
I am trying to compile a vertex shader using VS2013, but every time I try, FXC returns the following error: Error error X3501: ‘main’: entrypoint not found I’ve reduced the vertex shader to its...
View Articleconverting HSLS gives error
I’m using the following parser: https://github.com/unknownworlds/hlslparser I also have the following code: /* * Bo Sun, Columbia University, All rights reserved *...
View ArticleHLSL Shader Optimilation with MAD(m,a,d)
I understand that the expression x = m*a+d is most efficiently written as x = mad(m,a,d) because at the assembly level only one instruction is needed rather than a multiply and add separately. My...
View ArticleUpdate single variable in DirectX Shader
I am trying to update a single variable within a CBuffer but I am unsure of how to do this. I have a LightingBuffer which is passed to the GPU containing, ambient color, diffuse color etc and I want to...
View ArticleDraw many flashlights' focused lights'“circles” on a voxel engine map (and...
So, I’ve been searching the internet for a while and I still didn’t understand how to create a flashlight’s “circle” in front of the camera over other objects. I found the following links: using...
View ArticleBinding an Instance Matrix with an InputLayout
If I want to bind an instance matrix to a vertex shader, how do I go about it? For example, here is a super-simple VS input: struct VS_IN { float4 Position : POSITION; row_major float4x4 WorldMat :...
View ArticleNeed help creating points in an array
I’m creating a lightning geometry shader using hlsl that creates an array of points based on an arbitrary number of generations. The gist of what I want to accomplish is here:...
View ArticleWhen does DirectX convert a vertex/pixel's depth from range Near-Far to 0-1?
When I output a vertex from a vertex shader, it seems to have a world-space-ish mapping. Vertices about 1 unit away have about 1 unit as their Z value. When we input into the pixel shader, the depth...
View ArticleShader – Convert vector into scalar
I am trying to convert a half3 as a simple half but I am facing an issue. As for an example half3(1, 0, 0) give me white but half3(0, 1, 0) gives me black. How can I convert properly a half3 to a...
View ArticleThe way of avoiding branching for textured and not-textured objects
I know that branching is an expensive operation on GPU (not as much as it used to be, but still). The most common situation where I use branching is when I have both textured and non-textured...
View ArticleSample() returns (0, 0, 0) for normal map 90% of frames
I’m having some trouble reading the values from my Normal map in my lighting fragment shader. The relevant part of the shader code is as follows: Texture2D NormalGB : register(t0); Texture2D DiffuseGB...
View ArticleHow to sample a texture with specified LOD in SM 2.0?
That is my question, in SM 3.0 there is the HLSL intrasic function tex2Dlod to pick a color on a texture2d at specified coords and specified level-of-detail. But after long search on the web, I don’t...
View ArticleWhen does DirectX convert a vertex/pixel's depth from range Near-Far to 0-1?
When I output a vertex from a vertex shader, it seems to have a world-space-ish mapping. Vertices about 1 unit away have about 1 unit as their Z value. When we input into the pixel shader, the depth...
View ArticleCan someone explain to me how setting shader parameters aren't a bottleneck?
I am trying to understand this. So I have a bunch of models that need to be rendered. Each model most likely has various “sub meshes” with their own diffuse, specular, etc textures. So for each of...
View ArticleHow to sample png heightmap in HLSL
I am working on simple parallax shader and I have problem with sampling height texture for value. My aproach amples texture and give me RGB values of picture: tex2D(TextureHeightSampler,...
View ArticleTexture shader using model's texture
I’m trying to get a model rendered in monogame using a texture shader. I’m using the code from this tutorial project: http://kgiannakakis.github.io/MonoGameEffects/ I created a simple textured cube...
View Articletex2Dlod to limit max mip level to use for a texture (atlas)
I’m developing a 3D multitexturing terrain engine in C# on Monogame (XNA) plateform. I would like my engine works on Windows XP or upper, so on DirectX 9c minimum. Monogame allow me to build a DirectX...
View ArticleHow to write a custom shader in Unity 3D that lights up a specific pixel or...
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 shoots...
View ArticleIssues with depth calculation in HLSL shader
I’m currently trying to implement shadow maps in my graphics framework. I ran into an issue with depth calculations I wasn’t able to solve myself (yet). I did a lot of testing and debugging and think I...
View ArticleHLSL screen-space to world-space
I’m trying to use RenderDoc to understand how a DirectX11 game engine’s vertex shader works, and ultimately recover the world-space positions of vertices. I have captured a frame using RenderDoc, and...
View Article