RadialBlurFilter fails on Mac

RadialBlurFIlter works fine under Windows, but all Mac users are reporting that it makes the screen tiny. Unfortunately I don’t know enough about how shaders work to debug this.



The following testcase works fine under Windows:







but fails on a Mac, with the box made tiny and non-blurred:







[java]package net.davidc.egp.wiseup.tests;



import com.jme3.app.SimpleApplication;

import com.jme3.material.Material;

import com.jme3.math.ColorRGBA;

import com.jme3.post.FilterPostProcessor;

import com.jme3.post.filters.RadialBlurFilter;

import com.jme3.scene.Geometry;

import com.jme3.scene.shape.Quad;



/**

  • @author David Croft (david@davidc.net)
  • @version $Id$

    */

    public class TestRadialBlurFilter extends SimpleApplication

    {

    @Override

    public void simpleInitApp()

    {

    Geometry fgQuad = new Geometry("fgQuad", new Quad(5, 5));

    Material fgMaterial = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");

    fgMaterial.setColor("Color", ColorRGBA.Blue);

    fgQuad.setMaterial(fgMaterial);

    fgQuad.setLocalTranslation(1, 1, -20);

    rootNode.attachChild(fgQuad);



    FilterPostProcessor fpp = new FilterPostProcessor(assetManager);

    viewPort.addProcessor(fpp);

    RadialBlurFilter blur = new RadialBlurFilter(2, 2);

    fpp.addFilter(blur);

    }



    public static void main(String[] args)

    {

    TestRadialBlurFilter app = new TestRadialBlurFilter();

    app.setShowSettings(false);

    app.start();

    }

    }

    [/java]



    -davidc

By contrast, BloomFilter does work:



Windows:





Mac:





Mac graphics card info:

@Normen, TeamViewer to the rescue!!!

Coming…!!! :affe:

1 Like

I think the tiny box thing might be because the shader fails to compile. Maybe check the console to see if there’s any errors?

Sorry, I should have thought to ask for the log. Yes, looks like something wrong in the shader:



Mar 2, 2011 2:52:10 PM com.jme3.system.JmeSystem initialize
INFO: Running on jMonkey Engine 3 Alpha 0.6
Mar 2, 2011 2:52:10 PM com.jme3.system.Natives autoDetectExtractionDir
INFO: Extraction Directory #1: /Users/thumbtack/.jme3-natives
Mar 2, 2011 2:52:10 PM com.jme3.system.Natives autoDetectExtractionDir
INFO: Chosen Extraction Directory: /Users/thumbtack/.jme3-natives
Mar 2, 2011 2:52:10 PM com.jme3.system.lwjgl.LwjglAbstractDisplay run
INFO: Using LWJGL 2.5
Mar 2, 2011 2:52:10 PM com.jme3.system.lwjgl.LwjglDisplay createContext
INFO: Selected display mode: 640 x 480 x 0 @0Hz
Mar 2, 2011 2:52:10 PM com.jme3.system.lwjgl.LwjglAbstractDisplay initInThread
INFO: Display created.
Mar 2, 2011 2:52:10 PM com.jme3.system.lwjgl.LwjglAbstractDisplay initInThread
INFO: Adapter: null
Mar 2, 2011 2:52:10 PM com.jme3.system.lwjgl.LwjglAbstractDisplay initInThread
INFO: Driver Version: null
Mar 2, 2011 2:52:10 PM com.jme3.system.lwjgl.LwjglAbstractDisplay initInThread
INFO: Vendor: Intel Inc.
Mar 2, 2011 2:52:10 PM com.jme3.system.lwjgl.LwjglAbstractDisplay initInThread
INFO: OpenGL Version: 2.0 APPLE-1.6.26
Mar 2, 2011 2:52:10 PM com.jme3.system.lwjgl.LwjglAbstractDisplay initInThread
INFO: Renderer: Intel GMA X3100 OpenGL Engine
Mar 2, 2011 2:52:10 PM com.jme3.system.lwjgl.LwjglAbstractDisplay initInThread
INFO: GLSL Ver: 1.20
Mar 2, 2011 2:52:10 PM com.jme3.system.lwjgl.LwjglTimer
INFO: Timer resolution: 1000 ticks per second
Mar 2, 2011 2:52:10 PM com.jme3.renderer.lwjgl.LwjglRenderer initialize
INFO: Caps: [FrameBuffer, FrameBufferMRT, OpenGL20, ARBprogram, GLSL100, GLSL110, GLSL120, VertexTextureFetch]
[snip]
Mar 2, 2011 2:52:11 PM com.jme3.renderer.Camera
INFO: Camera created (W: 1, H: 1)
Mar 2, 2011 2:52:11 PM com.jme3.material.MaterialDef
INFO: Loaded material definition: Radial Blur
Mar 2, 2011 2:52:11 PM com.jme3.renderer.lwjgl.LwjglRenderer updateShaderSourceData
WARNING: Common/MatDefs/Blur/RadialBlur.frag compile error: ERROR: 0:34: 'm_Samples' : left of '[' is not of type array, matrix, or vector

