Jump to content


hdr lighting


12 replies to this topic

#1 darksmaster923

    New Member

  • Members
  • PipPip
  • 34 posts

Posted 18 August 2007 - 07:00 PM

i am learning the cg so is there any tutorials on making hdr with cg

#2 Reedbeta

    DevMaster Staff

  • Administrators
  • 4979 posts
  • LocationBellevue, WA

Posted 18 August 2007 - 07:18 PM

Try the nVidia SDK samples, here and here (note that you'll need a good video card, at least a GeForce 6 series).
reedbeta.com - developer blog, OpenGL demos, and other projects

#3 Kenneth Gorking

    Senior Member

  • Members
  • PipPipPipPip
  • 911 posts

Posted 19 August 2007 - 02:47 PM

The ATI SDK also has some nice samples, and they only require a Radeon 9700 :)
"Stupid bug! You go squish now!!" - Homer Simpson

#4 goruka

    Member

  • Members
  • PipPip
  • 33 posts

Posted 27 August 2007 - 03:16 PM

I haven't implemented this yet, but i'm in doubt regarding the usefulness of the NVIDIA "paper" on that.. it says basically that you have to render the scene twice (second time in less resolution and with non-glowing objects as black). If the whole scene has a lot of glow, i can see this as ok, but if you only want a few glowy objects, rendering the whole thing again, black sucks. I haven't investigated enough, but can't the depth buffer just be kept/copied or rescaled/offseted back a bit by a fragment program and then render over that only the glowy objects?

#5 J22

    Member

  • Members
  • PipPip
  • 92 posts

Posted 27 August 2007 - 05:03 PM

For HDR rendering it's not necessary to process glowing objects differently from the rest. Because you render everything to a HDR render target, you get proper information for doing bloom & tone mapping post processing effects.

#6 Reedbeta

    DevMaster Staff

  • Administrators
  • 4979 posts
  • LocationBellevue, WA

Posted 27 August 2007 - 06:24 PM

goruka, another approach is just to do it all in one rendering pass, rendering the normal color into RGB and the "bloominess" or "glowiness" in the alpha channel. Then when you go to do the blurring and so forth, you take the 'bloom color' to be RGB * A.

Or, you could use multiple render targets to output both the color buffer and the bloom buffer at the same time.
reedbeta.com - developer blog, OpenGL demos, and other projects

#7 TheNut

    Senior Member

  • Moderators
  • 1473 posts
  • LocationThornhill, ON

Posted 27 August 2007 - 07:10 PM

The thing I don't get about HDR is why it's always related to glow effects. HDR is supposed to eliminate over-exposure (ie: glows) as well as under exposure, yet every time I see HDR equates to highly unrealistic blooming. Almost as if the entire screen was wiped with a dirty rag.

The best way I see HDR implemented is through global illumination or use of ambient occlusion maps. Soft lighting with no-harsh shadows what you're aiming for.
http://www.nutty.ca - Being a nut has its advantages.

#8 Reedbeta

    DevMaster Staff

  • Administrators
  • 4979 posts
  • LocationBellevue, WA

Posted 27 August 2007 - 09:33 PM

Heh. yeah, glow/bloom effects aren't really HDR, just a nice effect that makes LDR look cooler.

But I'm not sure I understand what you mean saying that HDR can be implemented through global illumination or ambient occlusion. It's not about getting more realistic light transport, just about compensating the fact that light in the real world has a much greater range of brightnesses than the light that can be emitted from a computer screen. But you can do HDR just as well with hard shadows and point-lights as you can with GI and so forth. (Not that GI won't make it look even better!)
reedbeta.com - developer blog, OpenGL demos, and other projects

#9 darksmaster923

    New Member

  • Members
  • PipPip
  • 34 posts

Posted 27 August 2007 - 09:35 PM

i forgot to mention that im using the cg in panda3d
SIR PLEASE HOLSTER I AM THE LAW

#10 TheNut

    Senior Member

  • Moderators
  • 1473 posts
  • LocationThornhill, ON

Posted 28 August 2007 - 12:27 AM

Reedbeta, true they're unrelated, but the correctness as a result contributes to the HDR factor.

Here's an example of what the industry classified as "HDR"
Posted Image
In truth, it's neither HDR or LDR. You have an overblown sky, which would suggest the steal beams should be very bright, but instead they're dark yet the grey metal on the gun is quite bright. The grass displayed in the middle should also have a pale green / white look, but instead they're rendered correctly. Twilight zone ;)

Posted Image
Now this image on the other hand shows perfect LDR, but again someone out there classified this as HDR.

Anywho, that's my unnecessary rant for this evening ;)

darksmaster, Cg for panda or any other engine doesn't matter. Cg is Cg. The languages are also fairly similar between HLSL, GLSL, and Cg. Take a look at the shaders in the HDR sample from the nVidia link posted earlier in this thread. They're HLSL fX format, but the calculations for tone mapping and blurring are straightforward.
http://www.nutty.ca - Being a nut has its advantages.

#11 laweya

    New Member

  • Members
  • PipPip
  • 29 posts

Posted 28 August 2007 - 03:39 PM

HI,

What exaclty is the difference between HDR and bloom?

#12 Reedbeta

    DevMaster Staff

  • Administrators
  • 4979 posts
  • LocationBellevue, WA

Posted 28 August 2007 - 04:18 PM

In HDR you calculate the lighting using floating-point values - so you're not limited to the [0, 1] range for brightnesses. In order to display it on a monitor, which is only capable of [0, 1] brightnesses, it undergoes tone mapping, which maps the arbitrarily large brightnesses into the [0, 1] range according to some equation (for instance, exposure).

Bloom is a technique whereby very bright areas of the screen are blurred and added back into the image, mimicking the effects of bright light scattering in the lens of your eye, and therefore giving the impression that things on screen are brighter than they actually are.

Bloom can be applied in both LDR and HDR rendering (in the latter as a part of the tone mapping process).
reedbeta.com - developer blog, OpenGL demos, and other projects

#13 J22

    Member

  • Members
  • PipPip
  • 92 posts

Posted 28 August 2007 - 06:34 PM

TheNut said:

The thing I don't get about HDR is why it's always related to glow effects.
Bloom effect is roughly something you would see if you would have HDR monitor to display the dynamic range that's rendered out :)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users