opengl – Depth test problems with LWJGL3 (GLFW)

I know: similar questions have been asked, but I didn't find a solution.


So, at the beginning, the basic problem: it seems that the convex models (currently the .obj files) work fine, but the concave models seem to have some kind of depth problem:


1: the right ear of the mono-blender "shines"
2: must be a hollow cylinder

The inside of the cylinder becomes thin (?!).
So I guess here is a code:
Eukild.java:

public static Matrix4f createProjectionMatrix(float fov, float far, float near){
    Matrix4f projectionMatrix = new Matrix4f();
    float aspectRatio = StaticVars.ratio;
    float y_scale = (float) ((1f / Math.tan(Math.toRadians(fov / 2f))));
    float x_scale = y_scale / aspectRatio;
    float frustum_length = far - near;

    projectionMatrix.setValue(x_scale, 0, 0);   
    projectionMatrix.setValue(y_scale, 1, 1);
    projectionMatrix.setValue(-((far + near) / frustum_length), 2, 2);
    projectionMatrix.setValue(-1, 2, 3);
    projectionMatrix.setValue(-((2 * near * far) / frustum_length), 3, 2);
    projectionMatrix.setValue(0, 3, 3);
    return projectionMatrix;
}

(called with:

Euklid.createProjectionMatrix(90, 0.1f, 1000);

) While rendering, I enabled depth tests and backspace with:

GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glCullFace(GL11.GL_BACK);

In GLSL I calculate the position in the vertex shader with:

gl_Position = projection*transform*vec4(vertices, 1.0);

If you need any additional code, simply write what you need.
I am used to developing with LWJGL 2 and I just converted my engine to LWJGL 3.

Thank you very much for your help!!

Expected Depth of a Binary Tree

Any node of a binary tree has the same probability. P have two child nodes (and have no child nodes with the probability of (1-P)). What is the expected depth of the binary tree?

What is the tracking depth? – SEO Help (General Chat)

Drag depth It is the degree to which a search engine indexes pages within a website. Most sites contain several pages, which in turn can contain subpages. Pages and subpages deepen in a manner similar to the way in which folders and subfolders (or directories and subdirectories) are deepened in computer storage.

javascript: do I make a pixel depth or a resolution so that the resolution looks better?

I'm trying to make a simple script using pixel depth or some kind of pixel ratio to make the game more smooth and stable, or I could make a script to decide how your game should perform, which is more likely for me. If any of you have any ideas on how to do this, please comment below.

walker – custom wordpress menu – shows parents, siblings, children depending on depth

searching and trying for hours to find a solution for the following result of a custom WordPress menu. I hope you can help. I don't know where to start: custom menu walker, css, functions.php

I have a personalized menu with "individual links" (so there are no pages, publications or categories) with Link and Link-Text. At this time the depth is 5 (it could be 6.7 .. in the future).

Sample Menu:

Sport
   Bike
     Bikeparts
       Seats
         Mountainbike
         Roadbike
       Breaks
         Break Levers
         Adapters
     Bike Add Ons
       Bottle Holder
   Water
     Stand Up Paddling
       Paddel
       Boards
   Air
     Wingsuits 
Automotive
  car
  motorbike
Tools

What it should be: See the following scenarios: Default view on the main page (depth 0):

Sport
Automotive
Tools

Click on "Sport":

Sport (bold)
   Bike
   Water
   Air
Automotive
Tools

Click on "Bicycle":

Sport (bold)
   Bike (bold)
     Bikeparts
     Bike Add Ons
   Water
   Air
Automotive
Tools

Click on "Bikeparts":

Sport (bold)
   Bike (bold)
     Bikeparts (bold)
       Seats
       Breaks
     Bike Add Ons
Automotive
Tools

Click on "Jumps":

Sport (bold)
   Bike (bold)
     Bikeparts (bold)
       Seats
       Breaks (bold)
         Break Levers
         Adapters
Automotive
Tools

Click on "Brake Levers":

Sport (bold)
   Bike (bold)
     Bikeparts (bold)
       Breaks (bold)
         Break Levers (bold)
         Adapters
Automotive
Tools

Then you can see from Depth 1 if the depth begins at 0 (step: click Bicycle) and deeper you will always see all menu items of depth 0 (sport, automotive, Tools), all siblings of this active menu item (bicycle) under active father (sport) and all children of the active menu item (bicycle).