Hmm … @Remy?

Has the radial blur shader been Macitized yet? :smiley:



Also davidc, you said that the mac is using GeForce 9400M but in the log it says its using Intel GMA X3100, do you have a hybrid by any chance?

Nope, I don’t have a Mac at all. The screenshots are from a friend’s laptop I tried in person earlier today, the log is from someone else online.

@Momoko_Fan, nope, we should add an automatic method though : shader.macitized() :stuck_out_tongue:

m_Samples is declared as a float[10], I think the right way to declare it is float[]…

@davidc, we use teamviewer to debug shaders on Normen’s mac, I’ll look at it tonight.

I made the change to float and it didn’t help, so I guess I’ll leave it to you since shaders baffle me senseless!



This is yet another type of Mac with a different graphics card if you’re wondering why the logs are different again :slight_smile:



Mar 3, 2011 2:30:26 PM com.jme3.system.lwjgl.LwjglAbstractDisplay initInThread
INFO: Adapter: null
Mar 3, 2011 2:30:26 PM com.jme3.system.lwjgl.LwjglAbstractDisplay initInThread
INFO: Driver Version: null
Mar 3, 2011 2:30:26 PM com.jme3.system.lwjgl.LwjglAbstractDisplay initInThread
INFO: Vendor: NVIDIA Corporation
Mar 3, 2011 2:30:26 PM com.jme3.system.lwjgl.LwjglAbstractDisplay initInThread
INFO: OpenGL Version: 2.1 NVIDIA-1.6.16
Mar 3, 2011 2:30:26 PM com.jme3.system.lwjgl.LwjglAbstractDisplay initInThread
INFO: Renderer: NVIDIA GeForce GT 330M OpenGL Engine
Mar 3, 2011 2:30:26 PM com.jme3.renderer.lwjgl.LwjglRenderer initialize
INFO: Caps: [FrameBuffer, FrameBufferMRT, FrameBufferMultisample, OpenGL20, OpenGL21, ARBprogram, GLSL100, GLSL110, GLSL120, VertexTextureFetch, TextureArray, FloatTexture, FloatColorBuffer, FloatDepthBuffer, PackedFloatTexture, SharedExponentTexture, PackedFloatColorBuffer]
[snip]
Mar 3, 2011 2:30:27 PM com.jme3.material.MaterialDef
INFO: Loaded material definition: Radial Blur
Mar 3, 2011 2:30:27 PM com.jme3.renderer.lwjgl.LwjglRenderer updateShaderSourceData
WARNING: Common/MatDefs/Blur/RadialBlur.frag compile error: ERROR: 0:34: 'm_Samples' : left of '[' is not of type array, matrix, or vector

pffffff …“float[] m_Samples is not of type array, matrix, or vector”

Then what is it Mr Steve Jobs???



@davidc sorry I did not look at it yesterday I’ll do it asap.

btw does SSAO work on this mac? it uses the same type of array declaration, and it works fine on Normen’s Mac…

For these tests I used an iMac Core 2 Duo with Mac OS X 10.5.8 and NVIDIA GeForce GT 130, and the current webstart version from jme.com.



TestSSAO does not give any shader error, but I’m not sure this is how it’s supposed to look:







TestSSAO2 dies with a Bus Error in the VM.



RadialBlurFilter has the same problem as all the other Macs.

This is how its supposed to look. The SSAO2 test was removed as it wasn’t compatible with the latest changes I think.

I finally have access to a Mac! I referred to this forum. The following patch fixes the problem, please commit!



[patch]Index: src/core-data/Common/MatDefs/Blur/RadialBlur.frag

===================================================================

— src/core-data/Common/MatDefs/Blur/RadialBlur.frag (revision 6363)

+++ src/core-data/Common/MatDefs/Blur/RadialBlur.frag (revision )

@@ -1,7 +1,7 @@

uniform sampler2D m_Texture;

uniform float m_SampleDist;

uniform float m_SampleStrength;

-uniform float[10] m_Samples;

+uniform float m_Samples[10];

varying vec2 texCoord;



void main(void)

[/patch]



-davidc

Thanks it’s in last SVN