Antialiasing

Hello!



How to change antialiasing in SimpleWaterProcessor?

I use FilterPostProcessor.setNumSamples(4);



It doesn’t work!



Thank you

Sorry It’s not SimpleWaterProcessor but WaterFilter



Thank you

That’s the way to do it.

It doesn’t work how? you mean it’s still aliased or you have an error?

nothing in the renderer, the display is black

when I use another filter ColorOverlayFilter it work!



Thank you

Can you post the log when you get a black screen?

This is the log



6 avr. 2011 23:59:26 com.jme3.system.JmeSystem initialize

INFO: Running on jMonkey Engine 3 Alpha 0.6

6 avr. 2011 23:59:26 com.jme3.system.Natives extractNativeLibs

INFO: Extraction Directory #1: file:/C:/JME/

6 avr. 2011 23:59:26 com.jme3.system.Natives extractNativeLibs

INFO: Extraction Directory #2: C:Documents and Settingscastermanworkspacegalerie3D

6 avr. 2011 23:59:26 com.jme3.system.Natives extractNativeLibs

INFO: Extraction Directory #3: C:Documents and Settingscastermanworkspacegalerie3D

6 avr. 2011 23:59:26 com.jme3.system.lwjgl.LwjglAbstractDisplay run

INFO: Using LWJGL 2.5

6 avr. 2011 23:59:26 com.jme3.system.lwjgl.LwjglDisplay createContext

INFO: Selected display mode: 1324 x 768 x 0 @0Hz

6 avr. 2011 23:59:27 com.jme3.system.lwjgl.LwjglAbstractDisplay initInThread

INFO: Display created.

6 avr. 2011 23:59:27 com.jme3.system.lwjgl.LwjglAbstractDisplay initInThread

INFO: Adapter: nv4_disp

6 avr. 2011 23:59:27 com.jme3.system.lwjgl.LwjglAbstractDisplay initInThread

INFO: Driver Version: 6.14.11.5819

6 avr. 2011 23:59:27 com.jme3.system.lwjgl.LwjglAbstractDisplay initInThread

INFO: Vendor: NVIDIA Corporation

6 avr. 2011 23:59:27 com.jme3.system.lwjgl.LwjglAbstractDisplay initInThread

INFO: OpenGL Version: 2.1.1

6 avr. 2011 23:59:27 com.jme3.system.lwjgl.LwjglAbstractDisplay initInThread

INFO: Renderer: GeForce 8500 GT/PCI/SSE2

6 avr. 2011 23:59:27 com.jme3.system.lwjgl.LwjglAbstractDisplay initInThread

INFO: GLSL Ver: 1.20 NVIDIA via Cg compiler

6 avr. 2011 23:59:27 com.jme3.system.lwjgl.LwjglTimer

INFO: Timer resolution: 1000 ticks per second

6 avr. 2011 23:59:27 com.jme3.renderer.lwjgl.LwjglRenderer initialize

INFO: Caps: [FrameBuffer, FrameBufferMRT, FrameBufferMultisample, OpenGL20, OpenGL21, ARBprogram, GLSL100, GLSL110, GLSL120, VertexTextureFetch, TextureArray, FloatTexture, FloatColorBuffer, PackedFloatTexture, SharedExponentTexture, PackedFloatColorBuffer, TextureCompressionLATC]

6 avr. 2011 23:59:27 com.jme3.asset.DesktopAssetManager

INFO: DesktopAssetManager created.

6 avr. 2011 23:59:27 com.jme3.renderer.Camera

INFO: Camera created (W: 1 324, H: 768)

6 avr. 2011 23:59:27 com.jme3.renderer.Camera

INFO: Camera created (W: 1 324, H: 768)

6 avr. 2011 23:59:27 com.jme3.input.lwjgl.LwjglMouseInput initialize

INFO: Mouse created.

6 avr. 2011 23:59:27 com.jme3.input.lwjgl.LwjglKeyInput initialize

INFO: Keyboard created.

6 avr. 2011 23:59:27 com.jme3.audio.lwjgl.LwjglAudioRenderer initInThread

INFO: AudioRenderer supports 64 channels

