Re: [osg-users] Single-sided ClipPlane?

2009-05-27 Thread Paul Griffiths
Wish someone could of told me, you cant put clipplanes within clip planes, you 
cant make holes!

Is it possible to have more than one clipNode in a scene? if i try 2 clipnodes 
everything gets clipped to the second node.

Any ideas?

If I cant use more than one clipNode in a scene im thinking about using a 
shader to make parts transparant. BUT ive got to figure a way to cap the holes 
after.

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=13016#13016





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Single-sided ClipPlane?

2009-05-24 Thread Simon Hammett
2009/5/24 Paul Martz pma...@skew-matrix.com:
 http://www.sstk.co.uk/portalRendering/portal.php

 Unless I'm missing something, couldn't you do this in OSG using an Occluder
 (for host-side culling) and the stencil buffer (to control screen
 rendering)?

You don't even need that.

Just set up the clip planes properly.

Translate the cameras position into the portals coordinate frame,
then use each edge of the portal and the camera position to construct
a clip plane.

This should be easy to do in osg.

Just need to know where to put the callback.

Course it will all go pear shaped if the stuff though the portal uses
clip planes,
unless your h/w supports lots of them.

But I suspect that might happen even with using the stencil buffer.

I think you need to get clever to support multi level portals. ie ones where
you can see a portal through a portal.

IIRC most games with portal rendering don't support multiple levels.

-- 
http://www.ssTk.co.uk
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Single-sided ClipPlane?

2009-05-24 Thread Paul Griffiths
Just to let people know, portals is not quite what im looking for, its more of 
an extended type portal, i believe a portal is a plane with a texture of a 
scene applied to give to look of a scene within a scene, im looking for scenes 
within scenes but with models coming out from the portal front too.

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=12856#12856





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Single-sided ClipPlane?

2009-05-24 Thread Simon Hammett
2009/5/24 Paul Griffiths gaffe...@gmail.com:
 Just to let people know, portals is not quite what im looking for, its more 
 of an extended type portal, i believe a portal is a plane with a texture of a 
 scene applied to give to look of a scene within a scene, im looking for 
 scenes within scenes but with models coming out from the portal front too.

portals don't use textures. it's just clip planes, though
you will need to clear the depth buffer within the portal.

if you want the model sticking out the front you'll have to
have another instance of it, with the in portal side clipped off.

-- 
http://www.ssTk.co.uk
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Single-sided ClipPlane?

2009-05-24 Thread Paul Griffiths
Ive worked out whats required to get my effect working , though im only 
guessing right now at the math required.

Just need 4 clipPlanes facing into the into the scene surrounding the panel. 
Simple, in theory lol

Cheers,
PaulG