What I have now is the https://christianvarga.com/how-to-get-submenu-items-from-a-wordpress-menu-based-on-parent-or-sibling/ solution where I replaced:

} else if ( ! ( isset( $args->show_parent ) && in_array( $item->ID, $menu_item_parents ) ) ) {

with

} else if ( ! empty( $item->menu_item_parent ) ) {

So now it only works with the first level. If I click on sport I don't see automotive submenu.

I hope someone can help.

Thanks in advance

OpenGL strange depth test behavior

I have a simple OpenGL program that renders the terrain with a texture. It exhibits some strange behaviors (see video) that resemble the problems of depth tests. However, I have already enabled the depth test. Where else can I look to solve this problem?

This is the relevant configuration code

glEnable(GL_BLEND);
glEnable(GL_DEPTH_TEST);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

... VBO and texture setup ..

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);

projectionMatrix = glm::frustum(-2.0, 2.0, -2.0, 2.0, 1.0, 10000.0);

... rendering stuff ...

glFlush();
swapEGLBuffers();

matrix – Part: the partition specification is longer than the object depth

I know this is a probably stupid and well addressed question, but since I am a beginner in Mathematica, the answers from p. How do I solve problems when I get a Part :: partd or Part :: partw error? it is not clear to me …

If someone could help me solve my problem and explain what is wrong, I would appreciate it.

I am trying to implement one of the answers they gave me for this question. I chose to implement the response from user2757771.

So, I have an R matrix (A in the other publication) that I import from a csv file.

R / A Matrix

Then I have a matrix Y (B in the other publication), which I create with 0 or an unknown coefficient. The following code can be copied / pasted to generate the matrix Y.
Both are 16 by 16 and symmetric matrix.

Y = {{Subscript(y, 11), Subscript(y, 12), 0, 0, 0, 0, 
   Subscript(y, 17), Subscript(y, 18), 0, 0, Subscript(y, 111), 
   Subscript(y, 112), 0, 0, 0, 0},
      {Subscript(y, 12), Subscript(y, 22), Subscript(y, 23), 0, 0, 0, 
   Subscript(y, 27), Subscript(y, 28), Subscript(y, 29), 0, 
   Subscript(y, 211), Subscript(y, 212), Subscript(y, 213), 0, 0, 0},
      {0, Subscript(y, 23), Subscript(y, 33), Subscript(y, 34), 0, 0, 
   0, 0, Subscript(y, 39), Subscript(y, 310), 0, Subscript(y, 312), 
   Subscript(y, 313), Subscript(y, 314), 0, 0},
      {0, 0, Subscript(y, 34), Subscript(y, 44), Subscript(y, 45), 
   Subscript(y, 46), 0, 0, 0, Subscript(y, 410), 0, 0, 
   Subscript(y, 413), Subscript(y, 414), Subscript(y, 415), 
   Subscript(y, 416)},
      {0, 0, 0, Subscript(y, 45), Subscript(y, 55), Subscript(y, 56), 
   0, 0, 0, 0, 0, 0, 0, Subscript(y, 514), Subscript(y, 515), 
   Subscript(y, 516)},
      {0, 0, 0, Subscript(y, 46), Subscript(y, 56), Subscript(y, 66), 
   0, 0, 0, 0, 0, 0, 0, Subscript(y, 614), Subscript(y, 615), 
   Subscript(y, 616)},
      {Subscript(y, 17), Subscript(y, 27), 0, 0, 0, 0, 
   Subscript(y, 77), Subscript(y, 78), 0, 0, Subscript(y, 711), 
   Subscript(y, 712), 0, 0, 0, 0},
      {Subscript(y, 18), Subscript(y, 28), 0, 0, 0, 0, 
   Subscript(y, 78), Subscript(y, 88), Subscript(y, 89), 0, 
   Subscript(y, 811), Subscript(y, 812), 0, 0, 0, 0},
      {0, Subscript(y, 29), Subscript(y, 39), 0, 0, 0, 0, 
   Subscript(y, 89), Subscript(y, 99), Subscript(y, 910), 0, 
   Subscript(y, 912), Subscript(y, 913), 0, 0, 0},
      {0, 0, Subscript(y, 310), Subscript(y, 410), 0, 0, 0, 0, 
   Subscript(y, 910), Subscript(y, 1010), 0, 0, Subscript(y, 1013), 
   Subscript(y, 1014), 0, 0},
      {Subscript(y, 111), Subscript(y, 211), 0, 0, 0, 0, 
   Subscript(y, 711), Subscript(y, 811), 0, 0, Subscript(y, 1111), 
   Subscript(y, 1112), 0, 0, 0, 0},
      {Subscript(y, 112), Subscript(y, 212), Subscript(y, 312), 0, 0, 
   0, Subscript(y, 712), Subscript(y, 812), Subscript(y, 912), 0, 
   Subscript(y, 1112), Subscript(y, 1212), Subscript(y, 1213), 0, 0, 
   0},
      {0, Subscript(y, 213), Subscript(y, 313), Subscript(y, 413), 0, 
   0, 0, 0, Subscript(y, 913), Subscript(y, 1013), 0, 
   Subscript(y, 1213), Subscript(y, 1313), Subscript(y, 1314), 0, 0},
      {0, 0, Subscript(y, 314), Subscript(y, 414), Subscript(y, 514), 
   Subscript(y, 614), 0, 0, 0, Subscript(y, 1014), 0, 0, 
   Subscript(y, 1314), Subscript(y, 1414), Subscript(y, 1415), 
   Subscript(y, 1416)},
      {0, 0, 0, Subscript(y, 415), Subscript(y, 515), 
   Subscript(y, 615), 0, 0, 0, 0, 0, 0, 0, Subscript(y, 1415), 
   Subscript(y, 1515), Subscript(y, 1516)},
      {0, 0, 0, Subscript(y, 416), Subscript(y, 516), 
   Subscript(y, 616), 0, 0, 0, 0, 0, 0, 0, Subscript(y, 1416), 
   Subscript(y, 1516), Subscript(y, 1616)}}

