Sign in to follow this  
JavaCoolDude

OpenGL New Demo: Glow

Recommended Posts

As posted on my webpage: This demo written in OpenGL is based on an article I read a while ago in my GPU GEMS book and which is also available on the gamasutra site, check it out here. To create the glow effect, basically every 3D model in the scene is assigned a set of two textures; a regular RGB image encoding the diffuse color and a LUMINANCE one specifying the glow areas. A better approach would be to code the luminance values into the alpha channel of the diffuse image; that way we get to use a single texture instead of two. I chose to stick with the first approach since it gives me the possibilty of modifying the glow path without separating the RGB and ALPHA values into separate textures before combining them again (I only have Paint on my computer, sigh!!!) During the first pass a GLSL fragment shader retrieves the diffuse color bound to texture unit 0 and then multiplies it by the luminance value stored in the second texture. The result is copied into a 256*256 texture that we call the glow source. Originally I intended to use FBOs to accomplish the rendering to texture but since we're dealing with relatively small targets, I decided to stick with glCopyTexSubImage2D. Now depending on the amount of glow that we aim for, another shader (or ARB program, the user can modify the Blur.xml file in the data folder to switch from one to the other) takes the glow source and blurs it N times in two separate steps: a horizontal pass to bleed the source color along the x axis followed by a vertical pass that distributes the color in the y axis direction. In both steps the resulting color is multiplied by 1.15 to accentuate the glow effect. After each pass, the result is stored into a secondary texture; this is our blur target. Finally, the scene is drawn with diffuse textures only before turning on additive blending and drawing a full screen quad with the blur target bound to it. One drawback of this technique is the aliasing effects betraying the small size of the blur and glow targets. Later I will try to provide support for non DX9.0 hardware since the blur could be accomplished without shaders. Demo binaries. Demo source and build files. Engine source. [Edited by - JavaCoolDude on May 27, 2005 4:19:06 PM]

Share this post


Link to post
Share on other sites
Thats pretty neat.

What do you intend to do with all these neat effects you are creating?

Share this post


Link to post
Share on other sites
I'm shooting to get some of those effects into the NVIDIA SDK.
I'm flying to their headquarters in CA tomorrow for a job interview.
Wish me luck, I feel pretty nervous about the whole thing.

/wuss out [crying]

[razz]

Share this post


Link to post
Share on other sites
Your stuff amazes me. I know a lot of people seemed to be making this kind stuff (atleast commerically), but you work it all out and then release it to the public. My hat goes off to you, sir. *round of applause*

Share this post


Link to post
Share on other sites
Don't know if this is too late or not, but good luck man! With all the awesome stuff you've been pumping out lately, you deserve the job!

Share this post


Link to post
Share on other sites
Quote:
I'm flying to their headquarters in CA tomorrow for a job interview.
Wish me luck, I feel pretty nervous about the whole thing.
just have a beer or seven on the plane and continue from there, ie treat the thing as a holiday

Share this post


Link to post
Share on other sites
Quote:
In both steps the resulting color is multiplied by 1.1 to accentuate the glow effect.

Wouldn't it have the same effect if you just multiplied by 1.21 once?

Share this post


Link to post
Share on other sites
Yo JCD, long time no chat. You probably don't remember but I used to chat with you back when you were actually a Java programmer workin with LWJGL :)

Anyway, all these demos are rockin', but this latest one I can't run because it says I need MSVCR71.dll Now, this is confusing to me because, I *do* have Visual Studio .NET 2003 installed, and the Microsoft .NET Framework 1.1. What am I missing?


Thanks, and GOOD LUCK!


EDIT: Turns out a simple file search turned up the missing DLL, I copied it into the same directory as scenegraph.exe, and voila it works. Begs the question why msvcr71.dll wasn't already in my path though...

Share this post


Link to post
Share on other sites
Hey howdy Optus buddy, long time no talk ah?
Glad to see you hanging around here (you and orangytang).

