PDA

View Full Version : CUBIC ENV MAPPING



mwanderson
04-12-2001, 09:24 AM
I have been playing around with cubic env mapping, how do I get env mapping to reflect based on the objects location in relation to the camera, so that the reflection on a sphere changes with the camera?

davepermen
04-12-2001, 09:50 AM
before rendering the sphere grab the modelviewmatrix, grab its rotation and invert it, load this into the texturematrix of your cubemapstage

grab its rotation:

just kill the 4th line / row.. means this:

a b c 0
d e f 0
g h i 0
0 0 0 1

then inverting is simple cause its just rotation: you have to transpose it simply..

a d g 0
b e h 0
c f i 0
0 0 0 1

then load this into the texturematrix.. like that the cube rotates in the inverted way you do.. that means ( cause cubemap is viewindependand, so you dont rotate.. ) it works like the camera system.. instead of moving the cam you move the scene in the opposite..

mwanderson
04-12-2001, 10:01 AM
Cool thanks, i'll give that a go! http://www.opengl.org/discussion_boards/ubb/smile.gif

mwanderson
04-12-2001, 10:04 AM
Is there a way with GL to copy the current matrix into a local matrix?

davepermen
04-12-2001, 10:06 AM
as long as i am online, you can grab a demo here.. ( i have a 56k modem, so slow uploading.. but its not soo big.. )
http://194.230.199.41/Demonstration.zip

hope you are fast enough.. its just this code i wrote above.. nothing else..

btw, its my harddrive you will grab it when you do it.. so be fast, i have to reboot in bout 20minutes, and then i will loose this ip..

[This message has been edited by davepermen (edited 04-12-2001).]

davepermen
04-12-2001, 10:13 AM
float matrix[ 16 ];
glGetFloatv( GL_MODELVIEW (_MATRIX.. i dont remember ), matrix );

do you have MSDN library? if you have, just browse it, it has every opengl function described.. ( very usefull, have to upload it sometimes onto my official page )

davepermen
04-12-2001, 10:35 AM
Resolved dynamic IP address [194.230.199.41]
Resolved dynamic IP address [194.230.199.41]
62.226.6.100 localhost - [12/Apr/2001:21:33:28 +0200] "GET /Demonstration.zip HTTP/1.1" 206 17631 "http://194.230.199.41" "FlashGet"
Resolved dynamic IP address [194.230.199.41]
Resolved dynamic IP address [194.230.199.41]

hm.. whas that you mwanderson? what the hell is "FlashGet"..

Lars
04-12-2001, 10:57 AM
A nice FTP programm, you can get it at www.amazesoft.com. (http://www.amazesoft.com.)

(But i didn't download, just wan'ted to give an answer)

Lars

mwanderson
04-12-2001, 11:45 AM
Nope I just downloaded it a second ago