Reflection

Blitz3D Forums/Blitz3D Programming/Reflection

Jerome Squalor(Posted 2007) [#1]
How do I make a texture that reflects??


_33(Posted 2007) [#2]
you make a cubemap, or if you know how to build a spheremap, that could work too. Or, you could simply snapshot a render into a texture and use that as a second texture layer and alpha blend. There are other ways also, but already you have the idea. There is no easy way.


Jerome Squalor(Posted 2007) [#3]
What is cube mapping? I've heard of it before, but I never figured out what it is or how to do it.


bytecode77(Posted 2007) [#4]
there are some examples in your blitz3d folder. try them. also the help files should be useful!

these are the commands you might use:

CreateTexture
SetCubeMode
SetCubeFace



Andy(Posted 2007) [#5]
http://www.blitzbasic.com/codearcs/codearcs.php?code=1524

Andy


_33(Posted 2007) [#6]
In that example, if you want proper mirror brightness, fix it by replacing the brush1 code with this:
; brushes
brush1=CreateBrush() 
BrushTexture brush1,tex 
;BrushShininess brush1,1 
BrushFX brush1,1


will make the mirror texture fullbright.


bytecode77(Posted 2007) [#7]
eh - i just got the idea that he dont wanna do complex reflection.

i think what you want is a mirror

use
CreateMirror()
in any of your projects and watch ;D


Andy(Posted 2007) [#8]
>In that example, if you want proper mirror brightness, fix
>it by replacing the brush1 code with this:

Thanks mate. This was always development code, so anything beyond looking about right was good enough for me. But I updated it anyway.

Andy


Jerome Squalor(Posted 2007) [#9]
thanks everyone but it turns out i don't have a good enough graphics card to support reflections.


Andy(Posted 2007) [#10]
>thanks everyone but it turns out i don't have a good
>enough graphics card to support reflections.

Why not?


Andy


bytecode77(Posted 2007) [#11]
you dont have a matrox graphic card, do you?
cause if you do, get yourself a new pc.


jfk EO-11110(Posted 2007) [#12]
There are various kinds of reflections.

A very simple one, that will only reflect a light source, useful for eg. a snooker sphere:

Entityshininess entity,1.0

Cubemapping requires the special Caps, as your card doesn't
offer. It is also pretty tricky to use it the right way, it's slow and the resolution of the reflection is most times lower than the screen (something I'd consider an artefact)

Spheremapping won't need the caps as cubemapping! There's an example in your installation folder named "TheHead.bb", an excellent sample on Spheremapping!

Finally there's CreateMirror, that will create an infinite plane that will reflect everything, unfortunately also the things below it to the upper side. So you may use this mirror as the most bottom object in your level, or use Tom's dx7 dll that allows to Clip Rendering at a certain Y height.

For a simple reflection effect, eg. a sword made of steel I'd suggest to use Spheremapping, it's fast and looks ok.