6 avr. 2011 23:59:27 com.jme3.audio.lwjgl.LwjglAudioRenderer initInThread

INFO: Audio effect extension version: 1.0

6 avr. 2011 23:59:27 com.jme3.audio.lwjgl.LwjglAudioRenderer initInThread

INFO: Audio max auxilary sends: 2

Initialize

Material/TEXFACE: emissive

6 avr. 2011 23:59:27 com.jme3.material.MaterialDef

INFO: Loaded material definition: Phong Lighting

Material.002: emissive

Material/TEXFACE/bitmap.png: emissive

Unsupported texture_unit directive: colour_op

Material.003: emissive

6 avr. 2011 23:59:30 com.jme3.scene.Node attachChild

INFO: Child (Camera) attached to this node (Scene/galerie-scene_node)

6 avr. 2011 23:59:30 com.jme3.scene.Node attachChild

INFO: Child (Lamp) attached to this node (Scene/galerie-scene_node)

6 avr. 2011 23:59:30 com.jme3.scene.Node attachChild

INFO: Child (Plane) attached to this node (Scene/galerie-scene_node)

6 avr. 2011 23:59:30 com.jme3.scene.Node attachChild

INFO: Child (Plane-geom-1) attached to this node (Plane-ogremesh)

6 avr. 2011 23:59:30 com.jme3.scene.Node attachChild

INFO: Child (Plane-geom-2) attached to this node (Plane-ogremesh)

6 avr. 2011 23:59:30 com.jme3.scene.Node attachChild

INFO: Child (Plane-geom-3) attached to this node (Plane-ogremesh)

6 avr. 2011 23:59:30 com.jme3.scene.Node attachChild

INFO: Child (Plane-geom-4) attached to this node (Plane-ogremesh)

6 avr. 2011 23:59:30 com.jme3.scene.Node attachChild

INFO: Child (Plane-ogremesh) attached to this node (Plane-entity)

6 avr. 2011 23:59:30 com.jme3.scene.Node attachChild

INFO: Child (Plane-entity) attached to this node (Plane)

6 avr. 2011 23:59:30 com.jme3.scene.Node attachChild

INFO: Child (Lamp.004) attached to this node (Scene/galerie-scene_node)

6 avr. 2011 23:59:30 com.jme3.scene.Node attachChild

INFO: Child (Lamp.005) attached to this node (Scene/galerie-scene_node)

6 avr. 2011 23:59:30 com.jme3.scene.Node attachChild

INFO: Child (Lamp.006) attached to this node (Scene/galerie-scene_node)

6 avr. 2011 23:59:30 com.jme3.scene.Node attachChild

INFO: Child (Lamp.001) attached to this node (Scene/galerie-scene_node)

6 avr. 2011 23:59:30 com.jme3.scene.Node attachChild

INFO: Child (Lamp.002) attached to this node (Scene/galerie-scene_node)

6 avr. 2011 23:59:30 com.jme3.scene.Node attachChild

INFO: Child (Lamp.003) attached to this node (Scene/galerie-scene_node)

6 avr. 2011 23:59:30 com.jme3.asset.DesktopAssetManager loadAsset

ATTENTION: Cannot locate resource: Scene/Scene.material

6 avr. 2011 23:59:30 com.jme3.scene.Node attachChild

INFO: Child (Scene/galerie-scene_node) attached to this node (Root Node)

6 avr. 2011 23:59:30 com.jme3.scene.Node attachChild

INFO: Child (untitled-geom-0) attached to this node (untitled-objnode)

6 avr. 2011 23:59:30 com.jme3.scene.Node attachChild

INFO: Child (untitled-geom-1) attached to this node (untitled-objnode)

6 avr. 2011 23:59:30 com.jme3.scene.Node attachChild

INFO: Child (untitled-objnode) attached to this node (Root Node)

Debut

Fin

6 avr. 2011 23:59:30 com.jme3.renderer.Camera

INFO: Camera created (W: 1, H: 1)

6 avr. 2011 23:59:30 com.jme3.input.InputManager addMapping

ATTENTION: Attempted to add mapping {0} twice to trigger.