[Image: http://img411.imageshack.us/img411/713/clipplanes.png ]

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=12864#12864





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Single-sided ClipPlane?

2009-05-24 Thread Simon
Paul Griffiths wrote:
 Ive worked out whats required to get my effect working , though im only 
 guessing right now at the math required.
 
 Just need 4 clipPlanes facing into the into the scene surrounding the panel. 
 Simple, in theory lol
 
 Cheers,
 PaulG

Given 3 points on a plane, the plane equation is:

osg::Vec3   n = (pt1 - pt0) ^ (pt2 - pt1);
float   d = -n * pt0;
osg::ClipPlane  *cp = new osg::ClipPlane(i, n.x(), n.y(), n.z(), d);

-- 
http://www.ssTk.co.uk
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Single-sided ClipPlane?

2009-05-24 Thread Paul Griffiths

Simon wrote:
 Paul Griffiths wrote:
 
  Ive worked out whats required to get my effect working , though im only 
  guessing right now at the math required.
  
  Just need 4 clipPlanes facing into the into the scene surrounding the 
  panel. Simple, in theory lol
  
  Cheers,
  PaulG
  
 
 Given 3 points on a plane, the plane equation is:
 
 osg::Vec3 n = (pt1 - pt0) ^ (pt2 - pt1);
 float d = -n * pt0;
 osg::ClipPlane*cp = new osg::ClipPlane(i, n.x(), n.y(), n.z(), d);
 
 -- 
 http://www.ssTk.co.uk
 ___
 osg-users mailing list
 
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 
  --
 Post generated by Mail2Forum


Thanks for the math, was wondering how to project a plane based on 3 points.  :D

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=12870#12870





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Single-sided ClipPlane?

2009-05-23 Thread Paul Griffiths
I have a second idea to get my desired effect, but i would much prefer 
single-sided clipPlanes.

If anyone know of other ways too then please do post.

[Image: http://img507.imageshack.us/img507/8462/idea.png ]

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=12802#12802





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Single-sided ClipPlane?

2009-05-23 Thread Paul Griffiths
My second idea of how to create my effect has a flaw, if the rear contents of 2 
scrollpanels overlap then ill get the contents of the scrollpanels inside each 
other.

If anyone knows how to create single-sided clipPlanes which only clip when 
viewed from one side and when viewed from the other side do not clip then do 
post, its what I need.

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=12816#12816





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Single-sided ClipPlane?

2009-05-23 Thread Paul Martz
Most state attributes, including ClipPlane, have a 1-to-1 correspondence
with OpenGL state, so you can look up what they do:
http://www.opengl.org/sdk/docs/man/xhtml/glClipPlane.xml

The short answer is that plain vanilla ClipPlane won't do this. However, you
could easily attach an UpdateCallback that knows the current view position,
and enable/disable the corresponding GL_CLIP_PLANE accordingly.

Paul Martz
Skew Matrix Software LLC
http://www.skew-matrix.com
+1 303 859 9466

-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Paul
Griffiths
Sent: Friday, May 22, 2009 3:59 PM
To: osg-users@lists.openscenegraph.org
Subject: [osg-users] Single-sided ClipPlane?

Hi,
Is it possible to set a ClipPlane so it's singe-sided so it only clips when
viewed from only one side? and can you select which side?
... 

Thank you!

Cheers,
PaulG

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=12794#12794





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Single-sided ClipPlane?

2009-05-23 Thread Paul Griffiths

Paul Martz wrote:
 Most state attributes, including ClipPlane, have a 1-to-1 correspondence
 with OpenGL state, so you can look up what they do:
 http://www.opengl.org/sdk/docs/man/xhtml/glClipPlane.xml
 
 The short answer is that plain vanilla ClipPlane won't do this. However, you
 could easily attach an UpdateCallback that knows the current view position,
 and enable/disable the corresponding GL_CLIP_PLANE accordingly.
 
 Paul Martz
 Skew Matrix Software LLC
 http://www.skew-matrix.com
 +1 303 859 9466
 
 -Original Message-
 From: 
 [mailto:] On Behalf Of Paul
 Griffiths
 Sent: Friday, May 22, 2009 3:59 PM
 To: 
 Subject:  Single-sided ClipPlane?
 
 Hi,
 Is it possible to set a ClipPlane so it's singe-sided so it only clips when
 viewed from only one side? and can you select which side?
 ... 
 
 Thank you!
 
 Cheers,
 PaulG
 
 --
 Read this topic online here:
 http://forum.openscenegraph.org/viewtopic.php?p=12794#12794
 
 
 
 
 
 ___
 osg-users mailing list
 
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 
 ___
 osg-users mailing list
 
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 
  --
 Post generated by Mail2Forum


Good idea, should of though of that.

Now im thinking about when it should/shouldnt clip.

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=12828#12828





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Single-sided ClipPlane?

2009-05-23 Thread Paul Griffiths
How do you disable a clipPlane?

osg::ClipPlane plane = this-clipNode-getClipPlane(2);

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=12833#12833





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Single-sided ClipPlane?

2009-05-23 Thread Paul Martz
ClipPlane is what's known as positional state in OSG, and the plane
equation is a StateAttribute that is in effect for your entire RenderStage.
You enable or disable it on a per-node basis just like any other state:
  node-getOrCreateStateSet()-setMode( GL_CLIP_PLANEn,
osg::StateAttribute::ON|OFF );

...where n is the ClipPlane number.

This all seems very familiar. I believe this was discussed just recently in
this list; check the archives for the past couple weeks.

Paul Martz
Skew Matrix Software LLC
http://www.skew-matrix.com
+1 303 859 9466

-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Paul
Griffiths
Sent: Saturday, May 23, 2009 11:02 AM
To: osg-users@lists.openscenegraph.org
Subject: Re: [osg-users] Single-sided ClipPlane?

How do you disable a clipPlane?

osg::ClipPlane plane = this-clipNode-getClipPlane(2);

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=12833#12833





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Single-sided ClipPlane?

2009-05-23 Thread Paul Griffiths
Enabling/disabling clipPlanes won't do the job, your looking at the side and 
into the scroll window at the same time.

From what i can work out, clipPlanes slice all the way along the model and 
remove the outer half, so any clipping applied is going to effect what I see 
at the front of the scroll window too.

Or am I missing something?

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=12839#12839





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Single-sided ClipPlane?

2009-05-23 Thread Simon Hammett
2009/5/23 Paul Griffiths gaffe...@gmail.com:
 Enabling/disabling clipPlanes won't do the job, your looking at the side and 
 into the scroll window at the same time.

 From what i can work out, clipPlanes slice all the way along the model and 
 remove the outer half, so any clipping applied is going to effect what I see 
 at the front of the scroll window too.

 Or am I missing something?

 --
 Read this topic online here:
 http://forum.openscenegraph.org/viewtopic.php?p=12839#12839

Is this what you are after?

http://www.sstk.co.uk/portalRendering/portal.php

-- 
http://www.ssTk.co.uk
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Single-sided ClipPlane?

2009-05-23 Thread Paul Griffiths

Simon Hammett wrote:
 2009/5/23 Paul Griffiths :
 
  Enabling/disabling clipPlanes won't do the job, your looking at the side 
  and into the scroll window at the same time.
  
  
   From what i can work out, clipPlanes slice all the way along the model 
   and remove the outer half, so any clipping applied is going to effect 
   what I see at the front of the scroll window too.
   
  
  Or am I missing something?
  
  --
  Read this topic online here:
  http://forum.openscenegraph.org/viewtopic.php?p=12839#12839
  
 
 Is this what you are after?
 
 http://www.sstk.co.uk/portalRendering/portal.php
 
 -- 
 http://www.ssTk.co.uk
 ___
 osg-users mailing list
 
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 
  --
 Post generated by Mail2Forum


Yes, that is what im trying to achieve.

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=12851#12851





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Single-sided ClipPlane?

2009-05-23 Thread Paul Martz
 http://www.sstk.co.uk/portalRendering/portal.php

Unless I'm missing something, couldn't you do this in OSG using an Occluder
(for host-side culling) and the stencil buffer (to control screen
rendering)?

Paul Martz
Skew Matrix Software LLC
http://www.skew-matrix.com
+1 303 859 9466

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Single-sided ClipPlane?

2009-05-22 Thread Paul Griffiths
[Image: http://img177.imageshack.us/img177/9184/singlesidedclipplane.png ]

This is the effect im after, if i can have single sided clipPlanes then i can 
construct a clipBox behind my window so from the outside it clips my 
scrollpanel behind so my window has virtually no depth, but from looking in to 
my window the scene within has unlimited depth. 

Any ideas, I really need this effect.  :D

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=12799#12799





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org