User clipping planes

hey ya’ll :)

i’m on a project which requires some nice groundplane reflections. For this i render a second scene pass with a transformed camera view matrix so that the camera has the same view as the main camera, only with the y cam position inverted. (so it looks at the scene from under the groundplane) Now i need a way of clipping the scene geometry at the groundplane for the reflection pass. The directx docs point to user clipping planes, but i could not find any reference concerning their use in vvvv. i know that i can clip in my shaders via hlsl clip, but would rather prefer not to handle it in shaders as that would make a mess out of my patch. maybe someone could elaborate?


alo mad,

near and far clipping can be set via the respective pins on Perspective (Transform), Ortho (Transform) or Camera (Transform Softimage).

aye joreg,

thanks for teh answer, but i was trying to cut the scene at ground level into upper and lower half to render sperate passes. (upper half -> diffuse / lower half -> reflection map) so i was thinking of something like the code below in vvvv. (does unfortunately not seem like it’s implemented yet) are there other ways to achieve said behaviour?

also it would be really nice to have a c# dx renderer plugin example at some time if thats possible. (ok, i’m dreaming again…^^)

edit: code sample taken from dx sdk. (values are straight from the example so these are not the planes i actually want to clip)

D3DXVECTOR3 a(-1.5f, 1.5f, 3.0f );
D3DXVECTOR3 b( 1.5f, 1.5f, 3.0f );
D3DXVECTOR3 c( -1.5f,-1.5f, 3.0f );
D3DXVECTOR3 d( 1.5f,-1.5f, 3.0f );
// Construct the reflection matrix
D3DXPlaneFromPoints( &plane, &a, &b, &c );
D3DXMatrixReflect( &matReflectInMirror, &plane );
m_pd3dDevice->SetTransform( D3DTS_WORLD, &matReflectInMirror );
// Reverse the cull mode (since normals will be reflected)
m_pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_CW );
// Set the custom clip planes (so geometry is clipped by mirror edges).
// This is the heart of this sample. The mirror has 4 edges, so there are
// 4 clip planes, each defined by two mirror vertices and the eye point.
m_pd3dDevice->SetClipPlane( 0, *D3DXPlaneFromPoints( &plane, &b, &a, &m_vEyePt ) );
m_pd3dDevice->SetClipPlane( 1, *D3DXPlaneFromPoints( &plane, &d, &b, &m_vEyePt ) );
m_pd3dDevice->SetClipPlane( 2, *D3DXPlaneFromPoints( &plane, &c, &d, &m_vEyePt ) );
m_pd3dDevice->SetClipPlane( 3, *D3DXPlaneFromPoints( &plane, &a, &c, &m_vEyePt ) );
m_pd3dDevice->SetRenderState( D3DRS_CLIPPLANEENABLE,
// Render the reflected scene. For the "normal" scene, RenderScene() was prior called from another function with default render states.

search for the GoochCutThrough shader, for sure in

thanks kalle,

i know about clipping in shaders, but access to the directx user clipping planes seemed more convenient for this scenario. So i’m going to do it in shaders as it seems to be the only working solution right now…

cheers and may the fast interweb be with you soon! ;)

edit: removed some gefährliches halbwissen ^^