Resizing Cubemap

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.

Resizing Cubemap

Postby __bf_ddc__ » Tue May 16, 2006 3:17 pm

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.
__bf_ddc__
Greenskin
 
Posts: 103
Kudos: 0
Joined: 08 Apr 2006

Postby BlasterN » Tue May 16, 2006 8:57 pm

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
User avatar
BlasterN
Gnome
 
Posts: 378
Kudos: 0
Joined: 24 Mar 2005
Location: Spain

Postby __bf_ddc__ » Tue May 16, 2006 10:15 pm

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?
__bf_ddc__
Greenskin
 
Posts: 103
Kudos: 0
Joined: 08 Apr 2006

Postby sinbad » Wed May 17, 2006 12:52 am

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.
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
 
Posts: 19261
Kudos: 69
Joined: 06 Oct 2002
Location: Guernsey, Channel Islands

Postby __bf_ddc__ » Wed May 17, 2006 3:49 pm

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
__bf_ddc__
Greenskin
 
Posts: 103
Kudos: 0
Joined: 08 Apr 2006


Return to Using OGRE in practice

Who is online

Users browsing this forum: No registered users and 1 guest