@Boruki
Thanks my man, my pleasure is derived from people's appreciation of my efforts [smile] (You can translate that into "My ego needs to be fed on a regular basis"...j/k [wink] )

So yeah, I'm posting these lines from a hotel right next to NVIDIA's headquarters. They sent a lemo to get me from the airport and I was like: are you sure you're not mistaking me for some other dude?
The interview is scheduled for tomorrow at 10:15 am. Right now I'm just skimming through my GPU GEMS and Orange book.
Aight, I'll keep y'all updated.

Share this post


Link to post
Share on other sites
Quote:
Original post by twanvl
Quote:
In both steps the resulting color is multiplied by 1.1 to accentuate the glow effect.

Wouldn't it have the same effect if you just multiplied by 1.21 once?


Nope, since the blur is accomplished through two separate steps acting on different fragments.

Share this post


Link to post
Share on other sites
Hello,
Wooow another great work , i'm sorry for late post :(
bye :)

Share this post


Link to post
Share on other sites
Well done and good luck for your interview!

I tried to do a glow effect in my game, and I wrote all the code - got everything perfect (like glow sources) but then found out MDX wasn't letting me set a texture as a render target! (That's the December update because I still have Win 2k, they'd better have fixed it by now *punches fist*)

And before any well-meaning soul tells me to check all the simple things; the viewport was set correctly, I was creating the texture with the RenderTarget flag, it was a supported render-target format, my graphics card supports ps_2_0 and it was a single level texture and I was setting the top level which was not null!

Cheers then! Hope the interview goes well!

Share this post


Link to post
Share on other sites
Can you tell me how can i make blur effect? :P i tried to read you code but your code complex :P
Good luck in your interview :D !
bye

Share this post


Link to post
Share on other sites
Hello everyone, missed you all so much (well not really since I managed to post few words from the hotel’s computer [disturbed] )
The interview lasted about six hours and went extremely well; the questions were diverse and really really technical (sometimes barely touching on anything related to graphics), but I believe I managed to answer all of them except that one where I was supposed to go in details about how Anisotropic filtering works (slaps forehead, I should have read a bit more about it in my GL super bible book). Anyway, you can’t know it all.
I met a lot of great engineers like William Ramey, Greg James (The author of the Glow article linked in my demos’s webpage), Cem Cebenoyan, Sim Dietrich etc…very friendly folks.
When I was done with the interview I needed a shower wicked bad since I was totally soaked in sweat (but no foul smell I swear); that's how nervous I was.
Well that was my trip to NVIDIA headquarters, hope I can get back there soon.

Back on topic:
I'll be modifying the demo a bit tonight to add some cool ghosting effects as the cube rotates around, make sure you come back to check it.

@DrGui (your nick is awesome dude)
Pardon my ignorance but what is MDX?


Share this post


Link to post
Share on other sites
Hey Java, sounds like a really great opportunity for you. Just curious about how old you are and how long you've been working in the field? Any professional experience, or just academic/self-taught?

Share this post


Link to post
Share on other sites
I'd hazard a guess MDX = Microsoft Direct X

Anyway, congrats on the interview going so well man! Ho I would LOVE to be in that position... too bad I don't have any cool demo's to show off. :(

Good luck!

Share this post


Link to post
Share on other sites
An interview rarely touches what you are really good at. In my last interview there wasn't much technical questions. It was more or less a discussion on the current job profile, an assessment of how well oriented I was, what the current situation was, what they were looking for etc. Very interesting interview which lasted around 2.5 hrs.

Share this post


Link to post
Share on other sites
Quote:
Original post by Mattman
Hey Java, sounds like a really great opportunity for you. Just curious about how old you are and how long you've been working in the field? Any professional experience, or just academic/self-taught?


Oh I'm not that young buddy, I'm 22.
I've been in the 3D field since I was involved with Java3D and later Xith3D, that's about 2 and half years ago. I developped a couple of commercial products and presented some software that I've written in SIGGRAPH 2004 where I met all the great folks at NVIDIA :D
I've taken an OpenGL course last semester and taught some of the material in class along with the Profressor (ha, I didn't expect that :P).


