Raydium 3D Game Engine

Official forum for everything about Raydium, ManiaDrive, MeMak, ...
It is currently Thu Mar 28, 2024 10:34 pm

All times are UTC




Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: ¿HDR?
PostPosted: Tue Apr 04, 2006 1:09 am 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
Stencil buffer for the HDR feature :) great.
But i still have no clear what is HDR. Is the way to get effects like the burning lights and so?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 04, 2006 7:04 am 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2591
Location: gnniiiii (Scrat)
Yeah ! The idea here is "pseudo-HDR" (real HDRI will ask too much for low end video cards), allowing (like you said) things like :

http://ftp.cqfd-corp.org/raycap2006-03-30-072849-00.jpg
http://ftp.cqfd-corp.org/pseudo-hdr-scene-final.jpg

I'm almost ready to commit all this, since it needs "only" documentation and a demo. Working on it ! ... :)

PS : The only details that I can give about pseudo-HDR for Raydium are in french for now: http://blogs.nofrag.com/Xfennec/2006/ma ... seudo-hdr/


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 04, 2006 9:15 am 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
great explanation.
And the shadoww of the collosus "make of" is great also, i have stored the url :)

One point. Currently the effect is a bit fog-like, i suppose the reason is the method to put the final texture over the image. Have you tried to use "burning" methos for aply the texture? I mean like if the texture would be a fire particle. I imagine the effect could be more burning-like in this way.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 04, 2006 9:24 am 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
Image
I mean effect like this, that is a little more burning and less foggy. It can be obtained (aprox) with a sum/addition kind of fusion. I have done it with gimp so i'm not sure what is the opengl equivalent for that kind of fusion.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 04, 2006 9:59 am 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2591
Location: gnniiiii (Scrat)
You're right. On both things: (1) it looks foggy and (2) it's hard to do anything else than a "GL_ADD" to blend the texture over the scene. Can you give me more details about "layer more" function(s) that you're using in your picture ?

One thing : this is only a temporary effect (a few seconds), so it seems less foggy on screen than on thoses pictures.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 04, 2006 11:15 am 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
more details? hmmm...
Do you have gimp right?
Well i have opened pseudo-hdr-scene.jpg. After i have put over the layer the pseudo-hdr-stencil-final.jpg
Then i change the Mode of the layer with the stencil to suma(spanish, but it should be "add" in english version).
The way it works:
black color doesn't have effect over the image. White color will "add" its value to the image values, in that way the colors can be "burned" if they become 1 or more (clamped to 1) In the example image as you can see the main of the sky is clamped to (1,1,1) givin that burning efect.
If you noticed the "trees" (the green objets under the glow) in this image the green is intensificate, but in the transparent version the color is weakened.

I suppose, but i'm not usre, that the opengl stuff to make that effect could be:
glEnable(GL_BLEND);
glBlendFunc(GL_DST_COLOR,GL_SRC_COLOR);
and so on


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 04, 2006 11:17 am 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
maybe

glEnable(GL_BLEND);
glBlendFunc(GL_DST_COLOR,GL_ONE_MINUS_SRC_ALPHA);

it's a try-error matter :)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 04, 2006 12:07 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2591
Location: gnniiiii (Scrat)
You got my curiosity :)

After doing this test in Gimp, the main difference here is that Gimp is not using blending for its "add" operation.
See : Do what you describe in your last post. Then, right-click on the top layer (blurred stencil with "add" mode), and add "a layer mask" (something like that ... I'm using french version ;) ) with "greyscale layer copy".

The result must be exactly the same as with Raydium. So the real question is : "how to make an alpha texture to behave like a RGB one" during a GL_ADD operation :)

I'll make some tests.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 04, 2006 2:24 pm 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
well, when you release the files i'll also do some test.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 04, 2006 2:54 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2591
Location: gnniiiii (Scrat)
Ok, done (commit 273). Please note that API is not finalized yet.

You can add something like this before calling raydium_callback() in main() :
Code:
raydium_hdr_enable();
raydium_hdr_texture_name("BOXfront.tga",1);
raydium_hdr_texture_name("BOXback.tga",1);
raydium_hdr_texture_name("BOXleft.tga",1);
raydium_hdr_texture_name("BOXright.tga",1);
raydium_hdr_texture_name("BOXbottom.tga",1);
raydium_hdr_texture_name("BOXtop.tga",1);


This will set all skybox textures as "HDR emitters". The interesting part is in raydium/hdr.c around line 260.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 04, 2006 5:35 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2591
Location: gnniiiii (Scrat)
(see above post if needed)

Is this better ? :) :
http://ftp.cqfd-corp.org/raycap2006-04-04-164800-00.jpg

This new method allows some interesting effects (like sunset, for example) :
http://ftp.cqfd-corp.org/raycap2006-04-04-165206-00.jpg

This is done using glBlendFunc(GL_ONE,GL_ONE) and an RGB hdrmap.
I will commit this new version after a few cleanups.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 04, 2006 7:58 pm 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
Yesss
That's the way :)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 04, 2006 8:46 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2591
Location: gnniiiii (Scrat)
Yep. Thanks a lot for your idea :)
I've commited the new version.

There's a big problem with the whole thing on my other computer under win32 : it sloooooooooow ... (1 FPS)
glReadPixels + GL_STENCIL_INDEX seems to be software emulated ! Working on it ...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 05, 2006 8:00 am 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
a few things:

1-.if i maximize the window, i get a segment fault (linux)
2-the raydium_hdr_blur is a good candidate to make asm optimizations in a future :)
3-the downscaling section is made by software. Is better in that way instead of using opengl?
4-Can you explain which method are you using to know if the effect should be reseted/activated?
5-i have made a new commit with a second pass of the hdr, greater and softer, to make like an ambiental glow. What do you think about?
6-idea. The glow effect could be slightly tinted with the "main" color of the scene.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 05, 2006 8:06 am 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
one more thing
Has you played Shadow of the collosus?
In the game the effect is not apllied inmediatelly. So if you exit from a dark place to a exterior place, the HDR effect takes 0.5 seconds aprox to ba fully active. There is a quick fade-in of the effect, and after that there is a slow fade-out in the effect.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 26 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group