I am working on an AR based web app where I need to display some product images on a marker. I found SLARToolkit and the samples are working fine. But now I need to display the 3D models of the products instead of sample "3D world and cubes". As I am a developer, I don't have any idea about 3D modeling though I have a designer in my team. Now I need to know, how to convert the images to 3D models that will be placed on the markers? Are there any softwares which can do the conversions?
This si a link that lets you play with 3d effect
3d
and I can suggest you to drop a shadow in silverlight using
<DropShadowEffect Direction="0" BlurRadius="10"
ShadowDepth="1" Opacity="0.6" Color="White" />
Related
I'm creating WPF application in which I'm drawing a point cloud. Points are made as little cubes. I'd like to sign indexes with numbers near to each "cube-point" (eg. 1, 2, 3, ...) so I want to add text to my 3D View.
This is my xaml part:
<ModelVisual3D x:Name="model">
<ModelVisual3D.Content>
<Model3DGroup x:Name="group">
<AmbientLight Color="DarkGray" />
<DirectionalLight Color="White" Direction="-5,-5,-7" />
</Model3DGroup>
</ModelVisual3D.Content>
</ModelVisual3D>
In code-behind I'm adding GeometryModel3D (built with mesh cube-points) to Model3DGroup (named 'group').
I tried to use this code: http://www.ericsink.com/wpf3d/4_Text.html
but this is very inefficient way and everything works slowly when I generate and display about 7000 (number of cube-points) such textBlocks.
Do you have any idea how to add some text in a more efficient way?
Of course!
The best resouces about majority of WPF 3D features are in
1. Petzold Ch. book: 3D Programming for Windows
2. Jack Xu. Practical WPF Graphics Programming
Simplest way to take WPF 3D text feature is to work with code from the first detected book
http://www.microsoft.com/mspress/companion/9780735623941/
I have some XAML based diagrams that consist of Paths embedded in Canvas objects e.g.
<Canvas x:Name="c1" Width="55.2533" Height="18.2933" Canvas.Left="194.606" Canvas.Top="194.131">
<Path x:Name="Path_5" Width="8.02666" Height="13.44" Canvas.Left="0" Canvas.Top="0.559998" Stretch="Fill" Fill="#FF000000" Data="......etc"/>
</Canvas>
Is there a way/tool to convert the XAML to either a ShapeFile or SqlGeometry data? I need to convert as I want to display the graphic in a third party map control that only binds to ShapeFiles or SqlGeometry data.
Any help would be appreciated.
The first thing to do would be to extract the path points. Then you need to produce your shape.
GETTING POINTS:
this stackoverflow answer describes altering a shape, but you see how to get the points from a path.
BUILDING SHAPE:
Cant' use SqlGeometry with Silverlight:
I think part of the answer is you can't go to SqlGeometry directly in silverlight. Your example is using Microsoft.SqlServer.Types, which was not built for the silverlight runtime. If you were going to a service it would be no problem, the service could use the full .NET framework an you can use the path points to build a well-known-text string, and then go directly to a sqlGeometry using
SqlGeometry newGeom = SqlGeometry.STGeomFromText(wktstring, srid).MakeValid();
Best best is to try to create a shapefile
I'm afraid I can't help you with creating a shapefile, sorry. Haven't used them much.
I have a series of points which I will turn into a line on a graph. What I want is to give the area under the graph a gradient fill. It would look somewhat similar to a Bloomberg graph like this;
My question really has three parts;
First, how should I fill only the area under the graph?
Second, how do I fill that with a gradient?
Finally, if I have multiple lines on the same graph any area under more than one line should have a greyscale gradient fill, how would you set this up?
My biggest problem is deciding on the data structures to use, I could use many multiple sided shapes (One for each line/ data series) and then tell the brush to draw;
Transparent if it's not in any shape
The colour of one series if it's in one shape (Alpha relative to height to give grad)
Black if it's in multiple shapes (Alpha relative to height to give grad)
Then I'd draw the shapes' boundaries in white afterwards.
Thanks,
Gav
The gradient effect is possible using the free version of Visiblox Silverlight Charts. See the example application 'Hindsight' to see how Visiblox charts can be applied to an application of this context.
I've attached a crude code snippet of the XAML on how to achieve this effect:
<UserControl x:Class="SilverlightApplication1.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:v="clr-namespace:Visiblox.Charts;assembly=Visiblox.Charts">
<UserControl.Resources>
<LinearGradientBrush x:Key="GradientBrush" StartPoint="1.0, 0.0" EndPoint="1.0, 1.0">
<GradientStop Color="AliceBlue" Offset="0.3" />
<GradientStop Color="DarkBlue" Offset="0.7" />
</LinearGradientBrush>
</UserControl.Resources>
<Grid x:Name="LayoutRoot" Background="White">
<v:Chart x:Name="Chart">
<v:Chart.Series>
<v:LineSeries x:Name="Series" ShowArea="True" AreaFill="{StaticResource GradientBrush}"/>
</v:Chart.Series>
</v:Chart>
</Grid>
Personally, I would take the action that Hindsight does, removing the area under lines when there are multiple series on the plot area. I think at that point the gradients get in the way of the data, and as you mentioned above, to do something about this incurs a computational cost. This could also lead to misinterpretations of the data so be wary.
In terms of getting your data to the chart, you can use the Visiblox BindableDataSeries to bind your business objects directly onto the chart. :)
Disclosure: I have previously worked as a developer on Visiblox Charts.
Hope this helps!
I see that there is a Markers Property on the MediaElement, but this seems to be available to the Silverlight MediaElement, not the WPF MediaElement?
Can you help me with what I'm missing?
I'm trying to add Markers to a WPF MediaElement, to play a video and show popups based on the timeline. What should I be using in place of the Missing Markers collection?
Thank you for your help.
There are two aspects to your question depending on what you actually intended - please note that the MediaElement.Markers Property is a read only collection of timeline markers associated with the currently loaded media file:
What's a timeline marker?
Here's the MSDN description of the TimelineMarker Class:
A timeline marker is metadata associated with a particular point in a media file. These markers are usually created ahead of time and stored in the media file itself. They are typically used to name different scenes in a video or provide scripting cues. By handling the MediaElement object's MarkerReached event or by accessing the MediaElement object's Markers property, you can use timeline markers [...]
So timeline markers may be a good fit for encoding your popups, but it is important to note that they are a property of the media file itself and not the collection of graphical tick marks on the typical media players timeline widget!
How do I create and handle timeline markers?
The only article summarizing this I could find right now is How to encode video markers for consumption in Silverlight and WPF from Steven Porter. (Don't get fooled by the registration demand, it's the infamous technique from the evil hyphen site that motivated the creation of Stack Overflow in the first place, i.e. you can read the article just fine without registering, just keep scrolling down.)
How do I create a timeline control with tick marks in WPF?
Assuming this is what you're actually trying to achieve and why you stumbled over the MediaElement.Markers collection the answer is roll your own:
It's pretty simple though, basically you will need to customize a Slider control to your liking, see this example from the Slider Class documentation on how to use the Ticks property to create tick marks along the Slider at irregular intervals:
<Slider Width="100" Value="50" Orientation="Horizontal" HorizontalAlignment="Left"
IsSnapToTickEnabled="True" Maximum="3" TickPlacement="BottomRight"
AutoToolTipPlacement="BottomRight" AutoToolTipPrecision="2"
Ticks="0, 1.1, 2.5, 3"/>
I have a few 3D meshes in my WPF application, and I need to add some animations to them, not the typical animations, but rather a sequence of PNG images for creating a graphical animation.
Think of it like I need to add a cartoon animation to the side of a Cube.
I know very well about the Viewport2DVisual3D, but when I replace my normal ModelVisual3D with a Viewport2DVisual3D, I get horrible performance! Around the 5 FPS mark.
As soon as I remove the material with IsVisualHostMaterial set to true, the frame rate is restored to a normal state.
Performance is always a tricky subject, but what I was thinking was creating a Visual Brush with an image source of a WriteableBitmap or RenderTargetBitmap and then draw my PNG's to that sequence.
Does this sound OK, or should I not be getting the poor performance that I'm getting?
Actually, come to think of it, have you tried using this?
<DiffuseMatrial>
<DiffuseMaterial.Brush>
<VisualBrush ...>
<VisualBrush.Visual>
...
I know that MILCore handles VisualBrush by rendering the backing Visual as a separate operation, so I wouldn't be surprised if it worked very efficiently with 3D.
Update
It also occurs to me you might try:
<DiffuseMaterial>
<DiffuseMaterial.Brush>
<DrawingBrush ...>
<DrawingBrush.Drawing>
<ImageDrawing ImageSource="{Binding ...} />
This would bypass the use of Visual entirely and possibly run much faster than Viewport2DVisual3D or VisualBrush.
I haven't yet had a need to dig deeply into WPF's 3D optimizations, but I know that Direct3D is capable of rendering using a writable buffer so if MILCore implements it correctly your idea of WritableBitmap or RenderTargetBitmap have a reasonable chance of working. Vista's Flip 3D is able to make this work with high performance using arbitrary applications (even GDI applications) and also uses a writable buffer.
If that doesn't work, another idea for you is to convert your animation into a video, either the traditional way or by creating a DirectShow stream from a sequence of BitmapFrames.
Hopefully someone else can come along and give you a better answer.
If your PNGs are representing a video stream, why not convert them to a video format at the outset? Creating an AVI from frames is easy. Horses for courses, as they say. It could be the PNG decoder slowing you down.