@Crack123:
There were almost no specific questions about OpenGL, Greg James questions involved among others stuff about CPU ASM and how would I implement a LOAD intstruction with only STORE, SUB, a registry and a couple of memory locations.
I got that one right in 4-5 instructions, but I was close to throwing the towel.
Aight peace

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Partner Spotlight

  • Forum Statistics

    • Total Topics
      627639
    • Total Posts
      2978345
  • Similar Content

    • By xhcao
      Before using void glBindImageTexture(    GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format), does need to make sure that texture is completeness. 
    • By cebugdev
      hi guys, 
      are there any books, link online or any other resources that discusses on how to build special effects such as magic, lightning, etc. in OpenGL? i mean, yeah most of them are using particles but im looking for resources specifically on how to manipulate the particles to look like an effect that can be use for games,. i did fire particle before, and I want to learn how to do the other 'magic' as well.
      Like are there one book or link(cant find in google) that atleast featured how to make different particle effects in OpenGL (or DirectX)? If there is no one stop shop for it, maybe ill just look for some tips on how to make a particle engine that is flexible enough to enable me to design different effects/magic 
      let me know if you guys have recommendations.
      Thank you in advance!
    • By dud3
      How do we rotate the camera around x axis 360 degrees, without having the strange effect as in my video below? 
      Mine behaves exactly the same way spherical coordinates would, I'm using euler angles.
      Tried googling, but couldn't find a proper answer, guessing I don't know what exactly to google for, googled 'rotate 360 around x axis', got no proper answers.
       
      References:
      Code: https://pastebin.com/Hcshj3FQ
      The video shows the difference between blender and my rotation:
       
    • By Defend
      I've had a Google around for this but haven't yet found some solid advice. There is a lot of "it depends", but I'm not sure on what.
      My question is what's a good rule of thumb to follow when it comes to creating/using VBOs & VAOs? As in, when should I use multiple or when should I not? My understanding so far is that if I need a new VBO, then I need a new VAO. So when it comes to rendering multiple objects I can either:
      * make lots of VAO/VBO pairs and flip through them to render different objects, or
      * make one big VBO and jump around its memory to render different objects. 
      I also understand that if I need to render objects with different vertex attributes, then a new VAO is necessary in this case.
      If that "it depends" really is quite variable, what's best for a beginner with OpenGL, assuming that better approaches can be learnt later with better understanding?
       
    • By test opty
      Hello all,
       
      On my Windows 7 x64 machine I wrote the code below on VS 2017 and ran it.
      #include <glad/glad.h>  #include <GLFW/glfw3.h> #include <std_lib_facilities_4.h> using namespace std; void framebuffer_size_callback(GLFWwindow* window , int width, int height) {     glViewport(0, 0, width, height); } //****************************** void processInput(GLFWwindow* window) {     if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)         glfwSetWindowShouldClose(window, true); } //********************************* int main() {     glfwInit();     glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);     glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);     glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);     //glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);     GLFWwindow* window = glfwCreateWindow(800, 600, "LearnOpenGL", nullptr, nullptr);     if (window == nullptr)     {         cout << "Failed to create GLFW window" << endl;         glfwTerminate();         return -1;     }     glfwMakeContextCurrent(window);     if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))     {         cout << "Failed to initialize GLAD" << endl;         return -1;     }     glViewport(0, 0, 600, 480);     glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);     glClearColor(0.2f, 0.3f, 0.3f, 1.0f);     glClear(GL_COLOR_BUFFER_BIT);     while (!glfwWindowShouldClose(window))     {         processInput(window);         glfwSwapBuffers(window);         glfwPollEvents();     }     glfwTerminate();     return 0; }  
      The result should be a fixed dark green-blueish color as the end of here. But the color of my window turns from black to green-blueish repeatedly in high speed! I thought it might be a problem with my Graphics card driver but I've updated it and it's: NVIDIA GeForce GTX 750 Ti.
      What is the problem and how to solve it please?
  • Popular Now