PDA

View Full Version : HDR without shaders - It can be done the lamers way



NecroDOME
08-10-2006, 01:42 PM
The use of HDR lighning without shaders. It's possible!

Since our engine still has no shader support I tryed to make a HDR test. So here is the result.

I still need to blur the image to the lighning is not so "cubic".
http://necrodome.homeftp.net/zooi/ScagHdr.jpg (http://necrodome.homeftp.net/zooi/ScagHdr.jpg)

And some other results I from tweaking it:
http://necrodome.homeftp.net/zooi/hdr.jpg
http://necrodome.homeftp.net/zooi/HDR2.jpg
http://necrodome.homeftp.net/zooi/HDR3.jpg
http://necrodome.homeftp.net/zooi/Hdr4.jpg
http://necrodome.homeftp.net/zooi/hdroverkill.jpg

How it's done:
1. Render scene to texture (SceneTextre)
2. Render SceneTexture to a small texture (256x256) with some blending
- FDevice.SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ZERO);
- FDevice.SetRenderState(D3DRS_DESTBLEND, D3DBLEND_SRCCOLOR);
3. Render the SceneTexture to the screen
4. Add the 256x256 texture to the screen

ps. Sorry for the BIG image :P

JernejL
08-10-2006, 01:48 PM
i'm not sure you understand what HDR really is...

http://en.wikipedia.org/wiki/High_dynamic_range_rendering

hdr is not blurring the final picture, it is very specific lightning effect, which tries to simulate human eye iris and eye adaptation to dark and bright light when passing from bright to dark regions and the other way round.

Say you are looking into dark from bright area, you will see it totally dark, when you come there the lightning will begin to equalise and you will see it more clearly.

NecroDOME
08-10-2006, 01:58 PM
Well, it's not realy HDR, it's faked. But the result is nice.

tanffn
08-10-2006, 02:25 PM
As Delfi said, its not HDR but it surly is a nice effect :)

How are you planning to handle the transition between normal render and the ‘fake-HDR’ render?

Clootie
08-10-2006, 05:39 PM
Hm.., are you going to archive something alike Tron 2.0 rendering?
http://www.gamasutra.com/features/20040526/james_03.shtml

grudzio
08-10-2006, 08:05 PM
So, is it possible to do HDR without shaders?

WILL
08-10-2006, 08:38 PM
ps. Sorry for the BIG image :P

np. ;)

Cool effect btw! :D

tanffn
08-10-2006, 09:45 PM
So, is it possible to do HDR without shaders?

Why not?
Read Delfi's post.

Edit - I just remembered a few years ago I made a program that presented 12bit grayscale scan (NDT scanner we developed) to the screen (8 bit). With bias and gain you can ‘pen’ your intrest view => you have 12bit of data but only 8bit of data displayed.

Not your typical HDR in a sense that you might imagine it but HDR non the less.

NecroDOME
08-10-2006, 10:29 PM
How are you planning to handle the transition between normal render and the ‘fake-HDR’ render?

I can only enable/disable it. No other settings can be changed. thats basicly it.

NecroDOME
08-10-2006, 10:35 PM
Hm.., are you going to archive something alike Tron 2.0 rendering?

Well, I could do some glowing it I want. I can ajust the texture to some verry bright colors. That way it looks like its glowing. (not tryed it yet, but i'll think I do that soon)

Nitrogen
09-10-2006, 09:27 AM
I used a similar glow technique in my Chrome plugin...

You might want to blur the texture before rendering it back to the screen...

To blur it, you render the texture twice back onto the *same* texture you rendering, first with a shift to the left, then again with a shift to the right
(with transparency of course)

Then you take the updated texture and render it back onto the same texture again, this time shifting it up and down.

If you do this enough times, it will make a VERY nice blurred glow.
http://www.nitrogen.za.org/gallery/thumbs/Chrome%20(1).jpg
Fullsize pic: http://www.nitrogen.za.org/viewimage.asp?id=26

NecroDOME
09-10-2006, 11:51 AM
I was thinking to blur it pixel by pixel, but I think rendering it up/down would be better. (don't know if its faster).

Thanx for the idea.

Nitrogen
09-10-2006, 05:10 PM
It should definitely be faster... The more work you offload onto the GPU the better.

WILL
09-10-2006, 05:19 PM
Just be sure to add options for those features that some graphics cards might not handle so well... :)

I remember not being able to play some games on my old laptop bcause it was so old. The CPU was up to spec, but the graphics card just sucked. Sort of an extreme case since mine practically didn't have *any* 3D accelleration features whatsoever, but still maybe some players might not have pixel shaders 2.0 and instead have only 1.0, etc...

*shrug* It's just nice to be able to still play even though your graphics settings are set a bit lower to compensate.


BTW you killed your really BIG image. :P

NecroDOME
09-10-2006, 05:34 PM
No, I dind't killed my image, my server was down. Upgraded to Windows Server 2003... (and within 10 min I got my first BSOD)


Hm.., are you going to archive something alike Tron 2.0 rendering?
Comming back to this part: just tested it and its's possible :)

NecroDOME
11-10-2006, 08:02 PM
So I finnaly blured the texture. We got a better result, but it runs @ 3-4 FPS :(
http://necrodome.homeftp.net/zooi/Glow1.jpg
http://necrodome.homeftp.net/zooi/Glow2.jpg
http://necrodome.homeftp.net/zooi/Glow3.jpg

I think I need to go with Nitrogen's approach. Render and shifting it...

NecroDOME
11-10-2006, 08:58 PM
UPDATE:

Glow in the dark :D :D
http://necrodome.homeftp.net/zooi/Glow4.jpg

(as you can see, I did a bit of red-tron-glow on the players ship)

WILL
11-10-2006, 09:08 PM
Woo hoo! Tron-Glow rocks! :D