Home > other > DirectX12 or how to do in any graphics API is not affected by the distance the lines
DirectX12 or how to do in any graphics API is not affected by the distance the lines
Time:09-17
Figure is unreal engine editor in the rendering of the line, is very perfect This line is characterized by no matter how far you can see it will not change no matter how far the thickness, but also can be other mesh
How can consult in rendering graphics apis do apply colours to a drawing gives such a line? (change map model for Line not Line, because only is it a kind of style, I want to get a look not)
In my cognitive all mesh is a triangle, but the line is a little special, if mesh is used to implement a line far can't see, really very curious about exactly how to do it is not affected by distance
I can think of method: 1. Build a quadrilateral, then through calculating the more far more wide, so that you can just like no matter how far the thickness all the same, but this method is so stupid and consumption of resources, there must be a better way of 2. Draw on the direct screen (that is, the matrix switch to the orthogonal matrix and then converted to screen coordinates the position of the two points and then draw and then in the reduction of matrix) but this mapped out no matter what all can't be other objects, always in the front of the 3. Their control color output in the rasterizer this step (but these graphics apis I didn't find out how to control the step)
O master answer, really is a problem that confused me for a long time
CodePudding user response:
You haven't understand 3 d API work In the vertex shader stages, 3 d coordinates into NDC coordinates, and the NDC coordinates x, y (such as 0.5, 0.5) on the screen size (such as 800, 800), is to screen coordinates (400, 400), Actually, 3 d is only a mathematical game,
CodePudding user response:
Fillmode set wireframes line Dx9 in RenderState set Its in RasterizerState Dx12 haven't been used, should be like 11, support hlsl5 anyway, not just in the effect framework set UE if you want this effect, show only the square face, does not display the triangles, still have other method, such as with the map element, or do with GS