Resizing Cubemap

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
__bf_ddc__
Greenskin
Posts: 103
Joined: Sat Apr 08, 2006 3:28 pm

Resizing Cubemap

Post by __bf_ddc__ »

Hello--

Currently I have a cubemap being projected onto a window surface inside a house; but when I get closer to it / far away from it, the cubic texture still stays the same `size`. How would one go at making this texture resize perhaps according to the distance from it?

Also, a bit `off topic`: is it possible [yet] to dynamically project what's around the said reflected texture onto it as a reflection / cubemap? I saw a few forums about it, and tried a few, but none were fully what I was looking at doing. Can this be done with the ProjectiveTexturing? Or setting a frustum at the point of the window pointing towards the area to be reflected, and somehow mapping that onto there? Any help is appreciated.

Thanks.
User avatar
BlasterN
Gnome
Posts: 378
Joined: Thu Mar 24, 2005 1:07 am
Location: Spain
Contact:

Post by BlasterN »

The cubemap its a texture so mipmap techniques must do it for you.

You can define the mipmap size in DSS format, but i dont remember the version (maybe all version supported but I'm nor sure)

If this not work. Try to use lod_index & lod_distance in the Techniques of your cubemap material


btw: See the Ogre manual -> Scripts -> Materials
Works:
MapToMesh | Bengine B9 @ www.sourceforge.net/projects/maptoogremesh/
3DWorldStudio exporter@ www.blastern.info
__bf_ddc__
Greenskin
Posts: 103
Joined: Sat Apr 08, 2006 3:28 pm

Post by __bf_ddc__ »

Not sure if I'm explaining this correctly. If I stand close to the window w/the map being projected onto it, it's still the same size texture than it is when you pull out. Is there any way to make it resize according to how far away you are from it?
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Post by sinbad »

As BlasterN suggested you should use mipmapping - increase the size of the cube texture so that the top level is larger (for when you're close to it), then when you're further away the lower mip levels will be used.

You could define 2 cube maps and use material LOD to switch between at distance X if you liked, but a single cube map of the larger size would actually take less space (assuming all textures has mipmaps enabled anyway). Plus with mipmapping the transition is smoother.
Also, a bit `off topic`: is it possible [yet] to dynamically project what's around the said reflected texture onto it as a reflection / cubemap
Yes, you use 6 render to textures, each to a face of the cube map surface. Just create the cube map with the TU_RENDERTEXTURE flag and attach cameras to the render targets for each face. wumpus posted a working example of it a few months back iirc.
__bf_ddc__
Greenskin
Posts: 103
Joined: Sat Apr 08, 2006 3:28 pm

Post by __bf_ddc__ »

Thanks for the replies.
I've been fooling around with LOD and Mipmapping for hours now, but apparently I'm missing something [probably obvious], as it being a cubemap, is seeming to still stay one set size even if I pull the camera out X distance. I see a slight skip between the swaps, so I know the code I implemented for the mipmapping/LOD were at least `doing something`[?]. I tested it with other textures, non-cubemap textures that is, and they seemed to work. But since it's a cubemap--is there something I need to set specifically so it'll resize the texture and scale it accordingly? Thanks.

[Edit:] Here's some screenies... 3 distances, texture still staying the same size...


Image
Image
Image
Post Reply