Author Topic: MRT + AGAL2 support?  (Read 8602 times)

Tommy Svensson   «   on: May 05, 2014, 04:46:46 AM »
Hi Ariel!
Will you be adding (back) support for MRT + AGAL 2.0 in the next release? :)

Ariel Nehmad   «   Reply #1 on: May 05, 2014, 08:58:48 AM »
I guess this answer the question :D

This first one is deferred + emissive lighting using MRT and HALF_FLOAT texture formats.

We have everything in pace (ddx, ddy, mrt, output depth, jumps, half float textures and anisotropic filtering) :D it will require some testing though, specially the conditional jumps, but it is already working ;)
« Last Edit: May 05, 2014, 09:04:00 AM by Ariel Nehmad »

Tommy Svensson   «   Reply #2 on: May 07, 2014, 12:49:38 AM »
:) :) :) That's awesome!
Any plans for implementing AO also?

Johannes   «   Reply #3 on: May 07, 2014, 06:55:05 AM »
Hey Ariel, any chance of getting a dev build to play with, with these AGAL2 features? :)

How are you intending to support older targets (flash player versions that don't have agal2)? The flash player version that supports AGAL2 is still in beta, so i guess not everybody will want to use it yet.

Ariel Nehmad   «   Reply #4 on: May 08, 2014, 07:52:17 PM »
I haven't fully tested this yet, but the latest dev build should be capable of using all the new features.

in order to use the new things, you need to set FLSL.agalVersion = 2 before creating the scene and also set Device3D.profile to be the new Context3DProfile.STANDARD, as well as using the correct swf-version, playerGlobal.swc and FP versions ;)

the IDE will need to be updated, but you should be able to compile shaders using ddx, ddy, output depth, and mrt, although you'll get some warnings because the IDE is not able to render those yet.

Conditionals should be available as well in the next IDE version, we found a few issues there which we already reported to FP team and will be fixed in the next release ;)

Attached is the updated version of the old agal2 example you can use as a staring point.

Things like AO and other nice list of effect will be easier to implement with the new set of features for sure, although some of them are very expensive in terms of performance ;)
« Last Edit: May 08, 2014, 08:27:18 PM by Ariel Nehmad »

Johannes   «   Reply #5 on: May 09, 2014, 07:32:40 AM »
Thanks for the library Ariel.

It works, but it turns out we actually didn't get much use out of it :P
We don't write custom shaders for our project very often, and to take advantage of AGAL2 i guess we would have to do that.

The features we were more interested in were anisotropic filtering, and "better" antialiasing.

For anisotropic filtering we would need an updated Flare3D IDE which lets us set this as a filtering mode on a texture.

As for antialiasing, i might have read the AIR release notes wrong. I was hoping for a new kind of antialiasing (somehow), but it seems the new feature is just being able to use antialiasing when rendering to a texture. Which we currently don't do.

Eric Pascal   «   Reply #6 on: June 24, 2014, 12:35:55 AM »
I'm trying to use the dev build to add a realistic brushed metal texture using HALF_FLOAT normal map for watchmaking industry (8bit normalmap tend to have not enough quality).
Do you know if I can use the normalmap filter directly and how I can load a HALF_FLOAT texture file ?
Is it possible to use a 64bit PNG as source for the HALF_FLOAT Texture ?
Thank you
« Last Edit: June 24, 2014, 09:11:21 AM by Eric Pascal »

Daimon Fox   «   Reply #7 on: June 24, 2014, 01:58:29 AM »
I have a problem at the firings in Flash CS6 Example Test51_AGAL2_Test
Error Line 36, 1120: the Reference of nonexistent property Context3DProfile.

Ariel Nehmad   «   Reply #8 on: June 24, 2014, 09:23:14 AM »
@Eric, tbh, I haven't tried, but i guess flash API will convert the 64bit texture by a 32bit when loading, so I don't think you'll be able to upload such a texture.
Anyway, I'm not sure a more bit depth will give you more quality in this case, but a higher resolution may help.

@Daimon, make sure you are using the correct playerGlobal.swc, otherwise Flash wont find the correct references.

Eric Pascal   «   Reply #9 on: June 24, 2014, 11:30:36 PM »
Here is a screenshot of the circular brushed metal rendering I have.
You can clearly seen reflection stripes on the metal corresponding to a variation of 1 in the normal vector orientation.
It's annoying to do qualitative rendering.
I have attached the screenshot and the texture.

Ariel Nehmad   «   Reply #10 on: June 25, 2014, 04:29:36 AM »
Hi Eric, can you post the normal map texture again? seems missing.

It seems to me not a problem with the normal map, but with the tangent/bitagent vectors which are generated at runtime.
I would like to try to reproduce it here using the same map *when available), but if you can also send us the test model to info@ it will really help to fix this in case it is a bug.

Eric Pascal   «   Reply #11 on: June 25, 2014, 04:39:33 AM »
I have sent the email.
I have also attached the model in the forum.
« Last Edit: June 25, 2014, 07:27:46 AM by Eric Pascal »

Tommy Svensson   «   Reply #12 on: July 07, 2014, 03:27:04 AM »
The dev build does not work properly?

This code (in the renderEvent handler):
for each ( var p:Pivot3D in scene.renderList ) p.draw(false);

Gives me:

Error: Error #3774: Slot mismatch: Render texture  is set, but slot  is not set.
   at flash.display3D::Context3D/drawTriangles()
   at flare.flsl::FLSLMaterial/draw()[Z:\projects\flare3d 2.5\src\flare\flsl\]
   at flare.materials::Shader3D/draw()[Z:\projects\flare3d 2.5\src\flare\materials\]
   at flare.modifiers::Modifier/draw()[Z:\projects\flare3d 2.5\src\flare\modifiers\]
   at flare.core::Mesh3D/draw()[Z:\projects\flare3d 2.5\src\flare\core\]

Using AIR 14 -swf-version=25

Any chance of fixing this? I need to work with the new AGAL2 stuff :)
« Last Edit: July 07, 2014, 03:33:38 AM by Tommy Svensson »

Ariel Nehmad   «   Reply #13 on: July 09, 2014, 08:04:57 AM »
Hi Tommy, are you using the provided example?
I have uploaded the latest dev build we have, it is not fully tested but I run the example and all seems to be working fine.
Let me know.
« Last Edit: July 10, 2014, 05:58:15 AM by Ariel Nehmad »

Tommy Svensson   «   Reply #14 on: July 09, 2014, 02:56:56 PM »
I found the error, it was just that in the example
scene.endFrame() is called before scene.context.setRenderToBackBuffer()
and that causes the problem.

So moving it after setRenderToBackBuffer fixes it ofcourse. :)
« Last Edit: July 09, 2014, 03:59:04 PM by Tommy Svensson »