Sign in to follow this  
JavaCoolDude

OpenGL New Demo: Glow

Recommended Posts

JavaCoolDude    670
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
Moe    1256
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
JavaCoolDude    670
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
Boruki    698
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
Toji    535
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
zedzeek    528
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
twanvl    512
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
Optus    422
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
JavaCoolDude    670
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
JavaCoolDude    670
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
DrGUI    402
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
ff8    134
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
JavaCoolDude    670
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
Mattman    336
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
Toji    535
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
CRACK123    235
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
JavaCoolDude    670
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  

  • Similar Content

    • By povilaslt2
      Hello. I'm Programmer who is in search of 2D game project who preferably uses OpenGL and C++. You can see my projects in GitHub. Project genre doesn't matter (except MMO's :D).
    • By ZeldaFan555
      Hello, My name is Matt. I am a programmer. I mostly use Java, but can use C++ and various other languages. I'm looking for someone to partner up with for random projects, preferably using OpenGL, though I'd be open to just about anything. If you're interested you can contact me on Skype or on here, thank you!
      Skype: Mangodoor408
    • By tyhender
      Hello, my name is Mark. I'm hobby programmer. 
      So recently,I thought that it's good idea to find people to create a full 3D engine. I'm looking for people experienced in scripting 3D shaders and implementing physics into engine(game)(we are going to use the React physics engine). 
      And,ye,no money =D I'm just looking for hobbyists that will be proud of their work. If engine(or game) will have financial succes,well,then maybe =D
      Sorry for late replies.
      I mostly give more information when people PM me,but this post is REALLY short,even for me =D
      So here's few more points:
      Engine will use openGL and SDL for graphics. It will use React3D physics library for physics simulation. Engine(most probably,atleast for the first part) won't have graphical fron-end,it will be a framework . I think final engine should be enough to set up an FPS in a couple of minutes. A bit about my self:
      I've been programming for 7 years total. I learned very slowly it as "secondary interesting thing" for like 3 years, but then began to script more seriously.  My primary language is C++,which we are going to use for the engine. Yes,I did 3D graphics with physics simulation before. No, my portfolio isn't very impressive. I'm working on that No,I wasn't employed officially. If anybody need to know more PM me. 
       
    • By Zaphyk
      I am developing my engine using the OpenGL 3.3 compatibility profile. It runs as expected on my NVIDIA card and on my Intel Card however when I tried it on an AMD setup it ran 3 times worse than on the other setups. Could this be a AMD driver thing or is this probably a problem with my OGL code? Could a different code standard create such bad performance?
    • By Kjell Andersson
      I'm trying to get some legacy OpenGL code to run with a shader pipeline,
      The legacy code uses glVertexPointer(), glColorPointer(), glNormalPointer() and glTexCoordPointer() to supply the vertex information.
      I know that it should be using setVertexAttribPointer() etc to clearly define the layout but that is not an option right now since the legacy code can't be modified to that extent.
      I've got a version 330 vertex shader to somewhat work:
      #version 330 uniform mat4 osg_ModelViewProjectionMatrix; uniform mat4 osg_ModelViewMatrix; layout(location = 0) in vec4 Vertex; layout(location = 2) in vec4 Normal; // Velocity layout(location = 3) in vec3 TexCoord; // TODO: is this the right layout location? out VertexData { vec4 color; vec3 velocity; float size; } VertexOut; void main(void) { vec4 p0 = Vertex; vec4 p1 = Vertex + vec4(Normal.x, Normal.y, Normal.z, 0.0f); vec3 velocity = (osg_ModelViewProjectionMatrix * p1 - osg_ModelViewProjectionMatrix * p0).xyz; VertexOut.velocity = velocity; VertexOut.size = TexCoord.y; gl_Position = osg_ModelViewMatrix * Vertex; } What works is the Vertex and Normal information that the legacy C++ OpenGL code seem to provide in layout location 0 and 2. This is fine.
      What I'm not getting to work is the TexCoord information that is supplied by a glTexCoordPointer() call in C++.
      Question:
      What layout location is the old standard pipeline using for glTexCoordPointer()? Or is this undefined?
       
      Side note: I'm trying to get an OpenSceneGraph 3.4.0 particle system to use custom vertex, geometry and fragment shaders for rendering the particles.
  • Popular Now