Re: Is it possible to add enviroment mapping in CAVE?

New Message Reply Date view Thread view Subject view Author view

From: Yang YuTing (yangyt++at++ihpc.nus.edu.sg)
Date: 06/29/2000 00:10:45


Hi Angus,

Thank you very much for your reply.

Actually I read the EnvMap source code and used the same method. But I should do some modification becasue my objective is to map another scene  to the surface of an object in one scene. For example, I want to visually simulate  such fact:

I stay in a moving car. In the car, there is a TV connected to a video camera. The camera is hanged in outboard of the car and captures the outside scene when the car moves. The picture captured is displayed in the TV. I can see the TV and inside of the car.

What I wnat to visually simulate in the CAVE is the inside of the car, includeing the TV. So I

1)define one pfChannel, mychan,  to simulate the video camera,

2)defines other pfChannel for the inside of the car

3)draw mychan in the framebuffer before draw anyother pfChannel,

4) subload the texture from the framebuffer to the surface of TV,and

5) draw other pfChannel in the framebuffer to overlap the output of mychan
 

Becasue  mychan  is drawed firstly  in frambuffer and then overwrited by other pfChannel . So the output of mychan will be only seen in the surface of TV and will not be seen anywhere else.
 

In  EnvMap, when I change the viewport of view_chan into (0,1,0,1), it occupies the total output window and all other channels can not be seen. The texure in the moving sphere is still the output of env_chan. I think this results from such sequence:

1) draw env_chan in framebuffer

2) subload texture from the framebuffer to the moving sphere, and

3)draw view_chan in framebuffer to overlap the output of env_chan
 

I do not know why i can not get the same results by using same sequence in CAVE. Does it due to the stereo of CAVE, or something else ?
 

Thank you very much for your help.
 

yuting
 

Angus Dorbie wrote:

This is possible but infact the process of correctly environment mapping
an object with the scene it's in is a lot more complex than you assume.

See the EnvMap section of http://www.dorbie.com/

It has exactly the code you need. There's a link the the source code on
the front page.

You will need to do this for each cave wall, although if the view
vectors for the wall channels are 90 degrees w.r.t each other (a typical
cave setup) you could save some time using readback all the way to the
host of the initial cube map channels, depending on the complexity of
the environment channels.

Cheers,ANgus.

Yang YuTing wrote:
>
> Hi all friends,
>
> Is it possible to map an additional environment to the surface of an
> object in the CAVE by using Performer and CAVE Performer Lib?
>
> Below is the information about the 4-wall CAVE
> 2 pfPipe, pipe0 and pipe1;
> pipe0 has 1 pfWindow, window00; the size of window00 is 2048*768
> pipe1 has 1 pfWindow, window10; the size of window00 is 2048*768
> window00 has 4 pfChannels, they are chan000, chan001, chan002 and
> chan003 orderly;
> the viewpot of  chan000 is (0,0.5, 0,1)
> the viewpot of  chan001 is (0,0.5, 0,1)
> the viewpot of  chan002 is (0.5,1, 0,1)
> the viewpot of  chan003 is (0.5,1, 0,1)
> window01 has 4 pfChannels, they are chan100, chan101, chan102 and
> chan103 orderly.
> the viewpot of  chan100 is (0,0.5, 0,1)
> the viewpot of  chan101 is (0,0.5, 0,1)
> the viewpot of  chan102 is (0.5,1, 0,1)
> the viewpot of  chan103 is (0.5,1, 0,1)
>
> These 8 channels corresponds to a wall-eye respectively. All of them
> are connected to a pfScene, scene0.
>
> I want to do an enviroment texture mapping to the surface of an
> object, object0, in scene0. The enviroment is another pfScene, scene1.
> I only want to use the rendered image of the  scene1 as the texture of
> object0. So the scene1 should be not seen anywhere else in CAVE.
>
> My idea to add a new channel to render scene1 in  framebuffer, map the
> framebuffer to the surface of object0 and then overwrite the
> framebuffer by the rendered image of scene0.
>
> Below is the information after add the new channel
> 2 pfPipe, pipe0 and pipe1;
> pipe0 has 1 pfWindow, window00; the size of window00 is 2048*768
> pipe1 has 1 pfWindow, window10; the size of window00 is 2048*768
> window00 has 5 pfChannels, they are mychan, chan000, chan001, chan002
> and chan003 orderly;
> the viewport of mychan is (0,0.5, 0,1)
> the viewpot of  chan000 is (0,0.5, 0,1)
> the viewpot of  chan001 is (0,0.5, 0,1)
> the viewpot of  chan002 is (0.5,1, 0,1)
> the viewpot of  chan003 is (0.5,1, 0,1)
> window01 has 4 pfChannels, they are chan100, chan101, chan102 and
> chan103 orderly.
> the viewpot of  chan100 is (0,0.5, 0,1)
> the viewpot of  chan101 is (0,0.5, 0,1)
> the viewpot of  chan102 is (0.5,1, 0,1)
> the viewpot of  chan103 is (0.5,1, 0,1)
>
>
> Below are the codes to do environment mapping,
>
> mychan = new pfChannel(pipe0);
> mychan->setScene(scene1)
> mychan->setTravFunc(PFTRAV_DRAW, DrawMyChan);
> void DrawMyChan (pfChannel *channel, void *)
> {
>     channel->clear();
>     pfDraw();
>     shared->MyTex->subload(PFTEX_SOURCE_FRAMEBUFFER, NULL, 0, 0, 768,
> 0, 0, 1024, 768);
>     //MyTex is the texture of the object0
> }
>
> Because mychan, chan000 and chan001 occupies the same part of the
> screen(0,1024,0,768), I think the executive of the program for one
> frame should be as follows:
>
> 1)call DrawMyChan. In DrawMyChan, pfDraw draws scene0 and then the
> framebuffer is mapped to the surface of object0.
> 2) call the draw function of other channels, chan000 and chan001 will
> overwrite mychan.
>
>
> But when i run my program, what I see in the surface of object1 is the
> chan000, but mychan. If I change the order of channels belonging to
> pipe0 as chan000-> mychan-> chan001->chan002->chan003, then i can see
> mychan in the surface of object1. But in this case, mychan  is not
> overwrited and can still be seen in the screen.
>
> Anybody know what is wrong with my idea and my code. Thank you very
> much.
>
> yuting
>
>
>
> -----------------------------------------------------------------------
> List Archives, FAQ, FTP: http://www.sgi.com/software/performer/
> Submissions: info-performer++at++sgi.com Admin. requests:
> info-performer-request++at++sgi.com

--
For Performer+OpenGL tutorials http://www.dorbie.com/

"In the middle of difficulty lies opportunity."
 --Albert Einstein


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Thu Jun 29 2000 - 00:44:07 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.