Generating cubemaps?

Blitz3D Forums/Blitz3D Programming/Generating cubemaps?

poopla(Posted 2003) [#1]
What does a cubemap look like? The docs say it is 6 images. I've never messed with this.


BlitzSupport(Posted 2003) [#2]
Stick this (12k) into your \samples\mak\castle\ folder -- scroll down a page to the "create cubic env map stuff" comment for Mark's example cubemap generation stuff...


poopla(Posted 2003) [#3]
cool thanks.


eBusiness(Posted 2003) [#4]
Now that you talk about it. What is a cubemap? What is it good for? Does it slow down my programs? Only ever heard that some people were very exited about it, not why.


Ross C(Posted 2003) [#5]
Hmmm...a cubemap is a 6 sided texture that is applied to entity's to give the impression of a reflective world. It's like putting a cube textured with six different textures, and wrapping it to an entity. You can have a couple of cubemap modes to. One that acts like sphereical reflection.

I'm sure someone will be along to explain this better, but that's the basics of it :)


Akat(Posted 2003) [#6]
huh, by the way, i try to tangle along with cube map thingy, but everything look not right when u try to reflect the skybox... those jaggy thing too obvious


Mustang(Posted 2003) [#7]
And you can use cubemaps for lighting too... I think Sswift posted a demo about that. Obvious advantage is of course that you might not need ANY "true" lights then and yet get much richer lighting than what you would get even using several "true" lights (which would be dead slow too of course).

Cubemaps do not slow you down because it's a hardware thingy... but if you don't have it in HW then you can't run the app that uses them. But even GeForce1 had that so...

Oh, and if you are going to do cubemaps reflections that are re-rendered EVERY frame you are going to see dramatic drop-down of your FPS.


eBusiness(Posted 2003) [#8]
Hmmm, interesting. But I don't think I understood exacly how it works, whatever.


Ross C(Posted 2003) [#9]
Bsically imagine a Skybox being shown on your mesh. you entity would look like it was reflecting the whole level. The sphereical reflection map, however, is a one sided texture.


jfk EO-11110(Posted 2003) [#10]
I have to mention that the way that is used in the cubic-castle.bb Demo might be not fully correct. In the Demo the enviroment-camera is positioned at the reflective meshes positon, which is not reflecting things correctly.

I tried this demo with an animated water MD2 mesh. After some experiments I have found it would look ALMOST correct, if I position the enviroment-camera at the player cameras position. But it isn't simply the player-cameras positon, instead use X and Z of that playercamera and Y must be the NEGATIVE value of the Player-camera-Y plus the Y of the reflective Mesh plus the offset from this meshes center pivot to its reflective surface (which can be determined experimentically or by formulas)

so, add this to the top of the function UpdateRefCam:
Function UpdateRefCam(tex,camera)
 for c.Chasecam=each ChaseCam
  positionentity camera, entityx(c\camera),entityy(teapot)+7+-entityy(c\camera),entityz(c\camera)
 next
;... the rest remains unchanged

It really looks much better. PS teapot must be decleared as Global.


eBusiness(Posted 2003) [#11]
JFK, I don't know much about cubemaps, but I can't make sense of that description, seems only to make sense if the entity have an y position of about 0.


jfk EO-11110(Posted 2003) [#12]
maybe you are right