sargon, Member Posted: 17 October 2011 07:24 PM Total Posts: 51
Hi,
I have been working with filters on A3D 3.6 fine, but I see that there is changed concept of using filters in 4.0, can anyone support me with peace of code that shows how to use filters in 4.0 please ?
I can’t get it by my self :/...
How to apply filter for eg. Sprite3d ? or any primitive, objectContainer3d?
I know how to use filters on view but I wanna to apply filters only to some objects.
can any one help ?
Richard Olsson, Administrator Posted: 18 October 2011 07:21 AM Total Posts: 1192
[ # 1 ]
3D objects in Away3D 3.x were just regular, layered Flash display objects, which meant it was really easy to apply filters to them. In Away3D 4.0 no such connection exists (nor is it emulated) which means, simply put, that it’s not possible to use filters on single objects in Away3D 4.0.
sargon, Member Posted: 18 October 2011 12:16 PM Total Posts: 51
[ # 2 ]
thanks for reply!
so maybe there is any MaterialMethod whitch can be used similar to feg. blur filter or something like that?
or is there any posibilyty that filter will be implemented to use on primitive in A3D 4.0 ?
kornwaretm, Newbie Posted: 18 October 2011 01:55 PM Total Posts: 21
[ # 3 ]
using fog via material
var material:BitmapMaterial = new BitmapMaterial(bitmapData);
var fog:FogMethod = new FogMethod(1000, 0x75abf3);
material.addMethod(fog);
other filters check in the API they are at away3d/filters/
to apply them use
_View3D.filter3d = [filter1,filter2]
i’m sure that making a custom shader is posible too, i haven’t try it.
sargon, Member Posted: 18 October 2011 02:58 PM Total Posts: 51
[ # 4 ]
kornwaretm thanks for reply :} but I didn’t ask for exaplme of using fog I think you have readed (feg which means “for example”) like fog but thanks a lot …
Choons, Sr. Member Posted: 19 October 2011 08:26 AM Total Posts: 281
[ # 5 ]
so back to the original question- where do filters get added in code? At the view level? Like how would a bloom filter affect a scene?
Alexander Seifert, Moderator Posted: 19 October 2011 12:37 PM Total Posts: 129
[ # 6 ]
yes, at view level.
View3D offers property getter / setter filters3d, which is of type Array and can contain any number of Filter3DBase objects. There are some filters delivered with broomstick and work out of the box, such as BloomFilter3D, BlurFilter3D, DepthOfFieldFilter3D, MotionBlurFilter3D and RadialBlurFilter3D.
The filter array will be processed first to last, where the render result of a previous filter is handed over to its following to continue processing. Hence its possible, for example, to create ultra smooth blurs by using several blur passes in a row.
The filters always work with the final rendered scene (hence, post processing), so you can’t single out any objects individually for post processing. As the input is a texture, processing typically takes place all in fragment shaders.
Be advised that performance of these post processing filters are highly dependent on the throughput / fill rate of the shaders on any given GPU. Out of my experience most mobile GPUs older than 1 generation are not able to process full screen post processing filters.
kornwaretm, Newbie Posted: 19 October 2011 12:51 PM Total Posts: 21
[ # 7 ]
to create a “fillter” i think you mean custom shader, which can be applied to a singgle object 3D via material method. It is posible to write a custom pixel shader. i read some line inside the away3d.materials.methods.BasicDiffuseMethod . they are some low level shader code which are rather similar to HLSL or GLSL. if you are familiar with these shader language i’m sure there will be no problem to make your own shading method. i’m going to dig in to this.
TheSillyOne, Newbie Posted: 01 November 2011 11:18 AM Total Posts: 28
[ # 8 ]
You can create a lot of filters via (post) processing framebuffers with shaders. You would have to implement them yourself, though.