Author Topic: SSAO tests  (Read 4617 times)

Ariel Nehmad   «   Reply #15 on: August 12, 2015, 02:11:44 PM »
It really does :)

This is a minimalist example to show the basics so you get the idea and build from there.
It is really easy to get it working...the rest is just for you to have fun ;)

Some notes:

* in the lib folder there are new flsl and compiled libraries you need to copy/paste these into the IDE's lib installation folder in order to compile shaders with multiple outputs.

* I used 3 outputs (diffuse, normals and depth) and RGBA textures...but of course you can pack normals and depth into a single one and use half-float textures to get more precision if necessary....be creative ;)

* This method wont work if some material has lights disabled...and of course it will throw some random drawing errors as well..be careful ;)

* The output filter can read variables from the shared namespaces such as selfColor, specular, power, etc.. which are in flare.lights as well as inputs, fwNormal, vwNormal, vwPosition which are in flare namespace (see "02 shaders.flsl" lib).
You can use these also to write custom material properties and store those in the output textures for later use.

* If some material uses normal maps, skinning, some animated filters, etc...everything should work out of the box :)

Can't think of anything else right now....but there will be more stuff for sure :)
Attachments:

Tommy Svensson   «   Reply #16 on: August 13, 2015, 03:06:38 AM »
Right, tested this and it seems to work fine! :)
So, basically you are extending the lightfilter to output MRT textures instead.. ok, thats a clever idea.. :) So we dont need to swap the materials like before to make a basic deffered output..

But to do pointlights we still need to use the additional deffered lightpass, right?

Im working on a Physically-based material setup and rendering system, with Natural Bloom , AO and Screenspace reflections.. This means materials would have to have more properties.. like emmissive and reflection/blur maps... but i guess using your new method this could be done as a "deffered" filter stacked together with the regluar filters..?

Will you be including the updated flsl libs with the new version of the IDE?
« Last Edit: August 13, 2015, 03:42:53 AM by Tommy Svensson »

Ariel Nehmad   «   Reply #17 on: August 13, 2015, 04:24:05 AM »
Yep, once you have these geometry textures, we need to render all lights to a different texture using the normals, depth, etc..previously rendered.
After that, the final step would be just to compose everything together to get the final picture...or add any additional required effect.

You don't need to add more filters to the materials, unless you need that for some specific reason.
For example, you can use the self color filter to set the material emmissive color, and use specular color / power to store reflection data / blur...then you can read these from the output filter and write those values into a different output texture.
It is also possible to add more shared namespaces with more custom data...but that's for another post ;)

For example, with only 2 textures:
Texture A : colorR, colorG, colorB, emissive.
Texture B : normalX, normalY, normalZ, depth.
You can also pack just normal X and Y and restore the Z later, and you get one additional channel for another thing.

These are the libs that we're currently using on the engine, so, yes, these will be included in the next IDE version :)
« Last Edit: August 13, 2015, 04:26:12 AM by Ariel Nehmad »

Tommy Svensson   «   Reply #18 on: August 13, 2015, 09:39:17 AM »
This is so cool. It makes all the MRT process easy! And to have access to the variables is just perfect! I've been doing the deffered rendering the "old" way but this is so much more practical!

..specular is infact reflection so thats a good place to put it.. but to get things like roughness value/map, ao and custom options etc ..custom data in the shared namespace would indeed be awesome :)

I think is very cool MRT workflow deserves it own thread now :) :)
« Last Edit: August 14, 2015, 02:47:05 AM by Tommy Svensson »

Tommy Svensson   «   Reply #19 on: August 14, 2015, 02:43:31 AM »
It seems zf3d files work fine with the new MRTFilter, but not the F3DLoader :)

TypeError: Error #1009: Cannot access a property or method of a null object reference.
flare.loaders::F3DScene/loadSceneProperties at Z:\projects\flare3d 2.5\src\flare\loaders\F3DScene.as:47
« Last Edit: August 14, 2015, 02:46:40 AM by Tommy Svensson »

Ariel Nehmad   «   Reply #20 on: August 14, 2015, 11:46:08 AM »
Fixed here! ;)

The switch scene method loads all lights and scene properties from the original f3d scene, but in this case...there may not be there the same properties as it is a different light filter....so we'll just ignore all those settings except from the camera.

Tommy Svensson   «   Reply #21 on: August 14, 2015, 03:33:51 PM »
Ah, great. Tested again, it works! :)

Just a question, is the extended light MRT filter expecting 3 outputs? How can i change it?
I'm having trouble using output fragment[4] or less than 3..
« Last Edit: August 14, 2015, 03:35:41 PM by Tommy Svensson »

Ariel Nehmad   «   Reply #22 on: August 15, 2015, 02:03:58 AM »
There are up to 4 output targets when using MRT (0, 1, 2, 3).
The fragment[0], is what we usually use as "output fragment = xxxx" in all regular filters...that's why we are not overriding it...as we want to keep the original color in the first texture.

You can use as many as you want (up to 4), but the number of outputs you write, need to match exactly the number of textures you set on the AS3 side.
« Last Edit: August 15, 2015, 03:12:23 AM by Ariel Nehmad »

Tommy Svensson   «   Reply #23 on: August 23, 2015, 09:02:26 AM »
Yes, i know... but actually it seems the problem is with using HALF_FLOAT textures.. Using HALF_FLOAT textures others places in the deffered rendering (for other posteffects) work fine, but if i try to render to a HALF_FLOAT texture from the MRT filter, ALL textures go black (including the normal RGBA ones) ...

Any idea whats going on? :)

Tommy Svensson   «   Reply #24 on: September 16, 2015, 02:04:09 PM »
Any idea about this issue? :) All textures go black when i render to HALF_FLOAT in the MRT filter.. Did i miss something or is it a bug?

Tags: