mirrors - refections

anyone got any idea how i can make a mirror ? or refective water effect (texture)?

– i’m still messing around dudes

maybe use a snapshot from a second view at mirror position and map that as texture ?

… just a thought …

Martin

A true mirror is expensive. The suggestion already presented is the general technique, you render from the POV of the mirror to a buffer and then map that buffer to the mirror. Means twice as many renders per frame.

Water, shiney metal, and the like is generally cheated however. The cheat is called an “Environment Map” or a “reflection map” and basically its a spherical image of the fixed surroundings that you use as a texture through a special transformation. You can even do versions of this in the pixel shaders on today’s latest graphics cards.

AIUI A reflection map is a true reflection, an environment map is generally much smaller image that just gives an impression of the reflected surrounding. Because the reflections are fixed ahead of time, both of these techniques best work for either static surroundings (unlikely in a game) or surfaces that distort so badly you can’t really see any details. This is why it would work for a rippling water surface but not for a mirror.

if you google on “OGL and Environment Map” and “OGL and Reflection Map” you should find a lot of stuff.

Dunno, but you may want to look at xom.xith3d.test.Xith3DTexCoordGenerationTest.

[quote]Dunno, but you may want to look at xom.xith3d.test.Xith3DTexCoordGenerationTest.
[/quote]
Yes, with Xith3d environment mapping is very easy to use. Compared to a normal texture mapped Shape3d you just have to add two further lines. Like in the above mentioned Test:


Texture2D textur = ...
TexCoordGeneration envmap = new TexCoordGeneration(TexCoordGeneration.OBJECT_LINEAR, TexCoordGeneration.TEXTURE_COORDINATE_2); // Extra code line #1

Geometry geo = ...

Appearance ape = new Appearance();
ape.setTexture(textur);
ape.setTexCoordGeneration(envmap); // Extta code line #2

Shape3D korpus = new Shape3D(geo, ape);

Many commercial games use Environment-Mapping to fake a kind of reflective surfaces, like Jeff said. And indeed it looks pretty good (for example Startrek Voyager Eliteforce II uses it all the time).

cool!

so simple, how nice indeed!

just another little one- can i put more then one texture on an object? say an environment and a simple texture map with an alpha to show the environment under it? making the alpha of the texture map an environment map.

puting a shine in some places but not all.

Are you talking about Multitexture? It’s possible by using TextureUnitState. (I didn’t test this together with environment mapping.)

sweet! ;D

cheers will play with all this stuff :slight_smile: - looking rock hard!