Clip plane'd cubemaps

Community Forums/Showcase/Clip plane'd cubemaps

Damien Sturdy(Posted 2006) [#1]
Hi all,
Not sure if this is the right place to post this but I have been asked to let it out anyway, so here it is:

This demonstrates how to use tom's DX7 dll to fix the water intersection problems with cubemaps:

Here's the code:

http://damientsturdy.pwp.blueyonder.co.uk/clipdemo.zip

Screenshot:



Hope some find it helpful.

Thanks to Tom for the DLL and Big10p for the clip plane code I turned into this :)


[edit]

Man, my English is *AWFUL*


jfk EO-11110(Posted 2006) [#2]
Very useful contribution, thanks. I guess this is useful for a LOT of things, like mirrors, cubemapping, water refraction fx, depth of field etc.


OrcSlayer(Posted 2006) [#3]
Thanks, this will surely be very useful to a lot of people.


Pete Carter(Posted 2006) [#4]
i get "function setsystemproperties not found"


Stevie G(Posted 2006) [#5]
Nice!

Put the dll and decals in the userlibs folder Pete.


jfk EO-11110(Posted 2006) [#6]
Pete make sure the include files and the decls files are located correctly.

Just tried it: works properly. wow, after all correctly working mirrors using CreateMirror() !!! I've been missing this many times.


Damien Sturdy(Posted 2006) [#7]
Yup, Make sure you install the userlib.

You should be fine if you have already got a newer DX7 dll installed :)

jfk, Yup, I used this when working on a dragon demo. there are some screenies floating around somewhere. It really makes a difference :D


Sledge(Posted 2006) [#8]

Very useful contribution, thanks. I guess this is useful for a LOT of things, like mirrors, cubemapping, water refraction fx, depth of field etc.



You're not kidding - I wish we'd had this for that water thread... nearly drove me nuts doing a nearside clip manually! Won't ever have to go there again. :D

It has brought something a bit worrying to my attention, though - cubemapping does not seem to work on my laptop. It's got an integrated chipset that a lot of potential customers will have so I think it's something for folk to be aware of. Links to cubemapping examples would be nice... I've tried two so far and both fail.


Grey Alien(Posted 2006) [#9]
looks lovely, I don't understand what you are talking about, but it's nice.


Sledge(Posted 2006) [#10]

I don't understand what you are talking about, but it's nice.



It boils down to reflections being a big fat cheat. If you think about what a reflected view is...

Cam
   \        /Light
     \    /
       \/(Boing!)
- - - - - - - - - - - Water


...it becomes quickly clear that, rather than trace the light for each pixel you can just bung another camera in with an inverse pitch...

Cam
   +        /Light
     +    /
       +/
- - - - - - - - - - - Water
     /
   /
 /
Cam2


The problem arises when you have something either partially or totally immersed in the water, because now the camera that generates our reflections will see things it should not...

Cam
   +        /Light
     +    /
       +/
- - - - - - - - - - - Water
     / 
  ***** <-Hello, what's this?
 /
Cam2


And this is why clip-planes are so lovely. Now you can tell the camera not to render things on either the near side of the clip plane or the far side. Stick a clip plane where the water plane is and Cam2 can now ignore anythng below the surface, giving a more accurate reflection...
            /Light
          /
        /
- - - - - - - - - - - Water
                      <-
                      <-Nowt rendered. Top banana!
                      <-
Cam2



Grey Alien(Posted 2006) [#11]
OK I *totally* get it now thanks :-) Great diagrams btw.