Get out:

Y-mat

The next step is to invert the matrix Y:

Yinv = Inverse(Y)

The computer worked for a while … and the result is quite surprising. Sample Out: Inverse(Y) without any errors Is this shown this way because the output is too large to display? For example 4 by 4 that I also executed on my side, the result was already quite extensive for this inverse.

And finally, I adapted the resolution part in:

Solve(Table(
   If(MatchQ(Y((i, j)), Subscript(y, x_)), Yinv((i, j)), 0), {i, 
    16}, {j, 16}) == 
  Table(If(MatchQ(Y((i, j)), Subscript(y, x_)), R((i, j)), 0), {i, 
    16}, {j, 16}))

To test this before solving, I tried:

T = Table(If(MatchQ(Y((i, j)), Subscript(y, x_)), R((i, j)), 0), {i, 
  16}, {j, 16})

Which one should return a table (matrix) where the elements of $ R_ {i, j} $ have been replaced by $ 0 $ if the item $ Y_ {i, j} = 0 $.
In other words, $ T_ {i, j} = R_ {i, j} $ Yes $ Y_ {i, j} neq 0 $ Y $ T_ {i, j} = 0 $ Yes $ Y_ {i, j} = 0 $

I got the following error:

Error message

and I really don't understand it since it worked well with the fictional example of 4 by 4 …

bit depth: theoretical contrast of the 8-bit monitor

Imagine a perfect monitor that can show pure blacks and is perfectly calibrated.

What would be the contrast between its second darkest shade of black, which is 1,1,1 values ​​for the sub-pixel red green blue and the brightest white with 256,256,256 values ​​for rgb?

Note that I mean the second darkest shade of black, that means the pixel is active and the light shines, although very weakly. Specifically, I don't want people to confuse this with the darkest shade of black (rgb 0,0,0), which means that the pixels are completely off and no light comes out of them.

This is becose with monitors with perfect black, regardless of the maximum brightness value, the contrast is always infinite. That's why I ask for the second darkest black, not for total black.

I know that SDR monitors have a 2.2 gamma curve target and have 256 possible becose values, they are 8 bits. I know that 8 bits has a contrast ratio of 256-1, assuming that the brightness change is the same among all bit values, but since the coding of the 8-bit digital format is not linear like RAW files, no I have no idea what contrast / dynamic range is 8 bits is supposed to have becose. I don't know how much the individual bit values ​​are separated.

If this perfect 8-bit SDR theoretical monitor had a maximum brightness of 100 cd / m2, how bright would the second darkest shade of black be?

Depth Mask Shader – Game Development Stack Exchange

Thank you for contributing a response to Game Development Stack Exchange!

  • Please make sure answer the question. Provide details and share your research!

But avoid

  • Ask for help, clarifications or respond to other answers.
  • Make statements based on opinion; Support them with references or personal experience.

Use MathJax to format equations. Reference MathJax.

For more information, see our tips on how to write excellent answers.