/** * Creates a DirectionalLightShadowFilter Shadow Filter More info on the * technique at <a * href="http://http.developer.nvidia.com/GPUGems3/gpugems3_ch10.html">http://http.developer.nvidia.com/GPUGems3/gpugems3_ch10.html</a>. * @param assetManager the application asset manager * @param shadowMapSize the size of the rendered shadowmaps (512, 1024, 2048, etc...) * @param nbSplits the number of shadow maps rendered (the more shadow maps the more quality, the less fps). * @param useMatDef the material to attach to this filter. */ public DirectionalLightShadowFilterVR(AssetManager assetManager, int shadowMapSize, int nbSplits, String useMatDef) { super(assetManager, shadowMapSize, new DirectionalLightShadowRendererVR(assetManager, shadowMapSize, nbSplits), useMatDef); }
/** * returns the lambda parameter * * @see #setLambda(float lambda) * @return lambda */ public float getLambda() { return shadowRenderer.getLambda(); }
/** * return the light used to cast shadows * * @return the DirectionalLight */ public DirectionalLight getLight() { return shadowRenderer.getLight(); }
/** * Create a DirectionalLightShadowRenderer More info on the technique at <a * href="http://http.developer.nvidia.com/GPUGems3/gpugems3_ch10.html">http://http.developer.nvidia.com/GPUGems3/gpugems3_ch10.html</a> * * @param assetManager the application asset manager * @param shadowMapSize the size of the rendered shadowmaps (512,1024,2048, * etc...) * @param nbSplits the number of shadow maps rendered (the more shadow maps * the more quality, the less fps). */ public DirectionalLightShadowRendererVR(AssetManager assetManager, int shadowMapSize, int nbSplits) { super(assetManager, shadowMapSize, nbSplits); init(nbSplits, shadowMapSize); }
/** * Enables the stabilization of the shadow's edges. (default is <code>true</code>) * This prevents shadow edges from flickering when the camera moves. * However it can lead to some shadow quality loss in some particular scenes. * @param stabilize <code>true</code> if the stabilization has to be enabled and <code>false</code> otherwise. * @see #isEnabledStabilization() */ public void setEnabledStabilization(boolean stabilize) { shadowRenderer.setEnabledStabilization(stabilize); }
/** * Sets the light to use to cast shadows * * @param light a DirectionalLight */ public void setLight(DirectionalLight light) { shadowRenderer.setLight(light); }
/** * Check if stabilization is enabled. * @return <code>true</code> if the stabilization is enabled and <code>false</code> otherwise. * @see #setEnabledStabilization(boolean) */ public boolean isEnabledStabilization() { return shadowRenderer.isEnabledStabilization(); }
/** * Adjust the repartition of the different shadow maps in the shadow extend * usually goes from 0.0 to 1.0 a low value give a more linear repartition * resulting in a constant quality in the shadow over the extends, but near * shadows could look very jagged a high value give a more logarithmic * repartition resulting in a high quality for near shadows, but the quality * quickly decrease over the extend. the default value is set to 0.65f * (theoretic optimal value). * * @param lambda the lambda value. */ public void setLambda(float lambda) { shadowRenderer.setLambda(lambda); }
@Override protected void doDisplayFrustumDebug(int shadowMapIndex) { ((Node) viewPort.getScenes().get(0)).attachChild(createFrustum(points, shadowMapIndex)); ShadowUtil.updateFrustumPoints2(shadowCam, points); ((Node) viewPort.getScenes().get(0)).attachChild(createFrustum(points, shadowMapIndex)); }
@Override protected void preFrame(float tpf) { shadowRenderer.preFrame(tpf); if( instanceRendering ) { material.setMatrix4("ViewProjectionMatrixInverseRight", rightCamera.getViewProjectionMatrix().invert()); Matrix4f m = rightCamera.getViewProjectionMatrix(); material.setVector4("ViewProjectionMatrixRow2Right", temp4f2.set(m.m20, m.m21, m.m22, m.m23)); } material.setMatrix4("ViewProjectionMatrixInverse", viewPort.getCamera().getViewProjectionMatrix().invert()); Matrix4f m = viewPort.getCamera().getViewProjectionMatrix(); material.setVector4("ViewProjectionMatrixRow2", temp4f.set(m.m20, m.m21, m.m22, m.m23)); }
@Override public void read(JmeImporter im) throws IOException { super.read(im); InputCapsule ic = (InputCapsule) im.getCapsule(this); lambda = ic.readFloat("lambda", 0.65f); zFarOverride = ic.readInt("zFarOverride", 0); light = (DirectionalLight) ic.readSavable("light", null); fadeInfo = (Vector2f) ic.readSavable("fadeInfo", null); fadeLength = ic.readFloat("fadeLength", 0f); init(nbShadowMaps, (int) shadowMapSize); }
/** * Creates a DirectionalLightShadowFilter Shadow Filter More info on the * technique at <a * href="http://http.developer.nvidia.com/GPUGems3/gpugems3_ch10.html">http://http.developer.nvidia.com/GPUGems3/gpugems3_ch10.html</a> * * @param assetManager the application asset manager * @param shadowMapSize the size of the rendered shadowmaps (512,1024,2048, * etc...) * @param nbSplits the number of shadow maps rendered (the more shadow maps * the more quality, the less fps). */ public DirectionalLightShadowFilterVR(AssetManager assetManager, int shadowMapSize, int nbSplits) { super(assetManager, shadowMapSize, new DirectionalLightShadowRendererVR(assetManager, shadowMapSize, nbSplits)); }