Real time reflections

Hi



I want to make an object reflect it surrounding  not just 1 texture like in environment map test

Is this possible without any knowledge of shaders ?



##edit:

http://www.jmonkeyengine.com/jmeforum/index.php?topic=7611.0 something like the floor reflections is what im looking for, i checked out the code from cvs but i couldn’t find anything related to the reflections



I also came across http://www.jmonkeyengine.com/jmeforum/index.php?topic=3659.0 but i cant get it to work



SEVERE: Shader uniform [refractionTranslation] could not be located in shader

SEVERE: Shader uniform [normalMap] could not be located in shader

16-jun-2008 12:56:13 class com.jme.renderer.lwjgl.LWJGLTextureRenderer render(Spatial, Texture, boolean)

SEVERE: Exception

java.lang.NullPointerException

at com.jme.renderer.lwjgl.LWJGLTextureRenderer.doDraw(LWJGLTextureRenderer.java:640)

at com.jme.renderer.lwjgl.LWJGLTextureRenderer.render(LWJGLTextureRenderer.java:372)

at com.jme.renderer.lwjgl.LWJGLTextureRenderer.render(LWJGLTextureRenderer.java:355)

at com.jme.util.ReflectRenderPass.renderReflection(ReflectRenderPass.java:371)

at com.jme.util.ReflectRenderPass.doRender(ReflectRenderPass.java:251)

at com.jme.renderer.pass.Pass.renderPass(Pass.java:90)

at com.jme.renderer.pass.BasicPassManager.renderPasses(BasicPassManager.java:89)



i only get a black semi transparent plane and mouse input is suddenly inverted.



any help is appreciated



Hellmaster.

The exception hints at you executing the code outside the open gl thread.

What you want to accomplish takes a lot of processing power in opengl. Search for render to texture.

You will have to render your scene twice, once to texture to display this on the object and once with the camera that then renders the scene.

Realtime reflections are something that is better suited with raytracing but I fear you will have to wait another year to get that on a regular computer running in real time.

i removed the reflection pass from physics fun (the link you referred to) because it was a bit buggy and used too much performance.



you can still grab the code from the svn revision 20:

http://code.google.com/p/jme-demos/source/browse/trunk/physics_fun/src/com/jmedemos/physics_fun/renderpass/ReflectRenderPass.java?r=20

Dynamic reflections are now the industry buzz so don't expect anything like that soon. Doing that requires some form of GPU ray-tracing. For now you'll have to live with cubemap samples at various locations or use plane reflection like in core-dump's code.

you can approximate it by rendering the 6 views around an object to textures and using them as a cubemap for it…

> here < is the other thread i got the reflection pass from.



its easier to get the source from there than through svn i think.

Thx for the reply, i haven't had a chance to deep digger into this… yet.



Im not looking for anything fancy just an approximate  reflection of the surrounding  on a moving sphere, something like a shiny chrome ball or something.



@mr coder

that sounds like a good idea  but is cubemapping also in jme 1 ? i think i read somewhere that it was new in jme2



Hellmaster.

cubemapping is only available for jME2. it's best to switch to jME2 now while there are not many changes in, later on you will find yourself using an old and buggy engine and switching will be a big headache.