Support for Post Filters in jMonkeyPlatform added

Hey monkeys!



I added support for editing, loading and saving chains of post effects to jMP, a new file format (j3f) has been added to directly save FilterPostProcessors.



New filter chains can be created using the New File menu, when creating or opening a j3f file, the new “FilterExplorer” window shows the filters in the filter chain. Select a filter to show its properties in the properties window, right-click the filter root node to add new filters.



http://i.imgur.com/Lo8Bm.jpg



You can display a loaded filter chain in the SceneViewer for any plugin using the newly added button in the SceneViewer.



FilterPostProcessors that are saved as .j3f files and can be loaded via the assetManager:

[java]

FilterPostProcessor processor = (FilterPostProcessor) assetManager.loadAsset(“Filters/MyFilter.j3f”);

viewPort.addProcessor(processor);

[/java]



Known Issues

- As it seems there is some issues with certain graphics systems where the filters are not displayed in the SceneViewer

  • Some filter parameters might not get serialized correctly yet



    Cheers,

    Normen
8 Likes

WOW! Nice Work @normen!



Using windows @normen:stuck_out_tongue:

glaucomardano said:
Using windows @normen... :P


Hahah... careful or you will make the forums crash. ;)

I think @nehon created the image for him if that's what you are talking about. :)

Yeah, I am one of the people experiencing issue #1 on Mac :smiley:

Sounds cool! Definitely y Gonna check this out in the following days.

Windows FTW!!! :D, yeah don’t worry I did the screenshot, Normen didn’t get anywhere close to a Windows OS :wink:

Me likey! Very cool.

sweet!

are there any tutorials floating around on the wiki on how to use Filters and Post-Processors?

i dont know much about them and i have only seen this page which doesnt go into much detail.

Well if you edit them visually theres not much more code than the lines I wrote in the post :slight_smile: Of course the wiki has all the info :stuck_out_tongue:

yeah well…I should make a proper doc, at least to explain how it works, and the common pitfalls to avoid when using them.

Hi,



this is awesome. Just something that I picked up, the Delete button is grayed out in the FilterExplorer window when trying to delete a newly added filter.



cheers

jatheron said:
Just something that I picked up, the Delete button is grayed out in the FilterExplorer window when trying to delete a newly added filter.

Yeah I know, don't get why though at the moment ^^ But theres anyway still some things to be added, this plugin will evolve just like the others :)

How do I add my own custom filters to the filter list?

Implement an AbstractNewFilterAction or AbstractNewFilterWizardAction, just like for controls and spatials.

ah awesome, thanks normen for the contributions < 3 :slight_smile:

Thanks normen, this should help us a lot in prototyping new filters.

Yeah, I also found its very useful for tweaking filters in general so they fit into the scenery (e.g. water etc)

I’m looking into writing a post-process filter to handle the visualisation of selections that a player makes in a scene. We have lots of relatively small units that all need be highlighted to give feedback on whether they can be modified by a player.



For example: a player want to build 20 new school buildings in our world. Some areas might be other player’s property. In that case the land or any building on it needs to be colored red. The rest should turn green.



In our current tech we track all the models and color them when necessary. We also splat the selection into the terrain. If we face large selections we need to change the color of up to 300 different models every time.



My hypothesis is that we should be able to draw the selection into a seperate texture and project that onto the scene in a fragment shader. By doing that the cost of selecting will be independent of the complexity of the scene.



Does this sound like an intelligent approach?

I want to make a OldTV Filter , and a ColorCorrectionFilter(LUT) and test them in Filter Explorer:



I finished writting the classes, compile to NBM and then Install in the SDK, everything work fine!



MyColorCorrectionFilter.java

[java]

@org.openide.util.lookup.ServiceProvider(service = FilterNode.class)

public class MyColorCorrectionFilter extends AbstractFilterNode {[/java]



NewCCFilterAction.java

[java]@org.openide.util.lookup.ServiceProvider(service = NewFilterAction.class)

public class NewCCFilterAction extends AbstractNewFilterAction {[/java]



_______________________________________________

The only problem I have is :



The ColorCorrectionFilter use a texture for the LookUpTable,

So when I want to change the look of the ColorCorrection, I must have a texture and It’s need to be point in the Property …



I take a look at



com.jme3.gde.core.properties

_____ TexturePropertyEditor

_____ TextureBrowser



[java] public void setAsText(String text) throws IllegalArgumentException {

this.assetKey = text;

//TODO: load texture if not done… maybe load here instead of panel…

}[/java]



Then look into :



SceneExplorerProperty.java

[java] addPropertyChangeListener(listener);

if (valueType == Vector3f.class) {

setPropertyEditorClass(Vector3fPropertyEditor.class);

} else if (valueType == Quaternion.class) {

setPropertyEditorClass(QuaternionPropertyEditor.class);

} else if (valueType == Matrix3f.class) {

setPropertyEditorClass(Matrix3fPropertyEditor.class);

} else if (valueType == ColorRGBA.class) {

setPropertyEditorClass(ColorRGBAPropertyEditor.class);

} else if (valueType == EmitterShape.class) {

setPropertyEditorClass(EmitterShapePropertyEditor.class);

} else if (valueType == Vector2f.class) {

setPropertyEditorClass(Vector2fPropertyEditor.class);

}[/java]



It’s sad!!! There is no PropertyEditor for Texture registered yet?

How can I link to a texture in Property??? I believe It’s somewhere in the code but I cant find it!

That list is not alone definitive for the registration, theres also property types being added via the ServiceProviders but still I dont know if this property (texture) works…