6 avr. 2011 23:59:30 com.jme3.input.InputManager addMapping

ATTENTION: Attempted to add mapping {0} twice to trigger.

6 avr. 2011 23:59:30 com.jme3.input.InputManager addMapping

ATTENTION: Attempted to add mapping {0} twice to trigger.

6 avr. 2011 23:59:30 com.jme3.input.InputManager addMapping

ATTENTION: Attempted to add mapping {0} twice to trigger.

6 avr. 2011 23:59:30 com.jme3.input.InputManager addMapping

ATTENTION: Attempted to add mapping {0} twice to trigger.

6 avr. 2011 23:59:30 com.jme3.renderer.Camera

INFO: Camera created (W: 2 000, H: 2 000)

6 avr. 2011 23:59:31 com.jme3.material.MaterialDef

INFO: Loaded material definition: Advanced Water

6 avr. 2011 23:59:31 com.jme3.renderer.lwjgl.LwjglRenderer updateUniformLocation

INFO: Uniform m_UseMaterialColors is not declared in shader.

6 avr. 2011 23:59:31 com.jme3.renderer.lwjgl.LwjglRenderer updateUniformLocation

INFO: Uniform m_UseMaterialColors is not declared in shader.

6 avr. 2011 23:59:35 com.jme3.renderer.lwjgl.LwjglRenderer updateUniformLocation

INFO: Uniform m_FoamMap is not declared in shader.

6 avr. 2011 23:59:35 com.jme3.renderer.lwjgl.LwjglRenderer updateUniformLocation

INFO: Uniform m_NormalMap is not declared in shader.

6 avr. 2011 23:59:35 com.jme3.renderer.lwjgl.LwjglRenderer updateUniformLocation

INFO: Uniform m_FoamExistence is not declared in shader.

6 avr. 2011 23:59:35 com.jme3.renderer.lwjgl.LwjglRenderer updateUniformLocation

INFO: Uniform m_UseRipples is not declared in shader.

6 avr. 2011 23:59:35 com.jme3.renderer.lwjgl.LwjglRenderer updateUniformLocation

INFO: Uniform m_UseHQShoreline is not declared in shader.

6 avr. 2011 23:59:35 com.jme3.renderer.lwjgl.LwjglRenderer updateUniformLocation

INFO: Uniform m_UseSpecular is not declared in shader.

6 avr. 2011 23:59:35 com.jme3.renderer.lwjgl.LwjglRenderer updateUniformLocation

INFO: Uniform m_UseFoam is not declared in shader.

6 avr. 2011 23:59:35 com.jme3.renderer.lwjgl.LwjglRenderer updateUniformLocation

INFO: Uniform m_UseRefraction is not declared in shader.





and this is the code



[java]

package Test;



import com.jme3.app.Application;

import jme3test.app.state.RootNodeState;

import com.jme3.bullet.BulletAppState;

import com.jme3.bullet.collision.shapes.CapsuleCollisionShape;

import com.jme3.bullet.collision.shapes.CollisionShape;

import com.jme3.bullet.control.CharacterControl;

import com.jme3.bullet.control.RigidBodyControl;

import com.jme3.bullet.util.CollisionShapeFactory;

import com.jme3.collision.MotionAllowedListener;

// import com.jme3.input.FlyByCamera;

import com.jme3.input.KeyInput;

import com.jme3.input.MouseInput;

import com.jme3.input.controls.ActionListener;

import com.jme3.input.controls.AnalogListener;

import com.jme3.input.controls.KeyTrigger;

import com.jme3.input.controls.MouseAxisTrigger;

import com.jme3.input.controls.MouseButtonTrigger;

import com.jme3.light.PointLight;

import com.jme3.material.Material;

import com.jme3.math.Matrix3f;

import com.jme3.math.Quaternion;

import com.jme3.math.Vector3f;

import com.jme3.post.FilterPostProcessor;

import com.jme3.renderer.Camera;

import com.jme3.scene.Geometry;

import com.jme3.scene.Node;

import com.jme3.scene.Spatial;

import com.jme3.system.AppSettings;

