f



spherical environment on moving object

I've put a simple spherical reflection map on my object using:

glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);		
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);

Now object moves around the scene in long linear segments, then turns 
rapidly and continues in another direction for some time. Camera is 
always positioned and oriented exactly the same relative to the object - 
meaning the environmental reflection is always the same during the 
traversal in one direction.

Id like to fake the reflection changes so it looks like object is 
passing thru other objects around it, reflecting them.

I suppose it could be done by manipulating texture stack. Is there a 
common way to do this? What transformation to apply to texture stack to 
make this look "good"?
0
Mirko
7/5/2006 7:38:35 PM
comp.graphics.api.opengl 7074 articles. 1 followers. Post Follow

5 Replies
411 Views

Similar Articles

[PageSpeed] 36

Mirko Puhic wrote:

> I suppose it could be done by manipulating texture stack. Is there a 
> common way to do this? What transformation to apply to texture stack to 
> make this look "good"?

typo: texture matrix that is, not texture stack.
0
Mirko
7/5/2006 7:40:05 PM
Mirko Puhic wrote:
> Id like to fake the reflection changes so it looks like object is 
> passing thru other objects around it, reflecting them.
> 

I don't think you can do it with an environment map,
you need to look into cube mapping (the next step
up from environment mapping).

> I suppose it could be done by manipulating texture stack. Is there a 
> common way to do this? What transformation to apply to texture stack to 
> make this look "good"?

None, because at the end of a day an environment map
only covers the half of your object which is facing
the viewer. You can't rotate the "back" into view
because there isn't one.


-- 
<\___/>
/ O O \
\_____/  FTB.    For email, remove my socks.

In science it often happens that scientists say, 'You know
that's a really good argument; my position is mistaken,'
and then they actually change their minds and you never
hear that old view from them again.  They really do it.
It doesn't happen as often as it should, because scientists
are human and change is sometimes painful.  But it happens
every day.  I cannot recall the last time something like
that happened in politics or religion.

- Carl Sagan, 1987 CSICOP keynote address

0
fungus
7/6/2006 12:34:57 AM
fungus wrote:
> Mirko Puhic wrote:
>> Id like to fake the reflection changes so it looks like object is 
>> passing thru other objects around it, reflecting them.
>>
> 
> I don't think you can do it with an environment map,
> you need to look into cube mapping (the next step
> up from environment mapping).
> 
>> I suppose it could be done by manipulating texture stack. Is there a 
>> common way to do this? What transformation to apply to texture stack 
>> to make this look "good"?
> 
> None, because at the end of a day an environment map
> only covers the half of your object which is facing
> the viewer. You can't rotate the "back" into view
> because there isn't one.
> 
> 

I follow you but... The idea was to trasnform generated texture 
coordinates to get the appearance of reflection sliding over the object. 
First I naively tried:

glMatrixMode( GL_TEXTURE );
glLoadIdentity();
glTranslatef( time, time, time );

But this just slides in the black areas. What I had in mind was to 
transform/animate the texture coordinates in a way that they stay mapped 
inside envmap circle. Kind of like rotating the s,t coordinates around 
the texture center.

In other words to achieve the same effect as if env hemisphere would be 
rotating around the principal axis. So no "back side" hemisphere is ever 
reflected.

I tried a number of transformations in texture matrix mode but nothing 
seems to rotate the map in a desired way.

Doing it with cube map seems pretty straightforward.
Only problem is - I'd prefer to do it without using extensions.
0
Mirko
7/6/2006 3:56:44 AM
Mirko Puhic wrote:
> 
> ...this just slides in the black areas. What I had in mind was to 
> transform/animate the texture coordinates in a way that they stay mapped 
> inside envmap circle. Kind of like rotating the s,t coordinates around 
> the texture center.
> 

The only transformation which could possibly
be useful is glRotate(angle, 0,0,1);

> Doing it with cube map seems pretty straightforward.
> Only problem is - I'd prefer to do it without using extensions.


Cube map is among the most widely supported extensions:

http://www.delphi3d.net/hardware/extsupport.php?extension=GL_ARB_texture_cube_map


-- 
<\___/>
/ O O \
\_____/  FTB.    For email, remove my socks.

In science it often happens that scientists say, 'You know
that's a really good argument; my position is mistaken,'
and then they actually change their minds and you never
hear that old view from them again.  They really do it.
It doesn't happen as often as it should, because scientists
are human and change is sometimes painful.  But it happens
every day.  I cannot recall the last time something like
that happened in politics or religion.

- Carl Sagan, 1987 CSICOP keynote address

0
fungus
7/6/2006 11:43:46 AM
fungus wrote:

> The only transformation which could possibly
> be useful is glRotate(angle, 0,0,1);

That's exactly what I was thinking is obvious. But when trying:

....
glMatrixMode( GL_TEXTURE );
glPushMatrix();
glLoadIdentity();
glRotatef( time, 0, 0, 1 );
glMatrixMode( GL_MODELVIEW );
drawObject();
glMatrixMode( GL_TEXTURE );
glPopMatrix();
glMatrixMode( GL_MODELVIEW );
....

I can still see the black areas sliding in. There must be some catch to it.


> 
> Cube map is among the most widely supported extensions:
> 

Yes I'll probably end up doing it that way but I'd still like to resolve 
the sphere map approach just to clear things out.
0
Mirko
7/6/2006 12:02:01 PM
Reply: