akaitora

Member

213

399 Neutral

• Rank
Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

1. Gaussian based Weights

Hi. I was studying the Bloom tutorial on learnopengl.com. https://learnopengl.com/#!Advanced-Lighting/Bloom I understand the benefits of using a Gaussian blur for achieving a Bloom effect. I understand that the author of this tutorial is using the gaussian values as weights which are used to determine how much neighboring pixels should affect the current pixel when blurred. In this tutorial, the author chooses to use the following weights, 0.227027, 0.1945946, 0.1216216, 0.054054, 0.016216 Where 0.227027 + (0.1945946*2.0) + (0.1216216 * 2.0) + (0.054054 * 2.0) + (0.016216 *2.0) comes out to about 1. The author chooses to same 4 samples to the left and right of the current pixel for a total sample count of 9 per axis. All that makes sense but what I don't understand is how to calculate the weights myself. For example, lets say I wanted a sample count of some arbitrary number like 5. With a sample count of 5, the formula would then need to be A + (B * 2.0) + (C * 2.0) + (D * 2.0) + (E * 2.0) = 1 What I want to do is figure out how to calculate the wights, A,B,C,D, and E given the sample count. Thanks!

Why/When should you call DiscardResource?  https://msdn.microsoft.com/en-us/library/windows/desktop/hh404613(v=vs.85).aspx   What does this method buy you?  Is it essentially like the free method in C?
3. We released Deer Hunter 2016!

Hey guys! My team just released our latest creation, "Deer Hunter 2016". We managed to get featured in the iTunes, Google Play, and Amazon stores.  It is available on both iOS and Android platforms.     iTunes https://itunes.apple.com/app/id893372761?mt=8   Google Play https://play.google.com/store/apps/details?id=com.glu.deerhunt16&hl=en   Amazon http://www.amazon.com/gp/product/B0131KZRMG/ref=mas_billboard   https://www.youtube.com/watch?feature=player_embedded&v=2C2heMcl9u0
4. Corrupted Vertex Buffer

mhagain, thanks for the solution!  That fixed it!  I didn't realized that glVertexAttribPointer required the buffer to be bound before use.  Thanks for the heads up!
5. Math for Game Developers: Advanced Vectors

Great video!  For more information on the Dot Product and its properties along with some more real world use cases, check out my article.     http://xdpixel.com/dot-product-101/

Any ideas?
7. Corrupted Vertex Buffer

btw, for my Begin/End shader code,  I am doing the following     //--------------------------------------------------------------------- void ShaderFx::BeginPass() {     glUseProgram(shaderProgram);          if( !modelHasUvs )     {         GLint vertexAttribLocation = glGetAttribLocation(shaderProgram, "vertex");         glEnableVertexAttribArray(vertexAttribLocation);         glVertexAttribPointer(vertexAttribLocation, 3, GL_FLOAT, GL_FALSE, 0, 0);     }     else     {                  GLint vertexAttribLocation = glGetAttribLocation(shaderProgram, "vertex");         glEnableVertexAttribArray(vertexAttribLocation);         glVertexAttribPointer(vertexAttribLocation, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), 0);                  GLuint texCoordAttribLocation = glGetAttribLocation(shaderProgram, "uv");         glEnableVertexAttribArray(texCoordAttribLocation);         glVertexAttribPointer(texCoordAttribLocation, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), (const GLvoid*)(3 * sizeof(GLfloat)));              } }   //--------------------------------------------------------------------- void ShaderFx::EndPass() {     GLint vertexAttribLocation = glGetAttribLocation(shaderProgram, "vertex");     GLuint texCoordAttribLocation = glGetAttribLocation(shaderProgram, "uv");          glDisableVertexAttribArray(vertexAttribLocation);     glDisableVertexAttribArray(texCoordAttribLocation); }
8. Corrupted Vertex Buffer

Good catch!  Unfortunately I forgot to mention that I am handing the shader for the QuadGeom in a higher level class like so.     void onRenderImage(ApplicationContext &context) {     glClearColor(0.0, 0.3, 0, 1);     glEnable(GL_DEPTH_TEST);          glViewport(0, 0, context.ResolutionWidth, context.ResolutionHeight);     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);          context.ShaderFx->BeginPass();          context.ShaderFx->SetVector2Parameter("resolution", context.ResolutionWidth, context.ResolutionHeight);          context.ShaderFx->SetFloatParameter("time", context.TimeInSecondsSinceStartup);               float mouseX = (float)((context.MouseX - context.WindowPosX)) / context.ResolutionWidth;     float mouseY = (float)(-(context.MouseY - context.WindowPosY)) / context.ResolutionHeight;          context.ShaderFx->SetVector2Parameter("mouse", mouseX, mouseY);          context.QuadGeo->Render();          context.ShaderFx->EndPass();          glDisable(GL_DEPTH_TEST);     context.DisplayText->DrawString("", 0, 0); }     Any other ideas?  Thanks!

10. Procedurally Generating Noise in a Shader

Tonight I wrote a tutorial explaining how to procedurally generate noise in a shader if you need to.   Take a look here. http://glslsandbox.com/e#27370.3   I hope it helps someone!  =)
11. Picking a Random Uniformly Distributed Point in a Circle

A short article tI wrote that attempts to give a little insight into how this is done mathematically.   http://xdpixel.com/random-points-in-a-circle/
12. Roughness in a Reflection

So if I understand correctly, from a shader perspective, we sample a cubemap just like we would as normal.  The only difference is that the cubemap is been blurred offline. Perhaps we have multiple versions of the blur per mip map.
13. Roughness in a Reflection

I came across this site   http://www.chocofur.com/6-shadersamptextures.html   And I want to write a shader that uses a cubemap for reflection but I want to take into account the roughness of the reflection.  Essentially it looks like the roughness more or less blurs the texture.  This model seems to be used in Physically based shaders.  I am curious if anyone can point me to an article that explains the formula for adding roughness to augment a reflection vector in a shader.  Thanks!
14. Procedural Lightning

Hey renman29!  That is very kind of you to say and I am glad you liked it!   I actually just made a few small adjustments to make more of a dynamic looking energy field.  It uses 2 passes of fractional brownian motion.     http://xdpixel.com/energy-field/
15. Procedural Lightning

Hey guys!  Here is a shader I wrote that demonstrates a simple way to do procedural lightning.     You will need a WebGL enabled browser to view the demo.   http://xdpixel.com/stormy-night/