Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]AssetNotFoundException: Common/Ma-tDefs/Water/Textures/foam2.jpg (Flipped) (Mipmapped)
I have looked at other assetNotFoundException threads here but I can’t find one similar enough to mine to fix this problem.
It looks like I am missing a file, but I am not sure how to put it into the appropriate directory.
I am trying to follow along with this YouTube tutorial: - YouTube
Things were going well until I tried to make post processed water graphics. My computer can handle PC water because it can run the PCwater test file, but I get this errror when I try to run my own code.
[java]
package mygame;
import com.jme3.app.SimpleApplication;
import com.jme3.effect.ParticleEmitter;
import com.jme3.effect.ParticleMesh;
import com.jme3.light.AmbientLight;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.FastMath;
import com.jme3.math.Plane;
import com.jme3.math.Quaternion;
import com.jme3.math.Vector2f;
import com.jme3.math.Vector3f;
import com.jme3.post.FilterPostProcessor;
import com.jme3.renderer.RenderManager;
import com.jme3.renderer.queue.RenderQueue;
import com.jme3.scene.Geometry;
import com.jme3.scene.Spatial;
import com.jme3.scene.shape.Box;
import com.jme3.scene.shape.Quad;
import com.jme3.texture.Texture2D;
import com.jme3.water.SimpleWaterProcessor;
import com.jme3.water.WaterFilter;
/**
-
test
-
@author normenhansen
*/
public class Main extends SimpleApplication {private Spatial sceneModel;
private WaterFilter water;
private Vector3f lightDir = new Vector3f(-4f, -1f, 5f);public static void main(String[] args) {
Main app = new Main();
app.start();
}@Override
public void simpleInitApp() {flyCam.setMoveSpeed(100.123f); initBox(); initScene(); initLight(); //initSimpleWater(); initPPcWater(); fire();
}
@Override
public void simpleUpdate(float tpf) {
//TODO: add update code
}@Override
public void simpleRender(RenderManager rm) {
//TODO: add render code
}private void initBox() {
Box b = new Box(1, 1, 1);
Geometry geom = new Geometry(“Box”, b);Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.setColor("Color", ColorRGBA.Blue); geom.setMaterial(mat); rootNode.attachChild(geom);
}
private void initScene() {
sceneModel = assetManager.loadModel(“Scenes/Scene.j3o”);
rootNode.attachChild(sceneModel);
}private void initLight() {
/**
* A white ambient light source.
*/
AmbientLight ambient = new AmbientLight();
ambient.setColor(ColorRGBA.White);
rootNode.addLight(ambient);
}public void initSimpleWater() {
SimpleWaterProcessor waterProcessor = new SimpleWaterProcessor(assetManager); waterProcessor.setReflectionScene(sceneModel); Vector3f waterLocation = new Vector3f(0, -6, 0); waterProcessor.setPlane(new Plane(Vector3f.UNIT_Y, waterLocation.dot(Vector3f.UNIT_Y))); viewPort.addProcessor(waterProcessor); waterProcessor.setWaterDepth(10); // transparency of water waterProcessor.setDistortionScale(0.05f); /// strength of waves waterProcessor.setWaveSpeed(0.05f); // speed of waves Quad quad = new Quad(800, 800); quad.scaleTextureCoordinates(new Vector2f(6f, 6f)); Geometry water = new Geometry("water", quad); water.setLocalRotation(new Quaternion().fromAngleAxis(-FastMath.HALF_PI, Vector3f.UNIT_X)); water.setLocalTranslation(-400, 0.32f, 400); water.setShadowMode(RenderQueue.ShadowMode.Receive); water.setMaterial(waterProcessor.getMaterial()); rootNode.attachChild(water);
}
public void initPPcWater() {
FilterPostProcessor fpp = new FilterPostProcessor(assetManager); water = new WaterFilter(rootNode, lightDir); water.setCenter(Vector3f.ZERO); water.setRadius(2600); water.setWaveScale(0.003f); water.setMaxAmplitude(2f); water.setFoamExistence(new Vector3f(1f, 4f, 0.5f)); water.setFoamTexture((Texture2D) assetManager.loadTexture("Common/MatDefs/Water/Textures/foam2.jpg")); water.setRefractionStrength(0.2f); water.setWaterHeight(1f); fpp.addFilter(water); viewPort.addProcessor(fpp);
}
public void fire(){
/** Uses Texture from jme3-test-data library! */
ParticleEmitter fireEffect = new ParticleEmitter(“Emitter”, ParticleMesh.Type.Triangle, 30);
Material fireMat = new Material(assetManager, “Common/MatDefs/Misc/Particle.j3md”);
//fireMat.setTexture(“Texture”, assetManager.loadTexture(“Effects/Explosion/flame.png”));
fireEffect.setMaterial(fireMat);
fireEffect.setImagesX(2); fireEffect.setImagesY(2); // 2x2 texture animation
fireEffect.setEndColor( new ColorRGBA(1f, 0f, 0f, 1f) ); // red
fireEffect.setStartColor( new ColorRGBA(1f, 1f, 0f, 0.5f) ); // yellow
fireEffect.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 2, 0));
fireEffect.setStartSize(0.6f);
fireEffect.setEndSize(0.1f);
fireEffect.setGravity(0f,0f,0f);
fireEffect.setLowLife(0.5f);
fireEffect.setHighLife(3f);
fireEffect.getParticleInfluencer().setVelocityVariation(0.3f);
rootNode.attachChild(fireEffect);}
}
[/java]