import com.jme3.system.JmeContext;

import com.jme3.system.JmeContext.Type;

import com.jme3.texture.Texture2D;

import com.jme3.water.SimpleWaterProcessor;

import com.jme3.water.WaterFilter;

import com.jme3.math.ColorRGBA;



public class Test extends Application

{

//private FlyByCamera flyCam;

private AppActionListener actionListener = new AppActionListener();

private AppAnalogListener analogListener = new AppAnalogListener();

protected boolean enabled = true;

protected float moveSpeed = 10f;

protected MotionAllowedListener motionAllowed = null;

private boolean sideways = false;

protected boolean dragToRotate = false;

protected boolean canRotate = false;

protected float rotationSpeed = 1f;

private Vector3f initialUpVec;

private BulletAppState bulletAppState;

private RigidBodyControl landscape;

private CharacterControl player;

private Vector3f walkDirection = new Vector3f();

private boolean left = false, right = false, up = false, down = false;

private FlyByCamera flyCam;

Vector3f lightDir = new Vector3f(-0.37352666f, -0.50444174f, -0.7784704f);

Material mat;

Spatial waterPlane;

Geometry lightSphere;

SimpleWaterProcessor waterProcessor;

Node sceneNode;

Texture2D texture2D;

boolean useWater = true;

RootNodeState state = new RootNodeState();



public static void main(String[] args)

{

Test app = new Test();

app.start();

}



@Override

public void start(JmeContext.Type contextType)

{

AppSettings settings = new AppSettings(true);

settings.setResolution(1324, 768);

settings.setTitle("essais");

//settings.setSamples(4);

setSettings(settings);



super.start(contextType);

}



public void initialize()

{

super.initialize();



System.out.println("Initialize");



// Creer un objet RootNodeState

viewPort.attachScene(state.getRootNode());

stateManager.attach(state);



// Jbullet

bulletAppState = new BulletAppState();

stateManager.attach(bulletAppState);



// Scene

Spatial scene = assetManager.loadModel("Scene/galerie.scene");

scene.setLocalTranslation(0, -0.2f, 0);

state.getRootNode().attachChild(scene);



// Tableaux1

Spatial tableau1 = assetManager.loadModel("Tableaux/Tableau1/untitled.obj");

tableau1.move(-5f, 4.5f, 0.5f);

Quaternion quaternion = new Quaternion();

Vector3f axis = new Vector3f();

axis.set(90, 0, 0);

quaternion.fromAngleAxis(-55, axis);

tableau1.setLocalRotation(quaternion);

state.getRootNode().attachChild(tableau1);



// Essais 1 Reflet

System.out.println("Debut");

FilterPostProcessor fpp = new FilterPostProcessor(assetManager);

viewPort.addProcessor(fpp);

WaterFilter water = new WaterFilter(state.getRootNode(),lightDir);

water.setUseFoam(false);

water.setUseRipples(false);

water.setMaxAmplitude(0.0f);

water.setWaveScale(0.008f);

water.setSpeed(0.0f);

water.setShoreHardness(1.0f);

water.setRefractionConstant(0.010f);

water.setReflectionMapSize(2000);

fpp.addFilter(water);

fpp.setNumSamples(4);

System.out.println("Fin");



// We set up collision detection for the scene by creating a

// compound collision shape and a static physics node with mass zero.

CollisionShape sceneShape = CollisionShapeFactory.createMeshShape((Node) scene);

landscape = new RigidBodyControl(sceneShape, 0);

scene.addControl(landscape);



// We set up collision detection for the player by creating

// a capsule collision shape and a physics character node.

// The physics character node offers extra settings for

// size, stepheight, jumping, falling, and gravity.

// We also put the player in its starting position.

CapsuleCollisionShape capsuleShape = new CapsuleCollisionShape(1.5f, 6f, 1);

player = new CharacterControl(capsuleShape, 0.05f);

player.setJumpSpeed(20);

player.setFallSpeed(30);

player.setGravity(0);

player.setPhysicsLocation(new Vector3f(12f,6f,21.5f));



// We attach the scene and the player to the rootnode and the physics space,

// to make them appear in the game world.

//state.getRootNode().attachChild(signpost);

bulletAppState.getPhysicsSpace().add(landscape);

bulletAppState.getPhysicsSpace().add(player);



// ==================================================================================================

// Lamp 1 en haut au milieu

PointLight pl1 = new PointLight();

pl1.setColor(ColorRGBA.White.clone().multLocal(0.45f));// intensité si point mettre un f

pl1.setPosition(new Vector3f(0.043707f, 27.258642f, -1.005454f)); // axe x,y,z

state.getRootNode().addLight(pl1);



// Lamp 2 tres haut devant a droite

PointLight pl5 = new PointLight();

pl5.setColor(ColorRGBA.White.clone().multLocal(0.25f));

pl5.setPosition(new Vector3f(6.190915f,39.987391f, 14.585943f));

state.getRootNode().addLight(pl5);



// Lamp 3 tres haut devant-a droite

PointLight pl6 = new PointLight();

pl6.setColor(ColorRGBA.White.clone().multLocal(0.20f));

pl6.setPosition(new Vector3f(-0.616974f,40.151840f, 17.919811f));

state.getRootNode().addLight(pl6);



// Lamp 4 tres haut au milieu derriere le tableau

PointLight pl7 = new PointLight();

pl7.setColor(ColorRGBA.White.clone().multLocal(0.10f));

pl7.setPosition(new Vector3f(-7.649535f,19.935478f, -13.624054f));

state.getRootNode().addLight(pl7);



// Lamp 5 tres bas au milieu derriere le tableau

PointLight pl2 = new PointLight();

pl2.setColor(ColorRGBA.White.clone().multLocal(0.35f));

pl2.setPosition(new Vector3f(-4.468306f, -22.216285f, -12.894947f));

state.getRootNode().addLight(pl2);



// Lamp 6 en bas au milieu a droite de la cloison

PointLight pl3 = new PointLight();

pl3.setColor(ColorRGBA.White.clone().multLocal(0.30f));

pl3.setPosition(new Vector3f(4.904982f,-42.358125f,-4.293398f));

state.getRootNode().addLight(pl3);



// Lamp 7 tres bas devant au milieu

PointLight pl4 = new PointLight();

pl4.setColor(ColorRGBA.White.clone().multLocal(0.40f));

pl4.setPosition(new Vector3f(0.084623f,-39.892953f, 20.805719f));

state.getRootNode().addLight(pl4);



// Lamp 8 sur le cote gauche au milieu

PointLight pl8 = new PointLight();

pl8.setColor(ColorRGBA.White.clone().multLocal(0.46f));

pl8.setPosition(new Vector3f(-26f,6f, 70f));

state.getRootNode().addLight(pl8);



// Lamp 9 sur le cote gauche du tableau au milieu

PointLight pl9 = new PointLight();

pl9.setColor(ColorRGBA.White.clone().multLocal(0.40f));

pl9.setPosition(new Vector3f(-45f,6f, -6f));

state.getRootNode().addLight(pl9);



flyCam = new FlyByCamera(cam);

flyCam.setMoveSpeed(1f);

flyCam.registerWithInput(inputManager);

flyCam.setDragToRotate(true);



essais2();

essais3(cam);

}



@Override

public void destroy()

{

super.destroy();



System.out.println("Destroy");

}



public void essais2()

{

if (context.getType() == Type.Display)

{

inputManager.addMapping("SIMPLEAPP_Exit", new KeyTrigger(KeyInput.KEY_ESCAPE));

}

inputManager.addListener(actionListener, "SIMPLEAPP_Exit");

}



public void essais3(Camera cam)

{

this.cam = cam;

initialUpVec = cam.getUp().clone();

inputManager.addMapping("Lefts", new KeyTrigger(KeyInput.KEY_LEFT));

inputManager.addMapping("Rights", new KeyTrigger(KeyInput.KEY_RIGHT));

inputManager.addMapping("Ups", new KeyTrigger(KeyInput.KEY_UP));

inputManager.addMapping("Downs", new KeyTrigger(KeyInput.KEY_DOWN));

inputManager.addMapping("FLYCAM_Up", new MouseAxisTrigger(MouseInput.AXIS_Y, false));

inputManager.addMapping("FLYCAM_Down", new MouseAxisTrigger(MouseInput.AXIS_Y, true));

inputManager.addMapping("FLYCAM_Left", new MouseAxisTrigger(MouseInput.AXIS_X, true));

inputManager.addMapping("FLYCAM_Right", new MouseAxisTrigger(MouseInput.AXIS_X, false));

inputManager.addMapping("FLYCAM_RotateDrag", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));



inputManager.addListener(actionListener, "Lefts");

inputManager.addListener(actionListener, "Rights");

inputManager.addListener(actionListener, "Ups");

inputManager.addListener(actionListener, "Downs");

inputManager.addListener(analogListener, "FLYCAM_Left", "FLYCAM_Right","FLYCAM_Up","FLYCAM_Up");

inputManager.addListener(actionListener, "FLYCAM_RotateDrag");

}



