marc_antoine
29-01-2007 19:20:08
hey guys is there any tutorial of how to use compositors in MOGRE? specific to HDR and BLOOM?
thanks in advance.
handcircus
30-01-2007 11:25:11
Hi Marc,
Its very simple. You need to have the compositor scripts, material scripts, textures and cg programs in your media directory, then you just enable the compositor on the viewport by:
CompositorManager.Singleton.AddCompositor(viewport, "Bloom");
CompositorManager.Singleton.SetCompositorEnabled(viewport, "Bloom", true);
The example files you need for bloom are:
Examples.compositor
Blur0_vs.glsl
Blur1_vs.glsl
Blur_ps.glsl
StdQuad_vp.glsl
Blur0_ps20.hlsl
Blur0_vs11.hlsl
Blur1_ps20.hlsl
Blur1_vs11.hlsl
Bloom.material
StdQuad_vp.program
(think thats it. if in doubt, just copy the ogre media directory!)
marc_antoine
30-01-2007 17:03:55
hi handcircus,
i tryed the code, it works fine but the compositor, but i got a unexpected result, with bloom it works as expected:
but when i use HDR instead i got a burned image, i was expecting something like Bloom but more defined like in the Ogre executable Demos that are available for download here:
http://www.ogre3d.org/index.php?option=com_remository&Itemid=57&func=fileinfo&filecatid=40&parent=category
this is what i got with HDR:
so any help? :S
and also is ther a way to apply the compositor only to the skybox? for example or a particular mesh in the scene?
oh and is there a way to get a qualified list of compositors names to use in OGRE? or how do i get the names?..
BTW i simplyfied the code to this:
CompositorInstance comp= CompositorManager.Singleton.AddCompositor(cam.Viewport, "MotionBlur");
comp.Enabled = true;
sorry for making very basic questions..
Bekas
30-01-2007 20:41:28
Generally, for Ogre-specific questions, I encourage people to post to the main forums, where a vast number of Ogre experts "hang out". (after searching the forums of course).
Don't put 'Mogre' on the topic, to avoid getting locked accidentally.
If you are presented with a C++ snippet that you don't know how to translate to Mogre, please post it here.
CK_MACK
31-01-2007 04:21:31
Just a quick slightly off topic thing...
Be careful using Bloom...and HDR, too much of it can make what used to be a beautiful scene .. a blurry over saturated eye strain.
Used Judiciously, it can make a scene look fantastic.
Marc.
linkerro
05-02-2007 06:03:21
Just a quick question, does the compositor demo work for you when you have hdr enabled?
marc_antoine
05-02-2007 06:10:42
hi linkerro, yes it does... that's why i wanted to try HDR , i dont' know why in the Demo works fine, (the demos are compiled demo's so no source code is availabe) that's why i wanted to know if there is a tutorial or a how to for compositors. if anyone hve used compositors and works fine please share your knowledge
linkerro
05-02-2007 06:24:12
I used them and they worked fine for me. However I didn't use the HDR demo. At the time I was just interested in the glass one. Check out the C++ source code for the compositor demo and see if there's anything there that might cause this to fail. As I recall some compositors needed some more stuff that could be done before they got called (the glass one needs for a texture to be populated, or was it just the shader, can't remember
![Very Happy :D]({SMILIES_PATH}/icon_biggrin.gif)
).
marc_antoine
05-02-2007 06:40:26
would you post the code for the glass effect? or do lil simple application to show how do you use the glass compositors, it doesnpt matter if it is c++. i belive that could be useful information
linkerro
05-02-2007 07:28:50
I'm sorry to inform you that the code you're asking me for doesn't exist anymore. I modified it to suit my needs (use the glass shader on a sprite). At this point in time the code for that is somewhere in an archive in my mail account.
However I recommend taking a look at the demo for the compositor. Try to compile the c++ version that comes with the ogre that comes with your version of mogre. As I recall the compiled demos are quite old, so there may be something broken in your version of it. The best solution would be upgrading to the latest mogre.
As for applying the compositor for specific meshes there might be a way to make it work. The compositor works like this. It renders the scene to a texture, runs a shader on that texture, and then it displays that texture on screen. What you could do is hide the meshes you don't want to have the effect on, render to the texture, apply the shader, hide the already rendered meshes, unhide the others and render them on the existent texture. If you're wondering how to set this up take a look at the Fresnel demo. It does something quite similar.
linkerro
05-02-2007 07:36:04
By the way, I noticed handcircus posted the files you needed for the blur compositor to work, did you also copy the files from the hdr compositor?
marc_antoine
06-02-2007 02:02:26
yep i did, the above screenshots are from the latest MOGRE using bloom and HDR, i already have the files hrdcircus point me, i ill try to tke a look to the fresnel demo as well as the link bekas posted, if i get something i will let you know....if you get your code would be nice if you post it here.
oh BTW thanks for helping out guys.