Tag Info

Hot answers tagged

4

You can get this behaviour without a branch using the step function: float blendFactor = step(3.0f, dot(B.rgb, B.rgb)); return lerp(B, A, blendFactor); When B = (1, 1, 1), dot(B, B) = 3.0f, so step returns 1, blendFactor = 1, and the lerp gives a result of A. When B is anything less, dot(B, B) < 3.0f, so step returns 0, blendFactor drops to 0, and the ...


3

The near plane parameter shall be strictly larger than zero. The smaller it is the more precision you burn close to the camera, and with zero, the projection matrix degenerates into unusability. If your geometry isn't where you want it to be when you use a conformant projection matrix, address that problem instead.


2

There are a variety of formulae for converting colour to black and white. Furthermore, the programmer might mean something else when converting a vector into a scalar (length would be a common example). The shader compiler keeps things as simple as possible, just taking the first value in the vector, in your example. Experiment with different ways to get a ...


2

There are 2 main types of projections used in video games and 3d applications: Perspective Orthogonal Perspective This type of projection is the one that is the most commonly used to represent a 3d world simulation; it acts a little like a normal camera with lenses. All the elements of the scene are projected toward a single point, but drawn on a plane. ...


1

Some informal thoughts, specifically about clickable menu items... You're 100% correct to not worry much about performance here. Menus are typically stateful, navigating a tree of states. So it may make more sense to alert a "menu node" which which of the several choices they made. At the individual button/item level, they could know their 2d boxes, and ...


1

screenPosition is not at the right scale for texture coordinate lookup. Texture2D::Sample expects texture coordinates (0..1) while Texture2D::Load expects texel coordinates (0..[Width or Height]-1). So you're probably sampling way off the edge of the texture and either hitting the border color, or clamping to the edge which happens to be black. As a ...



Only top voted, non community-wiki answers of a minimum length are eligible