public void update()

{

super.update();



Vector3f camDir = cam.getDirection().clone().multLocal(0.6f);

Vector3f camLeft = cam.getLeft().clone().multLocal(0.4f);

walkDirection.set(0, 0, 0);



if (left)

{

walkDirection.addLocal(camLeft);

}

if (right)

{

walkDirection.addLocal(camLeft.negate());

}

if (up)

{

walkDirection.addLocal(camDir);

}

if (down)

{

walkDirection.addLocal(camDir.negate());

}



player.setWalkDirection(walkDirection);

cam.setLocation(player.getPhysicsLocation());



// do some animation

float tpf = timer.getTimePerFrame();



stateManager.update(tpf);

stateManager.render(renderManager);



// render the viewports

renderManager.render(tpf);

}



public class AppAnalogListener implements AnalogListener

{

public void onAnalog(String binding, float value, float tpf)

{

if (!enabled)

return;



else if (binding.equals("FLYCAM_Left"))

{

rotateCamera(value, initialUpVec);

}



else if (binding.equals("FLYCAM_Right"))

{

rotateCamera(-value, initialUpVec);

}



else if (binding.equals("FLYCAM_Up"))

{

rotateCamera(-value, cam.getLeft());

}



else if (binding.equals("FLYCAM_Down"))

{

rotateCamera(value, cam.getLeft());

}

}

}



