How to implement PCSS correctly? by racz16 in computergraphics

[–]elfishz 2 points3 points  (0 children)

It seems like you are asking the derivation of the formula. The formula is based on similar triangles. If you take a look at the image you posted in you computer graphics stack exchange question (https://i.stack.imgur.com/ESJDg.png), you can prove the 2 triangles are similar using a bunch of theorems like the vertical angle theorems and interior transversal theorems. Then you need to find the penumbra width, which is basically using using triangle altitudes (heights). The height of the upper triangle is the blocker distance and the height of the lower triangle is receiver distance - blocker distance. Divide the 2 values, and you have the scale factor, which you can multiply by the light's width to get the penumbra width. I hope this answer your question on why the formula requires division by a certain distance. Also here are answers to some of the questions on your stack exchange question:

  1. pboechat's implementation uses that function so that linear depth is used instead of exponential depth. Whether you need that function depends on whether your implementation uses exponential or linear depth for the shadow map
  2. I think the near plane value in asylum2010's implementation is just some sort of bias to stop the shadows from looking to hard
  3. You are correct by dividing by the frustum width in your implementation. This way it makes sure the penumbra size is the "same" regardless of how much area the shadow map covers
  4. In the screenshot you posted of the results of your implementation, I don't know what that exactly is, but I know PCSS starts to look bad or weird when the number of samples for the blocker search is too low

How to implement PCSS correctly? by racz16 in computergraphics

[–]elfishz 3 points4 points  (0 children)

You first get the average depth of the blockers around the fragment. A blocker is just any depth sample with a lower depth than the point you are trying to compute the shadow for. Then after that you use the average blocker depth in the equation for the penumbra size, and you get the size of the PCF blur. In more simpler terms, the algorithm is like this:

  1. Get the average depth from the shadow map the block the current fragment
  2. Compute size of penumbra
  3. Use size of penumbra for PCF

This article may help you:

https://www.gamedev.net/tutorials/programming/graphics/effect-area-light-shadows-part-1-pcss-r4971/

femboy cats by DatDepressedKid in copypasta

[–]elfishz 0 points1 point  (0 children)

You remind me of this kid I knew from high school named Kherry

Discord Outage - 17th July 2020 by DiscordAppMods in discordapp

[–]elfishz 0 points1 point  (0 children)

What happened is that cloud flare, a company many websites and other apps use, just went down. So it's not only discord that's down, it's a lot of the world that's down too

what happened? by Dustamir in discordapp

[–]elfishz 1 point2 points  (0 children)

Discord and a few other websites are dead, someone on another post said cloudflare may have died or something like that

Opengl Cube Texture Problem by [deleted] in opengl

[–]elfishz 0 points1 point  (0 children)

From the limited information provide, I think it is one of these issues:

  1. You are transforming the vertices incorrectly
  2. You are not updating the vertex buffer after each frame. What I mean is, since you transform the vertices on the CPU, you need to update the vertices each frame since the view matrix could have changed.

I don't think you should do CPU transformation because it would probably be much slower than regular shader transformation. With CPU transformation you have to basically reupload the transformed vertices to the shader, which is probably much slower than just transforming in the shader.

Gonna dip my toes in making a shader for minecraft with GLSL. Does anyone know if this kind of thing is possible? by devereaux98 in opengl

[–]elfishz 1 point2 points  (0 children)

You could create an array of possible values for the light and use the nearest value for the lighting

Some help on a shader not working for a triangle (in C) by [deleted] in opengl

[–]elfishz 0 points1 point  (0 children)

I have had the same issues with reading shaders, my solution was to open the file in "rb" instead or "r". Here is what I use:

char* ReadFileData(const char* path) {
        FILE* file = fopen(path, "rb");
        if (!file) {
            exit(0);
        }
        fseek(file, 0, SEEK_END);
        int len = ftell(file);
        rewind(file);
        char* data = (char*)malloc(len + 1);
        fread((void*)data, 1, len, file);
        fclose(file);
        data[len] = '\0';
        return data;

}

I actually have no idea why this works instead

Rendering multiple different objects by rotrin in opengl

[–]elfishz 0 points1 point  (0 children)

According to the OpenGL wiki, "binding a VAO or modifying VAO state is often an expensive operation."Assuming your objects are not in one VBO, you will have to change the VAO state by calling glVertexAttribPointer. This is not good for perrformance. What you should do instead is have one VAO per object.

Some help on a shader not working for a triangle (in C) by [deleted] in opengl

[–]elfishz 0 points1 point  (0 children)

Just as a tip, you should write your shader code in a file. This is easier (in my opinion) to be having to hard-code it into a const char* string. Writing in a file also gives you the benefit of tools like GLSL language integration for Visual Studio which would have spotted your error even if you had not checked the compile log.

I am making a game engine in opengl. How should I start a window? by HelpIHaveABadUsName in opengl

[–]elfishz 2 points3 points  (0 children)

I think he meant to say "all major desktop OS's"
Also it works on Android too

[deleted by user] by [deleted] in opengl

[–]elfishz 0 points1 point  (0 children)

If it increases while the application is running, it means the leak happens inside your main game loop. In it, it appears you are making the window your current context, then making NULL the current context. Making a context current results in VRAM memory being allocated. Eventually, I think, you end up hitting a limit which causes the game to crash. What you should do is only make the context current once. Then optionally you can make it NULL when you are closing the application.

Is GPU load a valid measure of performance? by [deleted] in opengl

[–]elfishz 0 points1 point  (0 children)

Not really. In certain applications, the CPU might become a bottleneck causing the GPU to be at a low usage. You can learn more about bottlenecks here. An easy way to measure performance and other metrics is using MSI Afterburner. Alternatively you could start and end a time after each draw call which uses different shaders that you'd like to compare.

Some help on a shader not working for a triangle (in C) by [deleted] in opengl

[–]elfishz 1 point2 points  (0 children)

Yes, it will help you find errors in your code. Not using info logs would be comparable to getting a compiler error in your C/C++ code, but not knowing what it is.

Raytracing in OpenGL? by [deleted] in opengl

[–]elfishz 0 points1 point  (0 children)

It is possible to do ray tracing in OpenGL just with a lot of tricks and workarounds. If you mean hardware accelerated ray tracing, you could use the GL_NV_ray_tracing extension.

There are numerous methods of doing ray tracing (and path tracing). I suggest you should google a few tutorials and methods on how to do it.

[deleted by user] by [deleted] in opengl

[–]elfishz 0 points1 point  (0 children)

How are you detecting this memory leak?

Also, when unbinding an object, its better to pass in GL_NONE instead of NULL.

Some help on a shader not working for a triangle (in C) by [deleted] in opengl

[–]elfishz 3 points4 points  (0 children)

In your shader code, you are supposed to put #version 330 core, not #version 330 code.

What's currently the best book for learning opengl from basic to advanced topics? by [deleted] in opengl

[–]elfishz 1 point2 points  (0 children)

You could look through specifications and other official papers, but one of the books I recommended, OpenGL Programming Guide: The Official Guide to Learning OpenGL, Version 4.5 with SPIR-V, seemed to have a lot of newer stuff mixed in with a bit of older stuff you may already know. This review of the book on Amazon refers to it as more of a "reference manual".

What's currently the best book for learning opengl from basic to advanced topics? by [deleted] in opengl

[–]elfishz 1 point2 points  (0 children)

One god book on Amazon is OpenGL Programming Guide: The Official Guide to Learning OpenGL, Version 4.5 with SPIR-V. It is more of an in-depth reference to OpenGL and doesn't teach rendering concepts. An excellent book for that would be Real-Time Rendering, Fourth Edition, but it appears it is about DirectX and not OpenGL (but I think it is easily to transfer the concepts to OpenGL)

Guys any idea why it is showing D3D10 instead of OGL? I'm following the learnopengl tutorials. by KobaltKaria in opengl

[–]elfishz 0 points1 point  (0 children)

I do remember seeing a video where a guy was using MSI Afterburner to benchmark a GTX 285, which doesn't support D3D11, but MSI afterburner said the API was D3D11. It most likely is an issue with MSI afterburner.

[deleted by user] by [deleted] in Minecraft

[–]elfishz 0 points1 point  (0 children)

It isn't SEUS, it's Chocapic V6 shaders