[WPF Disciples] Silverlight's PlaneProjection in WPF?

2,005 views
Skip to first unread message

Josh Santangelo

unread,
May 4, 2010, 10:21:37 AM5/4/10
to wpf-disciples
I'm wondering if anyone has managed to simulate Silverlight's PlaneProjection feature in WPF. It seems like it should be possible using the WPF 3D engine. Ideally I'd like something like this:

<local:PlaneProjection RotationX="0" RotationY="0" RotationZ="0" 
                       GlobalOffsetX="0" GlobalOffsetY="0" GlobalOffsetZ="0" 
                       LocalOffsetX="0" LocalOffsetY="0" LocalOffsetZ="0"
                       CenterOfRotationX="0" CenterOfRotationY="0" CenterOfRotationZ="0"
                       Width="200" Height="200"
                       HorizontalAlignment="Center" VerticalAlignment="Center">
  <local:PlaneProjection.Content>
    <Button Content="front" />
  </local:PlaneProjection.Content>
  <local:PlaneProjection.BackContent>
    <Button Content="back" />
  </local:PlaneProjection.BackContent>
</local:PlaneProjection>

When all of the rotation/offset properties are set to zero, the content should appear and lay out as it normally would. Changes to these values should transform the object in the same way as Silverlight's PlaneProjection feature.

I'm not an expert in WPF 3D or 3D in general, but I'm planning to give it a shot. However I'm wondering if any of the Disciples can tell me if this is just crazy to even attempt or not. Seems like if it could be done it would have been already.

(I am aware of the ContentControl3D and Thriple projects, but neither of those do what I need, which is respect the layout of the container they're in.)

-- 
s t i m u l a n t  /  Josh Santangelo, Technical Director

Sacha Barber

unread,
May 4, 2010, 12:43:53 PM5/4/10
to wpf-di...@googlegroups.com
No as far as I know, would be good to see 3d made easier in WPF though.
--
Sacha Barber
sacha....@gmail.com

Sacha Barber

unread,
May 4, 2010, 12:44:04 PM5/4/10
to wpf-di...@googlegroups.com
Cory is a good person to chat to on this.
--
Sacha Barber
sacha....@gmail.com

Jeremiah Morrill

unread,
May 4, 2010, 12:48:03 PM5/4/10
to wpf-di...@googlegroups.com
There's one here:  http://slflow.codeplex.com/ (its both a SL and WPF project)

IIRC, It's done using a pixel shader, but seems like a reasonable facsimile of plane projection in Silverlight.  I haven't personally used it, but yeah, Cory might be able to shed some more light on it.

-Jer

Jeremiah Morrill

unread,
May 4, 2010, 12:52:30 PM5/4/10
to wpf-di...@googlegroups.com
And of course the Planerator...  This one I have used a while back and it worked fine for me.

Josh Santangelo

unread,
May 4, 2010, 1:14:53 PM5/4/10
to wpf-disciples
Thanks for the links -- I think Planerator will do most of what I need, so maybe I can work with that. A complete PlaneProjection solution would be pretty cool though -- perhaps it can be extended without too much pain.

Jeremiah Morrill

unread,
May 4, 2010, 1:42:22 PM5/4/10
to wpf-di...@googlegroups.com
No prob.  (IIRC) One suggestion with the planerator..if you are using WPF 4.0, edit the code to set the CacheMode property on the ViewPort2DVisual3D to use BitmapCache for cached composition.  Internally it will use the BitmapCacheBrush vs. the VisualBrush.  It will take your FPS to 60 and your CPU to 0% :).  I'd remove the "SetCachingForObject" method in there if you go this route.

-Jer

Josh Santangelo

unread,
May 4, 2010, 1:54:21 PM5/4/10
to wpf-disciples
Thanks for the tip... unfortunately this is for an MS Surface project, where the world has stopped at WPF 3.5 for now. There are many cases where I'd like to use BitmapCache!

Josh Santangelo

unread,
Jun 17, 2010, 11:23:42 PM6/17/10
to wpf-disciples
Hi all -- reviving this thread to show you where I ended up with it, and provide a download: http://blog.endquote.com/post/710116433/planeprojection-in-wpf

Comments welcome.


--
s t i m u l a n t  /  Josh Santangelo, Technical Director
P 206 229 5674 / O 415 255 7081 / F 815 550 1203 / W http://stimulant.io


Peter O'Hanlon

unread,
Jun 18, 2010, 3:25:01 AM6/18/10
to wpf-di...@googlegroups.com
Very nice Josh. I'll d/l and have a play round.
--
Peter O'Hanlon

Karl Shifflett

unread,
Jun 18, 2010, 11:49:03 PM6/18/10
to wpf-di...@googlegroups.com

Josh,

 

Super nice work.  Thank you for sharing this.

 

Cheers,

 

Karl

Josh Santangelo

unread,
Jun 19, 2010, 3:26:25 PM6/19/10
to wpf-disciples
I've updated this with a small bug fix and a real-world example of usage:

I have a bunch of other posts queued up with useful extractions from my current and past projects. I won't spam the list every day with them, but do subscribe if you're interested!


--
s t i m u l a n t  /  Josh Santangelo, Technical Director
P 206 229 5674 / O 415 255 7081 / F 815 550 1203 / W http://stimulant.io


Reply all
Reply to author
Forward
0 new messages