protected void rotateCamera(float value, Vector3f axis)

{

if (canRotate)

{

//value = -value;

}



else

{

return;

}



Matrix3f mat = new Matrix3f();

mat.fromAngleNormalAxis(rotationSpeed * value, axis);



Vector3f up = cam.getUp();

Vector3f left = cam.getLeft();

Vector3f dir = cam.getDirection();



mat.mult(up, up);

mat.mult(left, left);

mat.mult(dir, dir);



Quaternion q = new Quaternion();

q.fromAxes(left, up, dir);

q.normalize();



cam.setAxes(q);

}



//===================================================================================================

// fonction avancer reculer droite gauche rotation echap

public class AppActionListener implements ActionListener

{

public void onAction(String binding, boolean value, float tpf)

{

if (!enabled)

return;



if (binding.equals("SIMPLEAPP_Exit"))

{

stop();

}



else if (binding.equals("FLYCAM_RotateDrag"))

{

canRotate = value;

inputManager.setCursorVisible(!value);

}



else if (binding.equals("Lefts"))

{

if (value)

{

left = true;

}

else

{

left = false;

}

}

else if (binding.equals("Rights"))

{

if (value)

{

right = true;

}

else

{

right = false;

}

}

else if (binding.equals("Ups"))

{

if (value)

{

up = true;

}

else

{

up = false;

}

}

else if (binding.equals("Downs"))

{

if (value)

{

down = true;

}

else

{

down = false;

}

}

}

}

}

[/java]



Thank you

You have outdated drivers. Your video card (GeForce 8500) supports multisample textures but doesn’t expose the functionality because the drivers have not been updated for OpenGL 3.3.



You can download updated drivers here:

http://www.nvidia.com/Download/index.aspx?lang=en-us

Thank you Momoko_Fan it’s OK!